Bug 1233803 - Outlaw usage of sessionHistory CPOW in browser code. r?felipe
--- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.js
+++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.js
@@ -30,23 +30,17 @@ function RemoteWebNavigation()
RemoteWebNavigation.prototype = {
classDescription: "nsIWebNavigation for remote browsers",
classID: Components.ID("{4b56964e-cdf3-4bb8-830c-0e2dad3f4ebd}"),
contractID: "@mozilla.org/remote-web-navigation;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebNavigation, Ci.nsISupports]),
swapBrowser: function(aBrowser) {
- if (this._messageManager) {
- this._messageManager.removeMessageListener("WebNavigation:setHistory", this);
- }
-
this._browser = aBrowser;
- this._messageManager = aBrowser.messageManager;
- this._messageManager.addMessageListener("WebNavigation:setHistory", this);
},
LOAD_FLAGS_MASK: 65535,
LOAD_FLAGS_NONE: 0,
LOAD_FLAGS_IS_REFRESH: 16,
LOAD_FLAGS_IS_LINK: 32,
LOAD_FLAGS_BYPASS_HISTORY: 64,
LOAD_FLAGS_REPLACE_HISTORY: 128,
@@ -113,31 +107,28 @@ RemoteWebNavigation.prototype = {
return this._currentURI;
},
set currentURI(aURI) {
this.loadURI(aURI.spec, null, null, null);
},
referringURI: null,
- _sessionHistory: null,
- get sessionHistory() { return this._sessionHistory; },
- set sessionHistory(aValue) { },
+ // Bug 1233803 - accessing the sessionHistory of remote browsers should be
+ // done in content scripts.
+ get sessionHistory() {
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ },
+ set sessionHistory(aValue) {
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+ },
_sendMessage: function(aMessage, aData) {
try {
this._browser.messageManager.sendAsyncMessage(aMessage, aData);
}
catch (e) {
Cu.reportError(e);
}
},
-
- receiveMessage: function(aMessage) {
- switch (aMessage.name) {
- case "WebNavigation:setHistory":
- this._sessionHistory = aMessage.objects.history;
- break;
- }
- }
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RemoteWebNavigation]);
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -218,29 +218,16 @@ addEventListener("unload", () => {
var WebNavigation = {
init: function() {
addMessageListener("WebNavigation:GoBack", this);
addMessageListener("WebNavigation:GoForward", this);
addMessageListener("WebNavigation:GotoIndex", this);
addMessageListener("WebNavigation:LoadURI", this);
addMessageListener("WebNavigation:Reload", this);
addMessageListener("WebNavigation:Stop", this);
-
- // Send a CPOW for the sessionHistory object. We need to make sure
- // it stays alive as long as the content script since CPOWs are
- // weakly held.
- let history = this.webNavigation.sessionHistory;
- this._sessionHistory = history;
- sendAsyncMessage("WebNavigation:setHistory", {}, {history: history});
-
- addEventListener("unload", this.uninit);
- },
-
- uninit: function() {
- this._sessionHistory = null;
},
get webNavigation() {
return docShell.QueryInterface(Ci.nsIWebNavigation);
},
receiveMessage: function(message) {
switch (message.name) {