diff --git a/browser/base/content/test/browser_bug420160.js b/browser/base/content/test/browser_bug420160.js
index c1dcbe6f0b5d..ab601db8c3b5 100644
--- a/browser/base/content/test/browser_bug420160.js
+++ b/browser/base/content/test/browser_bug420160.js
@@ -1,49 +1,42 @@
var listener = {
- testFunction : null,
-
- handleEvent : function (e) {
+ testFunction: null,
+
+ handleEvent: function (e) {
this.testFunction();
}
}
-var newBrowser;
-
/* Tests for correct behaviour of getEffectiveHost on identity handler */
function test() {
-
waitForExplicitFinish();
-
+
ok(gIdentityHandler, "gIdentityHandler should exist");
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- newBrowser = gBrowser.getBrowserForTab(newTab);
-
- newBrowser.addEventListener("load", listener, true);
+
+ gBrowser.selectedTab = gBrowser.addTab();
+ gBrowser.selectedBrowser.addEventListener("load", listener, true);
listener.testFunction = testNormalDomain;
- newBrowser.contentWindow.location = 'http://test1.example.org/';
+ content.location = "http://test1.example.org/";
}
function testNormalDomain() {
is(gIdentityHandler._lastLocation.host, 'test1.example.org', "Identity handler is getting the full location");
is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for test1.example.org");
-
+
listener.testFunction = testNormalDomainWithPort;
- newBrowser.contentWindow.location = 'http://sub1.test1.example.org:8000/';
+ content.location = "http://sub1.test1.example.org:8000/";
}
function testNormalDomainWithPort() {
-
is(gIdentityHandler._lastLocation.host, 'sub1.test1.example.org:8000', "Identity handler is getting port information");
is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for sub1.test1.example.org:8000");
-
+
listener.testFunction = testIPWithPort;
- newBrowser.contentWindow.location = 'http://127.0.0.1:8888/';
+ content.location = "http://127.0.0.1:8888/";
}
function testIPWithPort() {
is(gIdentityHandler.getEffectiveHost(), '127.0.0.1', "getEffectiveHost should return 127.0.0.1 for 127.0.0.1:8888");
- newBrowser.removeEventListener("load", listener, true);
+ gBrowser.selectedBrowser.removeEventListener("load", listener, true);
gBrowser.removeCurrentTab();
finish();
}
diff --git a/browser/base/content/test/browser_bug423833.js b/browser/base/content/test/browser_bug423833.js
index 7980502f5cea..8b45585265e7 100644
--- a/browser/base/content/test/browser_bug423833.js
+++ b/browser/base/content/test/browser_bug423833.js
@@ -5,9 +5,6 @@ var invalidPage = 'http://127.0.0.1:55555/';
var validPage = 'http://example.com/';
var testPage = 'data:text/html,
';
-// Keep track of the browser inside our frame
-var newBrowser;
-
// Store the tab and window created in tests 2 and 3 respectively
var test2tab;
var test3window;
@@ -16,87 +13,80 @@ var test3window;
var intervalID;
function test() {
-
waitForExplicitFinish();
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- newBrowser = gBrowser.getBrowserForTab(newTab);
-
- newBrowser.addEventListener("load", test1Setup, true);
- newBrowser.contentWindow.location = testPage;
+
+ gBrowser.selectedTab = gBrowser.addTab();
+ gBrowser.selectedBrowser.addEventListener("load", test1Setup, true);
+ content.location = testPage;
}
function test1Setup() {
-
- if(newBrowser.contentWindow.frames.length < 2 ||
- newBrowser.contentWindow.frames[1].document.location != invalidPage)
+ if (content.frames.length < 2 ||
+ content.frames[1].location != invalidPage)
// The error frame hasn't loaded yet
return;
-
- newBrowser.removeEventListener("load", test1Setup, true);
- var badFrame = newBrowser.contentWindow.frames[1];
+ gBrowser.selectedBrowser.removeEventListener("load", test1Setup, true);
+
+ var badFrame = content.frames[1];
document.popupNode = badFrame.document.firstChild;
-
+
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
// We'd like to use another load listener here, but error pages don't fire load events
contextMenu.showOnlyThisFrame();
- intervalID = window.setInterval(testShowOnlyThisFrame, 3000);
+ intervalID = setInterval(testShowOnlyThisFrame, 3000);
}
function testShowOnlyThisFrame() {
-
- if(newBrowser.contentDocument.location.href == testPage)
+ if (content.location.href == testPage)
// This is a stale event from the original page loading
return;
-
+
// We should now have loaded the error page frame content directly
// in the tab, make sure the URL is right.
- window.clearInterval(intervalID);
-
- is(newBrowser.contentDocument.location.href, invalidPage, "Should navigate to page url, not about:neterror");
-
+ clearInterval(intervalID);
+
+ is(content.location.href, invalidPage, "Should navigate to page url, not about:neterror");
+
// Go back to the frames page
gBrowser.addEventListener("load", test2Setup, true);
- newBrowser.contentWindow.location = testPage;
+ content.location = testPage;
}
function test2Setup() {
- if(newBrowser.contentWindow.frames.length < 2 ||
- newBrowser.contentWindow.frames[1].document.location != invalidPage)
+ if (content.frames.length < 2 ||
+ content.frames[1].location != invalidPage)
// The error frame hasn't loaded yet
return;
-
+
gBrowser.removeEventListener("load", test2Setup, true);
-
+
// Now let's do the whole thing again, but this time for "Open frame in new tab"
- newBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
- var badFrame = newBrowser.contentWindow.frames[1];
-
+ var badFrame = content.frames[1];
+
document.popupNode = badFrame.document.firstChild;
-
+
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
test2tab = contextMenu.openFrameInTab();
ok(test2tab instanceof XULElement, "openFrameInTab() should return an element (non-null)");
is(test2tab.tagName, "tab", "openFrameInTab() should return a *tab* element");
-
+
gBrowser.selectedTab = test2tab;
- intervalID = window.setInterval(testOpenFrameInTab, 3000);
+ intervalID = setInterval(testOpenFrameInTab, 3000);
}
function testOpenFrameInTab() {
-
- if(gBrowser.contentDocument.location.href == "about:blank")
+ if (gBrowser.contentDocument.location.href == "about:blank")
// Wait another cycle
return;
- window.clearInterval(intervalID);
-
+
+ clearInterval(intervalID);
+
// We should now have the error page in a new, active tab.
is(gBrowser.contentDocument.location.href, invalidPage, "New tab should have page url, not about:neterror");
@@ -107,30 +97,28 @@ function testOpenFrameInTab() {
}
function test3Setup() {
-
// One more time, for "Open frame in new window"
- newBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
- var badFrame = newBrowser.contentWindow.frames[1];
+ var badFrame = content.frames[1];
document.popupNode = badFrame.document.firstChild;
-
+
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
test3window = contextMenu.openFrame();
ok(test3window instanceof Window, "openFrame() should return a window (non-null) ");
-
- intervalID = window.setInterval(testOpenFrame, 3000);
+
+ intervalID = setInterval(testOpenFrame, 3000);
}
function testOpenFrame() {
-
- if(test3window.content.document.location.href == "about:blank")
+ if (test3window.content.location.href == "about:blank")
// Wait another cycle
return;
- window.clearInterval(intervalID);
-
- is(test3window.content.document.location.href, invalidPage, "New window should have page url, not about:neterror");
-
+
+ clearInterval(intervalID);
+
+ is(test3window.content.location.href, invalidPage, "New window should have page url, not about:neterror");
+
test3window.close();
cleanup();
}
diff --git a/browser/base/content/test/browser_bug424101.js b/browser/base/content/test/browser_bug424101.js
index 622b1f6106cb..c06fe4d4ae45 100644
--- a/browser/base/content/test/browser_bug424101.js
+++ b/browser/base/content/test/browser_bug424101.js
@@ -4,12 +4,11 @@ function test() {
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
- let newBrowser = gBrowser.selectedBrowser;
- newBrowser.addEventListener("load", function() {
- newBrowser.removeEventListener("load", arguments.callee, true);
+ gBrowser.selectedBrowser.addEventListener("load", function() {
+ gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = newBrowser.contentDocument;
+ let doc = gBrowser.contentDocument;
let testInput = function(type, expected) {
let element = doc.createElement("input");
element.setAttribute("type", type);
@@ -50,5 +49,5 @@ function test() {
gBrowser.removeCurrentTab();
finish();
}, true);
- newBrowser.loadURI("data:text/html,test");
+ content.location = "data:text/html,test";
}
diff --git a/browser/base/content/test/browser_bug427559.js b/browser/base/content/test/browser_bug427559.js
index 325b9e13dd59..fe5a51e94440 100644
--- a/browser/base/content/test/browser_bug427559.js
+++ b/browser/base/content/test/browser_bug427559.js
@@ -46,28 +46,26 @@ let testPage = 'data:text/html,