• Francis McCabe's avatar
    Revert "Use context of then function for PromiseResolveThenableJob" · 7558e182
    Francis McCabe authored
    This reverts commit 93253978.
    
    Reason for revert: Causing blink layout failures. See 
    
    https://ci.chromium.org/p/v8/builders/ci/V8%20Blink%20Linux%20Future/2684
    
    Original change's description:
    > Use context of then function for PromiseResolveThenableJob
    > 
    > When a microtask is executed, we need to use an appropriate,
    > non-detached Context for its execution. Currently with
    > PromiseResolveThenableJobs [1], the Context used is always drawn from
    > the realm of the Promise constructor being used. This may cause
    > non-intuitive behavior, such as in the following case:
    > 
    >   const DeadPromise = iframe.contentWindow.Promise;
    >   const p = DeadPromise.resolve({
    >     then() {
    >       return { success: true };
    >     }
    >   });
    >   p.then(result => { console.log(result); });
    > 
    >   // Some time later, but synchronously...
    >   iframe.src = "http://example.com"; // navigate away.
    >   // DeadPromise's Context is detached state now.
    >   // p never gets resolved, and its reaction handler never gets called.
    > 
    > To fix this behavior, when PromiseResolveThenableJob is being queued up,
    > the `then` method of the thenable should be used to determine the
    > context of the resultant microtask. Doing so aligns with Firefox, and
    > also with the latest HTML spec [2][3].
    > 
    > This change is analogous to CL 1465902, which uses the realm of the
    > reaction handlers to determine the Context PromiseReactionJobs run in.
    > 
    > [1]: https://tc39.es/ecma262/#sec-promiseresolvethenablejob
    > [2]: https://html.spec.whatwg.org/C/#enqueuejob(queuename,-job,-arguments)
    > [3]: https://github.com/whatwg/html/pull/5212
    > 
    > Bug: v8:10200
    > Change-Id: I2312788eeea0f9e870c13cf3cb5730a87d15609e
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071624
    > Commit-Queue: Timothy Gu <timothygu@chromium.org>
    > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    > Reviewed-by: Shu-yu Guo <syg@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#66507}
    
    TBR=verwaest@chromium.org,timothygu@chromium.org,syg@chromium.org
    
    Change-Id: I81737750f8b369567ba586c5a2cfb489836b7e74
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Bug: v8:10200
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2081091Reviewed-by: 's avatarFrancis McCabe <fgm@chromium.org>
    Commit-Queue: Francis McCabe <fgm@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#66510}
    7558e182
Name
Last commit
Last update
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base Loading commit data...
builtins Loading commit data...
codegen Loading commit data...
common Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
d8 Loading commit data...
date Loading commit data...
debug Loading commit data...
deoptimizer Loading commit data...
diagnostics Loading commit data...
execution Loading commit data...
extensions Loading commit data...
flags Loading commit data...
handles Loading commit data...
heap Loading commit data...
ic Loading commit data...
init Loading commit data...
inspector Loading commit data...
interpreter Loading commit data...
json Loading commit data...
libplatform Loading commit data...
libsampler Loading commit data...
logging Loading commit data...
numbers Loading commit data...
objects Loading commit data...
parsing Loading commit data...
profiler Loading commit data...
protobuf Loading commit data...
regexp Loading commit data...
roots Loading commit data...
runtime Loading commit data...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks Loading commit data...
third_party Loading commit data...
torque Loading commit data...
tracing Loading commit data...
trap-handler Loading commit data...
utils Loading commit data...
wasm Loading commit data...
zone Loading commit data...
DEPS Loading commit data...
OWNERS Loading commit data...