зеркало из https://github.com/mozilla/gecko-dev.git
Bug 959375 - Add Promise Resolve/Reject overloads accepting a window. r=baku
This commit is contained in:
Родитель
9cc26cbfd7
Коммит
e345f14d73
|
@ -410,10 +410,19 @@ Promise::Resolve(const GlobalObject& aGlobal, JSContext* aCx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<Promise> promise = new Promise(window);
|
return Resolve(window, aCx,
|
||||||
|
aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue,
|
||||||
|
aRv);
|
||||||
|
}
|
||||||
|
|
||||||
promise->MaybeResolveInternal(aCx,
|
/* static */ already_AddRefed<Promise>
|
||||||
aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue);
|
Promise::Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||||
|
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
// aWindow may be null.
|
||||||
|
nsRefPtr<Promise> promise = new Promise(aWindow);
|
||||||
|
|
||||||
|
promise->MaybeResolveInternal(aCx, aValue);
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,10 +439,19 @@ Promise::Reject(const GlobalObject& aGlobal, JSContext* aCx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<Promise> promise = new Promise(window);
|
return Reject(window, aCx,
|
||||||
|
aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue,
|
||||||
|
aRv);
|
||||||
|
}
|
||||||
|
|
||||||
promise->MaybeRejectInternal(aCx,
|
/* static */ already_AddRefed<Promise>
|
||||||
aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue);
|
Promise::Reject(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||||
|
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
// aWindow may be null.
|
||||||
|
nsRefPtr<Promise> promise = new Promise(aWindow);
|
||||||
|
|
||||||
|
promise->MaybeRejectInternal(aCx, aValue);
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,10 +70,18 @@ public:
|
||||||
Resolve(const GlobalObject& aGlobal, JSContext* aCx,
|
Resolve(const GlobalObject& aGlobal, JSContext* aCx,
|
||||||
const Optional<JS::Handle<JS::Value>>& aValue, ErrorResult& aRv);
|
const Optional<JS::Handle<JS::Value>>& aValue, ErrorResult& aRv);
|
||||||
|
|
||||||
|
static already_AddRefed<Promise>
|
||||||
|
Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||||
|
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
|
||||||
|
|
||||||
static already_AddRefed<Promise>
|
static already_AddRefed<Promise>
|
||||||
Reject(const GlobalObject& aGlobal, JSContext* aCx,
|
Reject(const GlobalObject& aGlobal, JSContext* aCx,
|
||||||
const Optional<JS::Handle<JS::Value>>& aValue, ErrorResult& aRv);
|
const Optional<JS::Handle<JS::Value>>& aValue, ErrorResult& aRv);
|
||||||
|
|
||||||
|
static already_AddRefed<Promise>
|
||||||
|
Reject(nsPIDOMWindow* aWindow, JSContext* aCx,
|
||||||
|
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<Promise>
|
already_AddRefed<Promise>
|
||||||
Then(const Optional<nsRefPtr<AnyCallback>>& aResolveCallback,
|
Then(const Optional<nsRefPtr<AnyCallback>>& aResolveCallback,
|
||||||
const Optional<nsRefPtr<AnyCallback>>& aRejectCallback);
|
const Optional<nsRefPtr<AnyCallback>>& aRejectCallback);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче