Bug 1179401 - Call stopImmediatePropagation() on the Event object in respondWith(); r=jdm, a=lizzard
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 29 Sep 2015 22:53:53 -0400
changeset 296320 1501dc3ad3c354ac5e1291ddc35d50d8285a84da
parent 296319 8b99dcd48e694665bfab228e7afd284a272f49fa
child 296321 f17a4df0e8172720d053418e6d064348b3da3fa4
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, lizzard
bugs1179401
milestone43.0a2
Bug 1179401 - Call stopImmediatePropagation() on the Event object in respondWith(); r=jdm, a=lizzard
dom/workers/ServiceWorkerEvents.cpp
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -404,16 +404,17 @@ void
 FetchEvent::RespondWith(Promise& aArg, ErrorResult& aRv)
 {
   if (mWaitToRespond) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
   nsRefPtr<InternalRequest> ir = mRequest->GetInternalRequest();
+  StopImmediatePropagation();
   mWaitToRespond = true;
   nsRefPtr<RespondWithHandler> handler =
     new RespondWithHandler(mChannel, mServiceWorker, mRequest->Mode(),
                            ir->IsClientRequest(), ir->IsNavigationRequest());
   aArg.AppendNativeHandler(handler);
 }
 
 already_AddRefed<ServiceWorkerClient>
deleted file mode 100644
--- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[fetch-event-respond-with-stops-propagation.https.html]
-  type: testharness
-  disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1194881
-  [respondWith() invokes stopImmediatePropagation()]
-    expected: FAIL
-
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-event-respond-with-stops-propagation.https.html
@@ -18,18 +18,18 @@ promise_test(function(t) {
         })
       .then(function(frame) {
           var channel = new MessageChannel();
           var saw_message = new Promise(function(resolve) {
               channel.port1.onmessage = function(e) { resolve(e.data); }
             });
           var worker = frame.contentWindow.navigator.serviceWorker.controller;
 
+          worker.postMessage({port: channel.port2}, [channel.port2]);
           frame.remove();
-          worker.postMessage({port: channel.port2}, [channel.port2]);
           return saw_message;
         })
       .then(function(message) {
           assert_equals(message, 'PASS');
           return service_worker_unregister_and_done(t, scope);
         })
   }, 'respondWith() invokes stopImmediatePropagation()');
 </script>