From 3c7636a394a2d3e893c112e6e0f0ee371adfdf40 Mon Sep 17 00:00:00 2001 From: Anton Kovalyov Date: Mon, 15 Oct 2012 16:30:37 -0700 Subject: [PATCH] Bug 801937 - JavaScript strict warning in scratchpad.js; r=harth --- browser/devtools/scratchpad/scratchpad.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js index e540b1c0972..51a8e0dfa9c 100644 --- a/browser/devtools/scratchpad/scratchpad.js +++ b/browser/devtools/scratchpad/scratchpad.js @@ -225,7 +225,7 @@ var Scratchpad = { this._previousLocation != this.gBrowser.contentWindow.location.href) { let contentWindow = this.gBrowser.selectedBrowser.contentWindow; this._contentSandbox = new Cu.Sandbox(contentWindow, - { sandboxPrototype: contentWindow, wantXrays: false, + { sandboxPrototype: contentWindow, wantXrays: false, sandboxName: 'scratchpad-content'}); this._contentSandbox.__SCRATCHPAD__ = this; @@ -260,7 +260,7 @@ var Scratchpad = { if (!this._chromeSandbox || this.browserWindow != this._previousBrowserWindow) { this._chromeSandbox = new Cu.Sandbox(this.browserWindow, - { sandboxPrototype: this.browserWindow, wantXrays: false, + { sandboxPrototype: this.browserWindow, wantXrays: false, sandboxName: 'scratchpad-chrome'}); this._chromeSandbox.__SCRATCHPAD__ = this; addDebuggerToGlobal(this._chromeSandbox); @@ -1243,8 +1243,13 @@ var Scratchpad = { } this.resetContext(); - this.gBrowser.selectedBrowser.removeEventListener("load", - this._reloadAndRunEvent, true); + + // This event is created only after user uses 'reload and run' feature. + if (this._reloadAndRunEvent) { + this.gBrowser.selectedBrowser.removeEventListener("load", + this._reloadAndRunEvent, true); + } + this.editor.removeEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, this._onDirtyChanged); PreferenceObserver.uninit();