diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js index d99620ddadca..324843930deb 100644 --- a/toolkit/content/browser-child.js +++ b/toolkit/content/browser-child.js @@ -11,7 +11,7 @@ Cu.import('resource://gre/modules/XPCOMUtils.jsm'); Cu.import("resource://gre/modules/RemoteAddonsChild.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); -let SyncHandler = { +let FocusSyncHandler = { init: function() { sendAsyncMessage("SetSyncHandler", {}, {handler: this}); }, @@ -25,7 +25,7 @@ let SyncHandler = { }, }; -SyncHandler.init(); +FocusSyncHandler.init(); let WebProgressListener = { init: function() { @@ -122,8 +122,6 @@ let WebProgressListener = { WebProgressListener.init(); let WebNavigation = { - _webNavigation: docShell.QueryInterface(Ci.nsIWebNavigation), - init: function() { addMessageListener("WebNavigation:GoBack", this); addMessageListener("WebNavigation:GoForward", this); @@ -132,8 +130,13 @@ let WebNavigation = { addMessageListener("WebNavigation:Reload", this); addMessageListener("WebNavigation:Stop", this); - // Send a CPOW for the sessionHistory object. - let history = this._webNavigation.sessionHistory; + this._webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation); + this._sessionHistory = this._webNavigation.sessionHistory; + + // 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._sessionHistory; sendAsyncMessage("WebNavigation:setHistory", {}, {history: history}); },