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 458862 1d79453b1f68
parent 458861 0dca936d2e9e
child 458863 1a88323932cb
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [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);