mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1181056 - waitUntil() should throw if called when event is not dispatching. r=smaug
--HG-- extra : commitid : 5Caz3xiFQQe extra : rebase_source : ef708cda07cbaf897ec3201e19defcf02d85e06f
This commit is contained in:
parent
fe51723b9e
commit
0756a03abe
@ -11,6 +11,7 @@
|
||||
Exposed=ServiceWorker]
|
||||
interface ExtendableEvent : Event {
|
||||
// https://github.com/slightlyoff/ServiceWorker/issues/261
|
||||
[Throws]
|
||||
void waitUntil(Promise<any> p);
|
||||
};
|
||||
|
||||
|
@ -395,10 +395,15 @@ ExtendableEvent::ExtendableEvent(EventTarget* aOwner)
|
||||
}
|
||||
|
||||
void
|
||||
ExtendableEvent::WaitUntil(Promise& aPromise)
|
||||
ExtendableEvent::WaitUntil(Promise& aPromise, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
if (EventPhase() == nsIDOMEvent::NONE) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Only first caller counts.
|
||||
if (EventPhase() == AT_TARGET && !mPromise) {
|
||||
mPromise = &aPromise;
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
WaitUntil(Promise& aPromise);
|
||||
WaitUntil(Promise& aPromise, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
GetPromise() const
|
||||
|
@ -1,5 +0,0 @@
|
||||
[extendable-event-async-waituntil.https.html]
|
||||
type: testharness
|
||||
[Calling waitUntil asynchronously throws an exception]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user