Bug 1576908 - uses fission model for sending purge history messages r=mconley,Gijs
authorTyler <staatsty@msu.edu>
Thu, 03 Oct 2019 14:03:34 +0000
changeset 496194 ff09f16f5b3d5310a96675f53671b622a5aa1e5e
parent 496193 eb3f06b807587f023efa7d9e919df5b72c71a156
child 496195 c3082c1a8f7b97248aa9b5161e22a987b7c66a10
push id97089
push usergijskruitbosch@gmail.com
push dateThu, 03 Oct 2019 14:52:21 +0000
treeherderautoland@ff09f16f5b3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, Gijs
bugs1576908
milestone71.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 1576908 - uses fission model for sending purge history messages r=mconley,Gijs Differential Revision: https://phabricator.services.mozilla.com/D45959
toolkit/actors/PurgeSessionHistoryChild.jsm
toolkit/content/widgets/browser-custom-element.js
toolkit/modules/ActorManagerParent.jsm
--- a/toolkit/actors/PurgeSessionHistoryChild.jsm
+++ b/toolkit/actors/PurgeSessionHistoryChild.jsm
@@ -1,21 +1,17 @@
 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
 /* 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 = ["PurgeSessionHistoryChild"];
 
-const { ActorChild } = ChromeUtils.import(
-  "resource://gre/modules/ActorChild.jsm"
-);
-
-class PurgeSessionHistoryChild extends ActorChild {
+class PurgeSessionHistoryChild extends JSWindowActorChild {
   receiveMessage(message) {
     if (message.name != "Browser:PurgeSessionHistory") {
       return;
     }
     let sessionHistory = this.docShell.QueryInterface(Ci.nsIWebNavigation)
       .sessionHistory;
     if (!sessionHistory) {
       return;
@@ -25,17 +21,17 @@ class PurgeSessionHistoryChild extends A
     if (sessionHistory.index < sessionHistory.count - 1) {
       let legacy = sessionHistory.legacySHistory;
       let indexEntry = legacy.getEntryAtIndex(sessionHistory.index);
       indexEntry.QueryInterface(Ci.nsISHEntry);
       legacy.addEntry(indexEntry, true);
     }
 
     let purge = sessionHistory.count;
-    if (this.content.location.href != "about:blank") {
+    if (this.document.location.href != "about:blank") {
       --purge; // Don't remove the page the user's staring at from shistory
     }
 
     if (purge > 0) {
       sessionHistory.legacySHistory.PurgeHistory(purge);
     }
   }
 }
--- a/toolkit/content/widgets/browser-custom-element.js
+++ b/toolkit/content/widgets/browser-custom-element.js
@@ -1588,29 +1588,32 @@
         this._contentRequestContextID = aHaveRequestContextID
           ? aRequestContextID
           : null;
       }
     }
 
     purgeSessionHistory() {
       if (this.isRemoteBrowser) {
-        try {
-          this.messageManager.sendAsyncMessage("Browser:PurgeSessionHistory");
-        } catch (ex) {
-          // This can throw if the browser has started to go away.
-          if (ex.result != Cr.NS_ERROR_NOT_INITIALIZED) {
-            throw ex;
-          }
-        }
         this._remoteWebNavigationImpl.canGoBack = false;
         this._remoteWebNavigationImpl.canGoForward = false;
-        return;
       }
-      this.messageManager.sendAsyncMessage("Browser:PurgeSessionHistory");
+      try {
+        this.sendMessageToActor(
+          "Browser:PurgeSessionHistory",
+          {},
+          "PurgeSessionHistory",
+          true
+        );
+      } catch (ex) {
+        // This can throw if the browser has started to go away.
+        if (ex.result != Cr.NS_ERROR_NOT_INITIALIZED) {
+          throw ex;
+        }
+      }
     }
 
     createAboutBlankContentViewer(aPrincipal, aStoragePrincipal) {
       if (this.isRemoteBrowser) {
         // Ensure that the content process has the permissions which are
         // needed to create a document with the given principal.
         let permissionPrincipal = BrowserUtils.principalWithMatchingOA(
           aPrincipal,
--- a/toolkit/modules/ActorManagerParent.jsm
+++ b/toolkit/modules/ActorManagerParent.jsm
@@ -270,16 +270,22 @@ let ACTORS = {
       events: {
         UAWidgetSetupOrChange: {},
         UAWidgetTeardown: {},
       },
     },
 
     allFrames: true,
   },
+  PurgeSessionHistory: {
+    child: {
+      moduleURI: "resource://gre/actors/PurgeSessionHistoryChild.jsm",
+    },
+    allFrames: true,
+  },
 };
 
 let LEGACY_ACTORS = {
   Controllers: {
     child: {
       module: "resource://gre/actors/ControllersChild.jsm",
       messages: ["ControllerCommands:Do", "ControllerCommands:DoWithParams"],
     },
@@ -365,23 +371,16 @@ let LEGACY_ACTORS = {
         "Printing:Preview:Exit",
         "Printing:Preview:Navigate",
         "Printing:Preview:ParseDocument",
         "Printing:Print",
       ],
     },
   },
 
-  PurgeSessionHistory: {
-    child: {
-      module: "resource://gre/actors/PurgeSessionHistoryChild.jsm",
-      messages: ["Browser:PurgeSessionHistory"],
-    },
-  },
-
   SelectionSource: {
     child: {
       module: "resource://gre/actors/SelectionSourceChild.jsm",
       messages: ["ViewSource:GetSelection"],
     },
   },
 
   Thumbnails: {