Backed out changeset 6e3c105cfcde (bug 1533943) for causing mochitest failures at mobile/android/components/extensions/test/mochitest/test_ext_webNavigation_onCommitted.html on a CLOSED TREE
authorDaniel Varga <dvarga@mozilla.com>
Thu, 14 Nov 2019 08:30:55 +0200
changeset 501894 646f38ad2746a55ee42a1d1002f922a69c5b91c5
parent 501893 34daa01d30f74e292f82b22ffc4fcb6c0b50aa0b
child 501895 a65aef85ad0df16d756283fb1975cdd90ea61843
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1533943
milestone72.0a1
backs out6e3c105cfcde3a6821120a83674f77692f5c7bf2
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
Backed out changeset 6e3c105cfcde (bug 1533943) for causing mochitest failures at mobile/android/components/extensions/test/mochitest/test_ext_webNavigation_onCommitted.html on a CLOSED TREE
devtools/client/responsive/browser/web-navigation.js
toolkit/actors/WebNavigationChild.jsm
toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm
toolkit/modules/ActorManagerParent.jsm
--- a/devtools/client/responsive/browser/web-navigation.js
+++ b/devtools/client/responsive/browser/web-navigation.js
@@ -9,30 +9,34 @@ const ChromeUtils = require("ChromeUtils
 const Services = require("Services");
 
 /**
  * This object aims to provide the nsIWebNavigation interface for mozbrowser elements.
  * nsIWebNavigation is one of the interfaces expected on <xul:browser>s, so this wrapper
  * helps mozbrowser elements support this.
  *
  * It attempts to use the mozbrowser API wherever possible, however some methods don't
- * exist yet, so we fallback to the WebNavigation actor in those cases.
+ * exist yet, so we fallback to the WebNavigation frame script messages in those cases.
  * Ideally the mozbrowser API would eventually be extended to cover all properties and
  * methods used here.
  *
- * This is largely copied from RemoteWebNavigation.js, which uses the WebNavigation
- * actor to perform all actions.
+ * This is largely copied from RemoteWebNavigation.js, which uses the message manager to
+ * perform all actions.
  */
 function BrowserElementWebNavigation(browser) {
   this._browser = browser;
 }
 
 BrowserElementWebNavigation.prototype = {
   QueryInterface: ChromeUtils.generateQI([Ci.nsIWebNavigation]),
 
+  get _mm() {
+    return this._browser.frameLoader.messageManager;
+  },
+
   canGoBack: false,
   canGoForward: false,
 
   goBack() {
     this._browser.goBack();
   },
 
   goForward() {
@@ -69,17 +73,17 @@ BrowserElementWebNavigation.prototype = 
     triggeringPrincipal
   ) {
     // No equivalent in the current BrowserElement API
     const referrerInfo = Cc["@mozilla.org/referrer-info;1"].createInstance(
       Ci.nsIReferrerInfo
     );
     referrerInfo.init(referrerPolicy, true, referrer);
 
-    this._browser.browsingContext.loadURI(uri, {
+    this._browser.frameLoader.browsingContext.loadURI(uri, {
       loadFlags: flags,
       referrerInfo,
       postData,
       headers,
       baseURI,
       triggeringPrincipal,
     });
   },
@@ -130,25 +134,17 @@ BrowserElementWebNavigation.prototype = 
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
   set sessionHistory(value) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   _sendMessage(message, data) {
     try {
-      if (this._browser.frameLoader) {
-        const windowGlobal = this._browser.browsingContext
-          .currentWindowGlobal;
-        if (windowGlobal) {
-          windowGlobal
-            .getActor("WebNavigation")
-            .sendAsyncMessage(message, data);
-        }
-      }
+      this._mm.sendAsyncMessage(message, data);
     } catch (e) {
       Cu.reportError(e);
     }
   },
 
   swapBrowser(browser) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
--- a/toolkit/actors/WebNavigationChild.jsm
+++ b/toolkit/actors/WebNavigationChild.jsm
@@ -1,19 +1,23 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 var EXPORTED_SYMBOLS = ["WebNavigationChild"];
 
-class WebNavigationChild extends JSWindowActorChild {
+const { ActorChild } = ChromeUtils.import(
+  "resource://gre/modules/ActorChild.jsm"
+);
+
+class WebNavigationChild extends ActorChild {
   get webNavigation() {
-    return this.docShell.QueryInterface(Ci.nsIWebNavigation);
+    return this.mm.docShell.QueryInterface(Ci.nsIWebNavigation);
   }
 
   receiveMessage(message) {
     switch (message.name) {
       case "WebNavigation:GoBack":
         this.goBack(message.data);
         break;
       case "WebNavigation:GoForward":
@@ -33,54 +37,52 @@ class WebNavigationChild extends JSWindo
         break;
     }
   }
 
   _wrapURIChangeCall(fn) {
     try {
       fn();
     } finally {
-      this.docShell
+      this.mm.docShell
         .QueryInterface(Ci.nsIInterfaceRequestor)
         .getInterface(Ci.nsIBrowserChild)
         .notifyNavigationFinished();
     }
   }
 
   goBack(params) {
-    let wn = this.webNavigation;
-    if (wn.canGoBack) {
-      this.docShell.setCancelContentJSEpoch(params.cancelContentJSEpoch);
-      this._wrapURIChangeCall(() => wn.goBack());
+    if (this.webNavigation.canGoBack) {
+      this.mm.docShell.setCancelContentJSEpoch(params.cancelContentJSEpoch);
+      this._wrapURIChangeCall(() => this.webNavigation.goBack());
     }
   }
 
   goForward(params) {
-    let wn = this.webNavigation;
-    if (wn.canGoForward) {
-      this.docShell.setCancelContentJSEpoch(params.cancelContentJSEpoch);
-      this._wrapURIChangeCall(() => wn.goForward());
+    if (this.webNavigation.canGoForward) {
+      this.mm.docShell.setCancelContentJSEpoch(params.cancelContentJSEpoch);
+      this._wrapURIChangeCall(() => this.webNavigation.goForward());
     }
   }
 
   gotoIndex(params) {
     let { index, cancelContentJSEpoch } = params || {};
-    this.docShell.setCancelContentJSEpoch(cancelContentJSEpoch);
+    this.mm.docShell.setCancelContentJSEpoch(cancelContentJSEpoch);
     this._wrapURIChangeCall(() => this.webNavigation.gotoIndex(index));
   }
 
   _assert(condition, msg, line = 0) {
     let debug = Cc["@mozilla.org/xpcom/debug;1"].getService(Ci.nsIDebug2);
     if (!condition && debug.isDebugBuild) {
       debug.warning(
         `${msg} - ${new Error().stack}`,
         "WebNavigationChild.js",
         line
       );
-      debug.abort("WebNavigationChild.jsm", line);
+      debug.abort("WebNavigationChild.js", line);
     }
   }
 
   setOriginAttributes(originAttributes) {
     if (originAttributes) {
       this.webNavigation.setOriginAttributesBeforeLoading(originAttributes);
     }
   }
--- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm
+++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm
@@ -150,16 +150,16 @@ RemoteWebNavigation.prototype = {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
   set sessionHistory(aValue) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   _sendMessage(aMessage, aData) {
     try {
-      this._browser.sendMessageToActor(aMessage, aData, "WebNavigation");
+      this._browser.messageManager.sendAsyncMessage(aMessage, aData);
     } catch (e) {
       Cu.reportError(e);
     }
   },
 };
 
 var EXPORTED_SYMBOLS = ["RemoteWebNavigation"];
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -231,23 +231,16 @@ let ACTORS = {
         UAWidgetSetupOrChange: {},
         contextmenu: { capture: true },
       },
     },
 
     allFrames: true,
   },
 
-  PurgeSessionHistory: {
-    child: {
-      moduleURI: "resource://gre/actors/PurgeSessionHistoryChild.jsm",
-    },
-    allFrames: true,
-  },
-
   Select: {
     parent: {
       moduleURI: "resource://gre/actors/SelectParent.jsm",
     },
 
     child: {
       moduleURI: "resource://gre/actors/SelectChild.jsm",
       events: {
@@ -275,49 +268,49 @@ let ACTORS = {
   },
 
   Thumbnails: {
     child: {
       moduleURI: "resource://gre/actors/ThumbnailsChild.jsm",
     },
   },
 
-  UAWidgets: {
-    child: {
-      moduleURI: "resource://gre/actors/UAWidgetsChild.jsm",
-      events: {
-        UAWidgetSetupOrChange: {},
-        UAWidgetTeardown: {},
-      },
-    },
-
-    allFrames: true,
-  },
-
-  WebNavigation: {
-    child: {
-      moduleURI: "resource://gre/actors/WebNavigationChild.jsm",
-    },
-  },
-
   Zoom: {
     parent: {
       moduleURI: "resource://gre/actors/ZoomParent.jsm",
     },
     child: {
       moduleURI: "resource://gre/actors/ZoomChild.jsm",
       events: {
         FullZoomChange: {},
         TextZoomChange: {},
         ZoomChangeUsingMouseWheel: {},
       },
     },
 
     allFrames: true,
   },
+
+  UAWidgets: {
+    child: {
+      moduleURI: "resource://gre/actors/UAWidgetsChild.jsm",
+      events: {
+        UAWidgetSetupOrChange: {},
+        UAWidgetTeardown: {},
+      },
+    },
+
+    allFrames: true,
+  },
+  PurgeSessionHistory: {
+    child: {
+      moduleURI: "resource://gre/actors/PurgeSessionHistoryChild.jsm",
+    },
+    allFrames: true,
+  },
 };
 
 /*
  * The following code implements logic for managing JavaScript actor instances
  * bound to message managers. It handles lazily instantiating those actors based
  * on DOM events, IPC messages, or observer notifications, and is meant to
  * entirely replace the existing concept of frame scripts.
  *
@@ -461,16 +454,30 @@ let LEGACY_ACTORS = {
       module: "resource://gre/actors/UnselectedTabHoverChild.jsm",
       events: {
         "UnselectedTabHover:Enable": {},
         "UnselectedTabHover:Disable": {},
       },
       messages: ["Browser:UnselectedTabHover"],
     },
   },
+
+  WebNavigation: {
+    child: {
+      module: "resource://gre/actors/WebNavigationChild.jsm",
+      messages: [
+        "WebNavigation:GoBack",
+        "WebNavigation:GoForward",
+        "WebNavigation:GotoIndex",
+        "WebNavigation:Reload",
+        "WebNavigation:SetOriginAttributes",
+        "WebNavigation:Stop",
+      ],
+    },
+  },
 };
 
 class ActorSet {
   constructor(group, actorSide) {
     this.group = group;
     this.actorSide = actorSide;
 
     this.actors = new Map();