Repository navigation
Commit b45f244
committed
[JSC] DFG should not fold ResolvePromiseFirstResolving into a fulfill when the value can be the promise
https://bugs.webkit.org/show_bug.cgi?id=328330
rdar://190624765
Reviewed by Marcus Plutowski and Keith Miller.
Even if the object is not having `then` method, if it is Promise, then
resolving a promise with itself will throw an error.
let resolve;
let p = new Promise((r) => { resolve = r; });
Object.setPrototypeOf(p, null);
resolve(p); // p is fulfilled in DFG and FTL, should be rejected with a TypeError
Thus, DFG ResolvePromiseFirstResolving should not accept a promise object.
Test: JSTests/stress/promise-resolved-with-itself-rejects-in-jit.js
* JSTests/stress/promise-resolved-with-itself-rejects-in-jit.js: Added.
(resolveWithItself):
* Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
Canonical link: https://commits.webkit.org/324393@main1 parent 84363fa commit b45f244
2 files changed
Lines changed: 25 additions & 2 deletions
File tree
- JSTests/stress
- Source/JavaScriptCore/dfg
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2025 | 2025 | | |
2026 | 2026 | | |
2027 | 2027 | | |
2028 | | - | |
| 2028 | + | |
| 2029 | + | |
2029 | 2030 | | |
2030 | | - | |
| 2031 | + | |
2031 | 2032 | | |
2032 | 2033 | | |
2033 | 2034 | | |
| |||
0 commit comments