Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixed type confusion bug while resolving promises.
Previously, the internal function njs_promise_perform_then() which implements PerformPromiseThen() expects its first argument to always be a promise instance. This assertion might be invalid because the functions corresponding to Promise.prototype.then() and Promise.resolve() incorrectly verified their arguments. Specifically, the functions recognized their first argument as promise if it was an object which was an Promise or had Promise object in its prototype chain. The later condition is not correct because internal slots are not inherited according to the spec. This closes #447 issue in Github.
- Loading branch information
Showing
4 changed files
with
34 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /*--- | ||
| includes: [] | ||
| flags: [async] | ||
| ---*/ | ||
|
|
||
| Symbol.__proto__ = new Promise(()=>{}); | ||
|
|
||
| Promise.reject(Symbol) | ||
| .then(v => $DONOTEVALUATE()) | ||
| .catch(err => assert.sameValue(err.name, 'Symbol')) | ||
| .then($DONE, $DONE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /*--- | ||
| includes: [] | ||
| flags: [async] | ||
| ---*/ | ||
|
|
||
| Symbol.__proto__ = new Promise(()=>{}); | ||
|
|
||
| Promise.resolve(Symbol) | ||
| .then(v => $DONOTEVALUATE()) | ||
| .catch(err => assert.sameValue(err.name, 'TypeError')) | ||
| .then($DONE, $DONE); |