Should Promise::CreateFromExisting assert the passed object is PromiseObject ?
Categories
(Core :: DOM: Core & HTML, enhancement)
Tracking
()
People
(Reporter: arai, Unassigned)
Details
DOMPromise's mPromiseObj comes from 2 places
- https://searchfox.org/mozilla-central/rev/f36cb2af46edd2659f446b7acdb2154e230ee445/dom/promise/Promise.cpp#280
- https://searchfox.org/mozilla-central/rev/f36cb2af46edd2659f446b7acdb2154e230ee445/dom/promise/Promise.cpp#482
The former is newly created one, so it's always PromiseObject.
The latter is from the caller, and it doesn't assert any about the type.
Some consumer of promiseObj() expects it to always be a PromiseObject
https://searchfox.org/mozilla-central/rev/f36cb2af46edd2659f446b7acdb2154e230ee445/xpcom/base/CycleCollectedJSContext.cpp#695-696
https://searchfox.org/mozilla-central/rev/f36cb2af46edd2659f446b7acdb2154e230ee445/xpcom/base/CycleCollectedJSContext.cpp#738-739
Some others calls JSAPI that accepts both PromiseObject and wrapper.
https://searchfox.org/mozilla-central/rev/f36cb2af46edd2659f446b7acdb2154e230ee445/dom/promise/Promise.cpp#304-305
If it should always be a PromiseObject, at least we should assert IsPromiseObject in Promise::CreateFromExisting.
Updated•3 years ago
|
Description
•