mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
Bug 1267096 - Return early if we have no global when creating a Promise. r=smaug
MozReview-Commit-ID: LQeFGaRRAVq --HG-- extra : rebase_source : 679009e7b26ddffe64fb2c746a187f63c7448e11
This commit is contained in:
parent
1301f09dd3
commit
0b33e8847a
@ -525,6 +525,10 @@ Promise::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
|
||||
already_AddRefed<Promise>
|
||||
Promise::Create(nsIGlobalObject* aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
if (!aGlobal) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<Promise> p = new Promise(aGlobal);
|
||||
p->CreateWrapper(nullptr, aRv);
|
||||
if (aRv.Failed()) {
|
||||
@ -859,6 +863,10 @@ already_AddRefed<Promise>
|
||||
Promise::Create(nsIGlobalObject* aGlobal, ErrorResult& aRv,
|
||||
JS::Handle<JSObject*> aDesiredProto)
|
||||
{
|
||||
if (!aGlobal) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<Promise> p = new Promise(aGlobal);
|
||||
p->CreateWrapper(aDesiredProto, aRv);
|
||||
if (aRv.Failed()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user