Bug 808608 - Stop relying on unique Location objects in WebConsoleActor. r=past

Right now the code holds a ref to the per-inner-window Location object of the
Window associated with the sandbox, and uses that to determine if the page has
navigated. This breaks when we have one Location object per docshell, because
the check always succeeds. Just use the window ID instead, which is also less
likely to leak.
This commit is contained in:
Bobby Holley 2012-11-21 13:20:04 -08:00
parent f90938a237
commit 9e2e3deda7

View File

@ -98,12 +98,12 @@ WebConsoleActor.prototype =
_prefs: null,
/**
* Tells the current page location associated to the sandbox. When the page
* location is changed, we recreate the sandbox.
* Tells the current inner window associated to the sandbox. When the page
* is navigated, we recreate the sandbox.
* @private
* @type object
*/
_sandboxLocation: null,
_sandboxWindowId: 0,
/**
* The JavaScript Sandbox where code is evaluated.
@ -201,7 +201,8 @@ WebConsoleActor.prototype =
}
this.conn.removeActorPool(this.actorPool);
this._actorPool = null;
this._sandboxLocation = this.sandbox = null;
this.sandbox = null;
this._sandboxWindowId = 0;
this.conn = this._window = null;
},
@ -565,7 +566,7 @@ WebConsoleActor.prototype =
*/
_createSandbox: function WCA__createSandbox()
{
this._sandboxLocation = this.window.location;
this._sandboxWindowId = WebConsoleUtils.getInnerWindowId(this.window);
this.sandbox = new Cu.Sandbox(this.window, {
sandboxPrototype: this.window,
wantXrays: false,
@ -588,7 +589,7 @@ WebConsoleActor.prototype =
{
// If the user changed to a different location, we need to update the
// sandbox.
if (this._sandboxLocation !== this.window.location) {
if (this._sandboxWindowId !== WebConsoleUtils.getInnerWindowId(this.window)) {
this._createSandbox();
}