diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp index 9c4638650e85..b4eb020cfdb0 100644 --- a/dom/workers/ServiceWorkerEvents.cpp +++ b/dom/workers/ServiceWorkerEvents.cpp @@ -412,7 +412,7 @@ RespondWithHandler::CancelRequest(nsresult aStatus) void FetchEvent::RespondWith(Promise& aArg, ErrorResult& aRv) { - if (mWaitToRespond) { + if (EventPhase() == nsIDOMEvent::NONE || mWaitToRespond) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } diff --git a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini deleted file mode 100644 index 32689d1a489a..000000000000 --- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[fetch-event-async-respond-with.https.html] - type: testharness - [Calling respondWith asynchronously throws an exception] - expected: FAIL - diff --git a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-async-respond-with.https.html b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-async-respond-with.https.html index 5c908b3d94fd..912e709ca38f 100644 --- a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-async-respond-with.https.html +++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-async-respond-with.https.html @@ -22,8 +22,8 @@ promise_test(function(t) { }); var worker = frame.contentWindow.navigator.serviceWorker.controller; - frame.remove(); worker.postMessage({port: channel.port2}, [channel.port2]); + frame.remove(); return saw_message; }) .then(function(message) {