Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Releases

## 1.1.5 (Apr 28th, 2022)

- #47 [IE8] The _checkPrototype always fails on IE in IE8 mode

## 1.1.4 (Jun 3rd, 2021)

- #36 v1.1.3 postinstall requires rush to be installed
Expand Down
994 changes: 402 additions & 592 deletions common/config/rush/npm-shrinkwrap.json

Large diffs are not rendered by default.

41 changes: 33 additions & 8 deletions common/scripts/install-run-rush.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 26 additions & 21 deletions common/scripts/install-run.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,7 @@ <h3>Dynamic<wbr>Proto<wbr>Delegate</h3>
<div class="tsd-signature tsd-kind-icon">Dynamic<wbr>Proto<wbr>Delegate&lt;DPType&gt;<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>theTarget<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DPType</span>, baseFuncProxy<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">DPType</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/ac722ee/lib/src/DynamicProto.ts#L481">DynamicProto.ts:481</a></li>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/f424da6/lib/src/DynamicProto.ts#L494">DynamicProto.ts:494</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -3379,7 +3379,7 @@ <h3>default</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/ac722ee/lib/src/DynamicProto.ts#L535">DynamicProto.ts:535</a></li>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/f424da6/lib/src/DynamicProto.ts#L548">DynamicProto.ts:548</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
4 changes: 2 additions & 2 deletions lib/docs/interfaces/idynamicprotoopts.html
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@ <h3>set<wbr>Inst<wbr>Funcs</h3>
<div class="tsd-signature tsd-kind-icon">set<wbr>Inst<wbr>Funcs<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/ac722ee/lib/src/DynamicProto.ts#L464">DynamicProto.ts:464</a></li>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/f424da6/lib/src/DynamicProto.ts#L477">DynamicProto.ts:477</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -2778,7 +2778,7 @@ <h3><span class="tsd-flag ts-flagOptional">Optional</span> use<wbr>Base<wbr>Inst
<div class="tsd-signature tsd-kind-icon">use<wbr>Base<wbr>Inst<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/ac722ee/lib/src/DynamicProto.ts#L470">DynamicProto.ts:470</a></li>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/f424da6/lib/src/DynamicProto.ts#L483">DynamicProto.ts:483</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
4 changes: 2 additions & 2 deletions lib/docs/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -3313,7 +3313,7 @@ <h3>Dynamic<wbr>Proto<wbr>Delegate</h3>
<div class="tsd-signature tsd-kind-icon">Dynamic<wbr>Proto<wbr>Delegate&lt;DPType&gt;<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>theTarget<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DPType</span>, baseFuncProxy<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">DPType</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">void</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/ac722ee/lib/src/DynamicProto.ts#L481">DynamicProto.ts:481</a></li>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/f424da6/lib/src/DynamicProto.ts#L494">DynamicProto.ts:494</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -3378,7 +3378,7 @@ <h3>default</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/ac722ee/lib/src/DynamicProto.ts#L535">DynamicProto.ts:535</a></li>
<li>Defined in <a href="https://github.com/microsoft/DynamicProto-JS/blob/f424da6/lib/src/DynamicProto.ts#L548">DynamicProto.ts:548</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"devDependencies": {
"@microsoft/applicationinsights-rollup-es3" : "^1.0.1",
"@microsoft/dynamicproto-rollup": "1.0.0",
"grunt": "^1.4.1",
"grunt-cli": "^1.3.2",
"grunt": "^1.5.2",
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^4.0.0",
"grunt-contrib-uglify": "^5.0.1",
"grunt-run": "^0.8.1",
Expand Down
17 changes: 15 additions & 2 deletions lib/src/DynamicProto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const DynAllowInstChkTag = DynInstChkTag;
*/
const DynProtoDefaultOptions = '_dfOpts';

/**
* The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist
*/
const DynProtoPolyProto = "_dynProto";

/**
* Value used as the name of a class when it cannot be determined
* @ignore
Expand Down Expand Up @@ -135,8 +140,13 @@ function _getObjProto(target:any) {
}

// target[Constructor] May break if the constructor has been changed or removed
let newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
let newProto = target[DynProtoPolyProto] || target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
if(newProto) {
// Set the _dynProto so the hierarchy can lookup base classes correctly on IE8
if (!target[DynProtoPolyProto]) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because IE8 doesn't support looking up the prototype of a prototype, we need to provide hints to allow base classes that are also defined using dynamicProto() to be looked up.

This issue only exists for nested classes of 2 or more. And this part of the code only runs on older browsers

target[DynProtoPolyProto] = newProto;
}

return newProto;
}
}
Expand Down Expand Up @@ -431,9 +441,12 @@ function _checkPrototype(classProto:any, thisTarget:any) {
visited.push(thisProto);
thisProto = _getObjProto(thisProto);
}

return false;
}

return false;
// If objGetPrototypeOf doesn't exist then just assume everything is ok.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only affects "Old" runtimes IE8 and eariler.
So the side affect of this is that anyone using this will fail to start because the _checkPrototype always fails and throws.

return true;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/dynamicproto-js",
"description": "Microsoft Dynamic Proto Utility",
"version": "1.1.4",
"version": "1.1.5",
"keywords": [
"javascript",
"dynamic prototype",
Expand Down Expand Up @@ -40,6 +40,7 @@
"homepage": "https://github.com/microsoft/DynamicProto-JS#readme",
"dependencies": {},
"devDependencies": {
"@microsoft/rush": "^5.67.0",
"@nevware21/grunt-ts-plugin": "^0.3.0",
"@nevware21/grunt-eslint-ts": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^4.28.0",
Expand All @@ -50,8 +51,8 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-security": "^1.4.0",
"grunt": "^1.4.1",
"grunt-cli": "^1.3.2",
"grunt": "^1.5.2",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Component Governance fixes

"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^4.0.0",
"grunt-contrib-uglify": "^5.0.1",
"grunt-run": "^0.8.1",
Expand Down
4 changes: 2 additions & 2 deletions rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
},
"homepage": "https://github.com/microsoft/DynamicProto-JS#readme",
"devDependencies": {
"grunt": "^1.4.1",
"grunt-cli": "^1.3.2",
"grunt": "^1.5.2",
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^4.0.0",
"grunt-contrib-uglify": "^5.0.1",
"grunt-run": "^0.8.1",
Expand Down
4 changes: 2 additions & 2 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",

"npmVersion": "8.3.2",
"rushVersion": "5.61.3",
"npmVersion": "8.8.0",
"rushVersion": "5.67.0",
"projectFolderMaxDepth": 4,
"projects": [
{
Expand Down