Bug 996785 - Fix existing CPOW uses to prepare for weak references (r=mrbkap)

This commit is contained in:
Bill McCloskey 2014-05-16 16:40:37 -07:00
parent 2d6d816264
commit ef7051c241

View File

@ -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});
},