Bug 1576908 - uses fission model for sending purge history messages r=mconley,Gijs

Differential Revision: https://phabricator.services.mozilla.com/D45959

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tyler 2019-10-03 14:03:34 +00:00
parent bf14df5902
commit b354857779
3 changed files with 21 additions and 23 deletions

View File

@ -6,11 +6,7 @@
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;
@ -30,7 +26,7 @@ class PurgeSessionHistoryChild extends ActorChild {
}
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
}

View File

@ -1593,19 +1593,22 @@
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) {

View File

@ -275,6 +275,12 @@ let ACTORS = {
allFrames: true,
},
PurgeSessionHistory: {
child: {
moduleURI: "resource://gre/actors/PurgeSessionHistoryChild.jsm",
},
allFrames: true,
},
};
let LEGACY_ACTORS = {
@ -370,13 +376,6 @@ let LEGACY_ACTORS = {
},
},
PurgeSessionHistory: {
child: {
module: "resource://gre/actors/PurgeSessionHistoryChild.jsm",
messages: ["Browser:PurgeSessionHistory"],
},
},
SelectionSource: {
child: {
module: "resource://gre/actors/SelectionSourceChild.jsm",