You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a safeResolvePromise host-defined function to allow testing the proposal (which otherwise has no user access in its current shape)
Synchronous Resolve
Primitive values resolve synchronously
Object with no then property resolve synchronously
Object with un-callable then resolve synchronously.
Object with un-callable then on prototype resolves synchronously
Object with then setter, but no getter, resolve synchronously
Object with then setter, but no getter, on the prototype. resolves synchronously.
Object with own-property then which is not callable shadows a callable then, resolves synchronously.
Deferred Resolve & Execution of User Code
Resolving with a Proxy (even with empty traps) resolves deferred.
Resolving with a Proxy with a get trap is resolved.
The get trap runs in deferral.
Resolving an object which has a proxy on its prototype chain is deferred.
Resolving with a module namespace object is deferred
Object with callable then own-property is deferred
The then call is made, deferred.
Object with callable then prototype is deferred
The then call is made deferred
A deferred then throwing should cause the promise to be rejected.
Object with then getter
The then getter is run, deferred.
Object with then getter on prototype.
The then getter is run, deferred.
then getter which throws rejects promise, but deferred
Resolving with a revoked proxy rejects deferred
Callable Object.prototype.then causes object resolution to be deferred
unless the object has a null prototype.
Ensure deferred then call has correct this binding.
Tick count of safe resolving a promise with another native promise (resolved, unresolved).
Delete the callable then after a safeResolve job is enqueued but before it's processed.
Ensure the Get of then is run twice when
Latching behaviour
Attempting to resolve a deferred promise of any sort cannot overwrite or otherwise interfere with the deferred promise
Late rejection also fails.
Repeated safe resolution: Latched by first and second is no-op.
Attempting to safe resolve an already resolved promise is a no-op.
Edge Cases
(If possible) test HostObjectHasImpureLookupInternalMethods.
Self-resolve: (note: Spec currently will defer depending on the inspection of current promise.. but I actually think maybe we should change the spec to synchronously throw here?)
Testing Plan for https://tc39.es/proposal-thenable-curtailment/
Setup:
safeResolvePromisehost-defined function to allow testing the proposal (which otherwise has no user access in its current shape)Synchronous Resolve
thenproperty resolve synchronouslythenresolve synchronously.thenon prototype resolves synchronouslythensetter, but no getter, resolve synchronouslythensetter, but no getter, on the prototype. resolves synchronously.Deferred Resolve & Execution of User Code
Proxy(even with empty traps) resolves deferred.gettrap is resolved.thenown-property is deferredthencall is made, deferred.thenprototype is deferredthenthrowing should cause the promise to be rejected.thengetterthengetter on prototype.thengetter which throws rejects promise, but deferredthencall has correct this binding.thenafter a safeResolve job is enqueued but before it's processed.Getofthenis run twice whenLatching behaviour
Edge Cases