Bug 1523454 - Fix service worker active status for sw refactor;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 13 Feb 2019 09:02:03 +0000
changeset 458875 1d79453b1f68b2bb8ed17a342cef231e8d5ce037
parent 458874 0dca936d2e9efcdbbe6ef62391616f755598682c
child 458876 1a88323932cbbd7af5e37ccfd5c5e7ab34393f0a
push id78074
push userjdescottes@mozilla.com
push dateWed, 13 Feb 2019 09:02:59 +0000
treeherderautoland@1a88323932cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1523454
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523454 - Fix service worker active status for sw refactor;r=daisuke Depends on D19159 This will fix the test browser_aboutdebugging_serviceworker_status.js when running with dom.serviceWorkers.parent_intercept=true (`./mach test browser_aboutdebugging_serviceworker_status.js --setpref dom.serviceWorkers.parent_intercept=true`) Differential Revision: https://phabricator.services.mozilla.com/D18365
devtools/client/aboutdebugging-new/test/browser/resources/service-workers/controlled-sw.html
devtools/server/actors/worker/service-worker-registration.js
--- a/devtools/client/aboutdebugging-new/test/browser/resources/service-workers/controlled-sw.html
+++ b/devtools/client/aboutdebugging-new/test/browser/resources/service-workers/controlled-sw.html
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <meta charset="UTF-8">
-  <title>Service worker push test</title>
+  <title>Service worker controlled</title>
 </head>
 <body>
 <script type="text/javascript">
 
 "use strict";
 
 let registration;
 
--- a/devtools/server/actors/worker/service-worker-registration.js
+++ b/devtools/server/actors/worker/service-worker-registration.js
@@ -60,29 +60,30 @@ protocol.ActorClassWithSpec(serviceWorke
   form() {
     const registration = this._registration;
     const installingWorker = this._installingWorker.form();
     const waitingWorker = this._waitingWorker.form();
     const activeWorker = this._activeWorker.form();
 
     const newestWorker = (activeWorker || waitingWorker || installingWorker);
 
-    const isE10s = Services.appinfo.browserTabsRemoteAutostart;
+    const isNewE10sImplementation = swm.isParentInterceptEnabled();
+    const isMultiE10sWithOldImplementation =
+      Services.appinfo.browserTabsRemoteAutostart && !isNewE10sImplementation;
     return {
       actor: this.actorID,
       scope: registration.scope,
       url: registration.scriptSpec,
       installingWorker,
       waitingWorker,
       activeWorker,
       fetch: newestWorker && newestWorker.fetch,
-      // - In e10s: only active registrations are available.
-      // - In non-e10s: registrations always have at least one worker, if the worker is
-      // active, the registration is active.
-      active: isE10s ? true : !!activeWorker,
+      // - In old multi e10s: only active registrations are available.
+      // - In non-e10s or new implementaion: check if we have an active worker
+      active: isMultiE10sWithOldImplementation ? true : !!activeWorker,
       lastUpdateTime: registration.lastUpdateTime,
     };
   },
 
   destroy() {
     protocol.Actor.prototype.destroy.call(this);
     Services.obs.removeObserver(this, PushService.subscriptionModifiedTopic);
     this._registration.removeListener(this);