From 3b4a81565780b724841c2950513416f14ab95ff3 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 12 Apr 2018 23:26:44 -0400 Subject: Bug 1453339 - Make it harder to mess up Promise::All. r=peterv, a=RyanVM MozReview-Commit-ID: UO4wssYHj7 --- dom/promise/Promise.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'dom/promise/Promise.h') diff --git a/dom/promise/Promise.h b/dom/promise/Promise.h index f2ad3bd6c..642603a11 100644 --- a/dom/promise/Promise.h +++ b/dom/promise/Promise.h @@ -188,23 +188,26 @@ public: WrapObject(JSContext* aCx, JS::Handle aGivenProto, JS::MutableHandle aWrapper); - // Do the equivalent of Promise.resolve in the current compartment of aCx. - // Errorrs are reported on the ErrorResult; if aRv comes back !Failed(), this - // function MUST return a non-null value. + // Do the equivalent of Promise.resolve in the compartment of aGlobal. The + // compartment of aCx is ignored. Errors are reported on the ErrorResult; if + // aRv comes back !Failed(), this function MUST return a non-null value. static already_AddRefed Resolve(nsIGlobalObject* aGlobal, JSContext* aCx, JS::Handle aValue, ErrorResult& aRv); - // Do the equivalent of Promise.reject in the current compartment of aCx. - // Errorrs are reported on the ErrorResult; if aRv comes back !Failed(), this - // function MUST return a non-null value. + // Do the equivalent of Promise.reject in the compartment of aGlobal. The + // compartment of aCx is ignored. Errors are reported on the ErrorResult; if + // aRv comes back !Failed(), this function MUST return a non-null value. static already_AddRefed Reject(nsIGlobalObject* aGlobal, JSContext* aCx, JS::Handle aValue, ErrorResult& aRv); + // Do the equivalent of Promise.all in the current compartment of aCx. Errors + // are reported on the ErrorResult; if aRv comes back !Failed(), this function + // MUST return a non-null value. static already_AddRefed - All(const GlobalObject& aGlobal, - const nsTArray>& aPromiseList, ErrorResult& aRv); + All(JSContext* aCx, const nsTArray>& aPromiseList, + ErrorResult& aRv); void Then(JSContext* aCx, -- cgit v1.2.3