archives

« Bugzilla Issues Index

#3378 — 25.4.1.6 NewPromiseCapability: Missing steps and parameters


25.4.1.6 NewPromiseCapability ( C )

- step 3: CreateFromConstructor requires two arguments, add empty List ().
- step 5: Change to "If promise is undefined, then let promise be AllocatePromise(C)."
This change is required for the "all.js" and "simple.js" tests in [1].

[1] https://github.com/domenic/promises-unwrapping/tree/master/reference-implementation/test


fixed step 3

Also changed CreateFromConstructor so it does an OrdinaryCreateFromConstructor if a [[CreateAction]] is not found. This means that NewPromiseCapability will create an ordinary object from the constructorif it is passed a non-native promise constructor.

That seems correct and consistent with the note. Doing an AllocatePromise does not seem correct as it would create an object with the internal slots of a built-in promise object when the constructor apparently doesn't derive from built-in Promise.

I'm not sure exactly what those tests are depending upon, but hopefully this fixes it.


The tests (and the reference implementation they test) are from a @@create era, FYI.


(In reply to Domenic Denicola from comment #2)
> The tests (and the reference implementation they test) are from a @@create
> era, FYI.

Ah, of course! Sorry for misleading everyone when I said AllocatePromise is necessary.

(In reply to Allen Wirfs-Brock from comment #1)
> I'm not sure exactly what those tests are depending upon, but hopefully this
> fixes it.

Yes, using OrdinaryCreateFromConstructor fixes it.


fixed in rev29