Commit 7014578c authored by Julian Descottes's avatar Julian Descottes
Browse files

Bug 1619221 - Remove non-parent-intercept codepath in devtools client r=daisuke

Depends on D81346

Differential Revision: https://phabricator.services.mozilla.com/D82193
parent e897d9ed
Loading
Loading
Loading
Loading
+5 −18
Original line number Diff line number Diff line
@@ -143,24 +143,11 @@ function installTemporaryExtension() {
function pushServiceWorker(id, registrationFront) {
  return async (_, getState) => {
    try {
      /**
       * Older servers will not define `ServiceWorkerRegistrationFront.push`,
       * and `ServiceWorkerRegistrationFront.push` will only work if the
       * underlying ServiceWorkerRegistration is "connected" to the
       * corresponding running Service Worker - this is only guaranteed with
       * parent-intercept mode. The `else` statement is for backward
       * compatibility and can be removed when the release channel is >= FF69
       * _and_ parent-intercept is stable (which definitely won't happen when
       * the release channel is < FF69).
       */
      const { isParentInterceptEnabled } = registrationFront.traits;
      if (registrationFront.push && isParentInterceptEnabled) {
      // The push button is only available if canDebugServiceWorkers is true,
      // which is only true if dom.serviceWorkers.parent_intercept is true.
      // With this configuration, `push` should always be called on the
      // registration front, and not on the (service) WorkerTargetActor.
      await registrationFront.push();
      } else {
        const clientWrapper = getCurrentClient(getState().runtimes);
        const workerActor = await clientWrapper.getServiceWorkerFront({ id });
        await workerActor.push();
      }
    } catch (e) {
      console.error(e);
    }
+1 −7
Original line number Diff line number Diff line
@@ -66,13 +66,7 @@ class WorkerTargetFront extends TargetMixin(
    this._attach = (async () => {
      const response = await super.attach();

      if (this.isServiceWorker && this.getTrait("isParentInterceptEnabled")) {
        // In parentIntercept mode, the worker target actor cannot call the APIs needed
        // to prevent the worker from shutting down. Instead call attachDebugger on the
        // registration because the ServiceWorkerRegistration actor lives in the parent
        // process.
        // TODO: Cleanup after Bug 1496997 lands (no need to check
        // isParentInterceptEnabled trait)
      if (this.isServiceWorker) {
        this.registration = await this._getRegistrationIfActive();
        if (this.registration) {
          await this.registration.preventShutdown();
+1 −3
Original line number Diff line number Diff line
@@ -49,9 +49,7 @@ const WorkerTargetActor = protocol.ActorClassWithSpec(workerTargetSpec, {
      threadActor: this._threadActor,
      id: this._dbg.id,
      url: this._dbg.url,
      traits: {
        isParentInterceptEnabled: swm.isParentInterceptEnabled(),
      },
      traits: {},
      type: this._dbg.type,
    };
    if (this._dbg.type === Ci.nsIWorkerDebugger.TYPE_SERVICE) {
+2 −5
Original line number Diff line number Diff line
@@ -79,10 +79,9 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
      const newestWorker =
        activeWorker || waitingWorker || installingWorker || evaluatingWorker;

      const isParentInterceptEnabled = swm.isParentInterceptEnabled();
      const isMultiE10sWithOldImplementation =
        Services.appinfo.browserTabsRemoteAutostart &&
        !isParentInterceptEnabled;
        !swm.isParentInterceptEnabled();
      return {
        actor: this.actorID,
        scope: registration.scope,
@@ -96,9 +95,7 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
        // - In non-e10s or new implementaion: check if we have an active worker
        active: isMultiE10sWithOldImplementation ? true : !!activeWorker,
        lastUpdateTime: registration.lastUpdateTime,
        traits: {
          isParentInterceptEnabled,
        },
        traits: {},
      };
    },