Bug 751739 - Scratchpad could identify itself; r=harth

This commit is contained in:
Anton Kovalyov 2012-09-11 14:14:27 -07:00
Родитель dfea5c6e00
Коммит fa2eb6dd91
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -268,6 +268,7 @@ var Scratchpad = {
this._contentSandbox = new Cu.Sandbox(contentWindow,
{ sandboxPrototype: contentWindow, wantXrays: false,
sandboxName: 'scratchpad-content'});
this._contentSandbox.__SCRATCHPAD__ = this;
this._previousBrowserWindow = this.browserWindow;
this._previousBrowser = this.gBrowser.selectedBrowser;
@ -302,6 +303,7 @@ var Scratchpad = {
this._chromeSandbox = new Cu.Sandbox(this.browserWindow,
{ sandboxPrototype: this.browserWindow, wantXrays: false,
sandboxName: 'scratchpad-chrome'});
this._chromeSandbox.__SCRATCHPAD__ = this;
addDebuggerToGlobal(this._chromeSandbox);
this._previousBrowserWindow = this.browserWindow;

Просмотреть файл

@ -41,6 +41,14 @@ function runTests()
ok(!notificationBox.currentNotification,
"there is no notification in content context");
let dsp = sp.contentSandbox.__SCRATCHPAD__;
ok(sp.contentSandbox.__SCRATCHPAD__,
"there is a variable named __SCRATCHPAD__");
ok(sp.contentSandbox.__SCRATCHPAD__.editor,
"scratchpad is actually an instance of Scratchpad");
sp.setText("window.foobarBug636725 = 'aloha';");
ok(!content.wrappedJSObject.foobarBug636725,
@ -62,6 +70,12 @@ function runTests()
isnot(contentMenu.getAttribute("checked"), "true",
"content menuitem is not checked");
ok(sp.chromeSandbox.__SCRATCHPAD__,
"there is a variable named __SCRATCHPAD__");
ok(sp.chromeSandbox.__SCRATCHPAD__.editor,
"scratchpad is actually an instance of Scratchpad");
ok(notificationBox.currentNotification,
"there is a notification in browser context");