зеркало из https://github.com/mozilla/gecko-dev.git
tests cleanup
This commit is contained in:
Родитель
6b918c131c
Коммит
04df8dd1a4
|
@ -1,49 +1,42 @@
|
||||||
var listener = {
|
var listener = {
|
||||||
testFunction : null,
|
testFunction: null,
|
||||||
|
|
||||||
handleEvent : function (e) {
|
handleEvent: function (e) {
|
||||||
this.testFunction();
|
this.testFunction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var newBrowser;
|
|
||||||
|
|
||||||
/* Tests for correct behaviour of getEffectiveHost on identity handler */
|
/* Tests for correct behaviour of getEffectiveHost on identity handler */
|
||||||
function test() {
|
function test() {
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
ok(gIdentityHandler, "gIdentityHandler should exist");
|
ok(gIdentityHandler, "gIdentityHandler should exist");
|
||||||
|
|
||||||
var newTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = newTab;
|
gBrowser.selectedBrowser.addEventListener("load", listener, true);
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
|
||||||
|
|
||||||
newBrowser.addEventListener("load", listener, true);
|
|
||||||
listener.testFunction = testNormalDomain;
|
listener.testFunction = testNormalDomain;
|
||||||
newBrowser.contentWindow.location = 'http://test1.example.org/';
|
content.location = "http://test1.example.org/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testNormalDomain() {
|
function testNormalDomain() {
|
||||||
is(gIdentityHandler._lastLocation.host, 'test1.example.org', "Identity handler is getting the full location");
|
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");
|
is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for test1.example.org");
|
||||||
|
|
||||||
listener.testFunction = testNormalDomainWithPort;
|
listener.testFunction = testNormalDomainWithPort;
|
||||||
newBrowser.contentWindow.location = 'http://sub1.test1.example.org:8000/';
|
content.location = "http://sub1.test1.example.org:8000/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testNormalDomainWithPort() {
|
function testNormalDomainWithPort() {
|
||||||
|
|
||||||
is(gIdentityHandler._lastLocation.host, 'sub1.test1.example.org:8000', "Identity handler is getting port information");
|
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");
|
is(gIdentityHandler.getEffectiveHost(), 'example.org', "getEffectiveHost should return example.org for sub1.test1.example.org:8000");
|
||||||
|
|
||||||
listener.testFunction = testIPWithPort;
|
listener.testFunction = testIPWithPort;
|
||||||
newBrowser.contentWindow.location = 'http://127.0.0.1:8888/';
|
content.location = "http://127.0.0.1:8888/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testIPWithPort() {
|
function testIPWithPort() {
|
||||||
is(gIdentityHandler.getEffectiveHost(), '127.0.0.1', "getEffectiveHost should return 127.0.0.1 for 127.0.0.1:8888");
|
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();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,6 @@ var invalidPage = 'http://127.0.0.1:55555/';
|
||||||
var validPage = 'http://example.com/';
|
var validPage = 'http://example.com/';
|
||||||
var testPage = 'data:text/html,<frameset cols="400,400"><frame src="' + validPage + '"><frame src="' + invalidPage + '"></frameset>';
|
var testPage = 'data:text/html,<frameset cols="400,400"><frame src="' + validPage + '"><frame src="' + invalidPage + '"></frameset>';
|
||||||
|
|
||||||
// Keep track of the browser inside our frame
|
|
||||||
var newBrowser;
|
|
||||||
|
|
||||||
// Store the tab and window created in tests 2 and 3 respectively
|
// Store the tab and window created in tests 2 and 3 respectively
|
||||||
var test2tab;
|
var test2tab;
|
||||||
var test3window;
|
var test3window;
|
||||||
|
@ -16,87 +13,80 @@ var test3window;
|
||||||
var intervalID;
|
var intervalID;
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
var newTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = newTab;
|
gBrowser.selectedBrowser.addEventListener("load", test1Setup, true);
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
content.location = testPage;
|
||||||
|
|
||||||
newBrowser.addEventListener("load", test1Setup, true);
|
|
||||||
newBrowser.contentWindow.location = testPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test1Setup() {
|
function test1Setup() {
|
||||||
|
if (content.frames.length < 2 ||
|
||||||
if(newBrowser.contentWindow.frames.length < 2 ||
|
content.frames[1].location != invalidPage)
|
||||||
newBrowser.contentWindow.frames[1].document.location != invalidPage)
|
|
||||||
// The error frame hasn't loaded yet
|
// The error frame hasn't loaded yet
|
||||||
return;
|
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;
|
document.popupNode = badFrame.document.firstChild;
|
||||||
|
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
// We'd like to use another load listener here, but error pages don't fire load events
|
// We'd like to use another load listener here, but error pages don't fire load events
|
||||||
contextMenu.showOnlyThisFrame();
|
contextMenu.showOnlyThisFrame();
|
||||||
intervalID = window.setInterval(testShowOnlyThisFrame, 3000);
|
intervalID = setInterval(testShowOnlyThisFrame, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testShowOnlyThisFrame() {
|
function testShowOnlyThisFrame() {
|
||||||
|
if (content.location.href == testPage)
|
||||||
if(newBrowser.contentDocument.location.href == testPage)
|
|
||||||
// This is a stale event from the original page loading
|
// This is a stale event from the original page loading
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We should now have loaded the error page frame content directly
|
// We should now have loaded the error page frame content directly
|
||||||
// in the tab, make sure the URL is right.
|
// in the tab, make sure the URL is right.
|
||||||
window.clearInterval(intervalID);
|
clearInterval(intervalID);
|
||||||
|
|
||||||
is(newBrowser.contentDocument.location.href, invalidPage, "Should navigate to page url, not about:neterror");
|
is(content.location.href, invalidPage, "Should navigate to page url, not about:neterror");
|
||||||
|
|
||||||
// Go back to the frames page
|
// Go back to the frames page
|
||||||
gBrowser.addEventListener("load", test2Setup, true);
|
gBrowser.addEventListener("load", test2Setup, true);
|
||||||
newBrowser.contentWindow.location = testPage;
|
content.location = testPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
function test2Setup() {
|
function test2Setup() {
|
||||||
if(newBrowser.contentWindow.frames.length < 2 ||
|
if (content.frames.length < 2 ||
|
||||||
newBrowser.contentWindow.frames[1].document.location != invalidPage)
|
content.frames[1].location != invalidPage)
|
||||||
// The error frame hasn't loaded yet
|
// The error frame hasn't loaded yet
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gBrowser.removeEventListener("load", test2Setup, true);
|
gBrowser.removeEventListener("load", test2Setup, true);
|
||||||
|
|
||||||
// Now let's do the whole thing again, but this time for "Open frame in new tab"
|
// Now let's do the whole thing again, but this time for "Open frame in new tab"
|
||||||
newBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
|
var badFrame = content.frames[1];
|
||||||
var badFrame = newBrowser.contentWindow.frames[1];
|
|
||||||
|
|
||||||
document.popupNode = badFrame.document.firstChild;
|
document.popupNode = badFrame.document.firstChild;
|
||||||
|
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
test2tab = contextMenu.openFrameInTab();
|
test2tab = contextMenu.openFrameInTab();
|
||||||
ok(test2tab instanceof XULElement, "openFrameInTab() should return an element (non-null)");
|
ok(test2tab instanceof XULElement, "openFrameInTab() should return an element (non-null)");
|
||||||
is(test2tab.tagName, "tab", "openFrameInTab() should return a *tab* element");
|
is(test2tab.tagName, "tab", "openFrameInTab() should return a *tab* element");
|
||||||
|
|
||||||
gBrowser.selectedTab = test2tab;
|
gBrowser.selectedTab = test2tab;
|
||||||
|
|
||||||
intervalID = window.setInterval(testOpenFrameInTab, 3000);
|
intervalID = setInterval(testOpenFrameInTab, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testOpenFrameInTab() {
|
function testOpenFrameInTab() {
|
||||||
|
if (gBrowser.contentDocument.location.href == "about:blank")
|
||||||
if(gBrowser.contentDocument.location.href == "about:blank")
|
|
||||||
// Wait another cycle
|
// Wait another cycle
|
||||||
return;
|
return;
|
||||||
window.clearInterval(intervalID);
|
|
||||||
|
clearInterval(intervalID);
|
||||||
|
|
||||||
// We should now have the error page in a new, active tab.
|
// 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");
|
is(gBrowser.contentDocument.location.href, invalidPage, "New tab should have page url, not about:neterror");
|
||||||
|
|
||||||
|
@ -107,30 +97,28 @@ function testOpenFrameInTab() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function test3Setup() {
|
function test3Setup() {
|
||||||
|
|
||||||
// One more time, for "Open frame in new window"
|
// One more time, for "Open frame in new window"
|
||||||
newBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
|
var badFrame = content.frames[1];
|
||||||
var badFrame = newBrowser.contentWindow.frames[1];
|
|
||||||
document.popupNode = badFrame.document.firstChild;
|
document.popupNode = badFrame.document.firstChild;
|
||||||
|
|
||||||
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||||
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
var contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||||
|
|
||||||
test3window = contextMenu.openFrame();
|
test3window = contextMenu.openFrame();
|
||||||
ok(test3window instanceof Window, "openFrame() should return a window (non-null) ");
|
ok(test3window instanceof Window, "openFrame() should return a window (non-null) ");
|
||||||
|
|
||||||
intervalID = window.setInterval(testOpenFrame, 3000);
|
intervalID = setInterval(testOpenFrame, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testOpenFrame() {
|
function testOpenFrame() {
|
||||||
|
if (test3window.content.location.href == "about:blank")
|
||||||
if(test3window.content.document.location.href == "about:blank")
|
|
||||||
// Wait another cycle
|
// Wait another cycle
|
||||||
return;
|
return;
|
||||||
window.clearInterval(intervalID);
|
|
||||||
|
clearInterval(intervalID);
|
||||||
is(test3window.content.document.location.href, invalidPage, "New window should have page url, not about:neterror");
|
|
||||||
|
is(test3window.content.location.href, invalidPage, "New window should have page url, not about:neterror");
|
||||||
|
|
||||||
test3window.close();
|
test3window.close();
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,11 @@ function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
let newBrowser = gBrowser.selectedBrowser;
|
|
||||||
|
|
||||||
newBrowser.addEventListener("load", function() {
|
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||||
newBrowser.removeEventListener("load", arguments.callee, true);
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
let doc = newBrowser.contentDocument;
|
let doc = gBrowser.contentDocument;
|
||||||
let testInput = function(type, expected) {
|
let testInput = function(type, expected) {
|
||||||
let element = doc.createElement("input");
|
let element = doc.createElement("input");
|
||||||
element.setAttribute("type", type);
|
element.setAttribute("type", type);
|
||||||
|
@ -50,5 +49,5 @@ function test() {
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
}, true);
|
||||||
newBrowser.loadURI("data:text/html,test");
|
content.location = "data:text/html,test";
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,28 +46,26 @@ let testPage = 'data:text/html,<body><button onblur="this.parentNode.removeChild
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
// Prepare the test tab
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
let testTab = gBrowser.addTab();
|
|
||||||
gBrowser.selectedTab = testTab;
|
|
||||||
let testBrowser = gBrowser.getBrowserForTab(testTab);
|
|
||||||
|
|
||||||
// Do stuff just after the page loads, so the page script can do its stuff
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||||
testBrowser.addEventListener("load", function() setTimeout(function() {
|
setTimeout(function () {
|
||||||
// The test page loaded, so open an empty tab, select it, then restore
|
var testPageWin = content;
|
||||||
// the test tab. This causes the test page's focused element to be removed
|
|
||||||
// from its document.
|
|
||||||
let emptyTab = gBrowser.addTab();
|
|
||||||
gBrowser.selectedTab = emptyTab;
|
|
||||||
gBrowser.removeCurrentTab();
|
|
||||||
gBrowser.selectedTab = testTab;
|
|
||||||
|
|
||||||
// Make sure focus is given to the window because the element is now gone
|
// The test page loaded, so open an empty tab, select it, then restore
|
||||||
is(document.commandDispatcher.focusedWindow, window.content,
|
// the test tab. This causes the test page's focused element to be removed
|
||||||
"content window is focused");
|
// from its document.
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
finish();
|
gBrowser.removeCurrentTab();
|
||||||
}, 0), true);
|
|
||||||
|
|
||||||
// Start the test by loading the test page
|
// Make sure focus is given to the window because the element is now gone
|
||||||
testBrowser.contentWindow.location = testPage;
|
is(document.commandDispatcher.focusedWindow, testPageWin,
|
||||||
|
"content window is focused");
|
||||||
|
|
||||||
|
gBrowser.removeCurrentTab();
|
||||||
|
finish();
|
||||||
|
}, 0);
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
content.location = testPage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ function test() {
|
||||||
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
||||||
|
|
||||||
if(minutesSinceMidnight > 10)
|
if (minutesSinceMidnight > 10)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ function test() {
|
||||||
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
||||||
if(minutesSinceMidnight > 10)
|
if (minutesSinceMidnight > 10)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ function test() {
|
||||||
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
||||||
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
||||||
|
|
||||||
if(minutesSinceMidnight > 10)
|
if (minutesSinceMidnight > 10)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear 1 hour
|
// Clear 1 hour
|
||||||
|
@ -85,7 +85,7 @@ function test() {
|
||||||
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
||||||
|
|
||||||
if(hoursSinceMidnight > 1)
|
if (hoursSinceMidnight > 1)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ function test() {
|
||||||
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
||||||
if(hoursSinceMidnight > 1)
|
if (hoursSinceMidnight > 1)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ function test() {
|
||||||
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
||||||
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
||||||
|
|
||||||
if(hoursSinceMidnight > 1)
|
if (hoursSinceMidnight > 1)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear 1 hour 10 minutes
|
// Clear 1 hour 10 minutes
|
||||||
|
@ -120,7 +120,7 @@ function test() {
|
||||||
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
||||||
if(minutesSinceMidnight > 70)
|
if (minutesSinceMidnight > 70)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ function test() {
|
||||||
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
||||||
if(minutesSinceMidnight > 70)
|
if (minutesSinceMidnight > 70)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ function test() {
|
||||||
ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
|
ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
|
||||||
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
||||||
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
||||||
if(minutesSinceMidnight > 70)
|
if (minutesSinceMidnight > 70)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear 2 hours
|
// Clear 2 hours
|
||||||
|
@ -150,7 +150,7 @@ function test() {
|
||||||
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://2hour10minutes.com/")), "Pretend visit to 2hour10minutes.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
||||||
if(hoursSinceMidnight > 2)
|
if (hoursSinceMidnight > 2)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ function test() {
|
||||||
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
ok(formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
||||||
if(hoursSinceMidnight > 2)
|
if (hoursSinceMidnight > 2)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ function test() {
|
||||||
ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
|
ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
|
||||||
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
||||||
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
||||||
if(hoursSinceMidnight > 2)
|
if (hoursSinceMidnight > 2)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear 2 hours 10 minutes
|
// Clear 2 hours 10 minutes
|
||||||
|
@ -179,14 +179,14 @@ function test() {
|
||||||
ok(!bhist.isVisited(makeURI("http://2hour10minutes.com")), "Pretend visit to 2hour10minutes.com should now be deleted");
|
ok(!bhist.isVisited(makeURI("http://2hour10minutes.com")), "Pretend visit to 2hour10minutes.com should now be deleted");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
||||||
if(minutesSinceMidnight > 130)
|
if (minutesSinceMidnight > 130)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
ok(!formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should be deleted");
|
ok(!formhist.nameExists("2hour10minutes"), "2hour10minutes form entry should be deleted");
|
||||||
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
ok(formhist.nameExists("4hour"), "4hour form entry should still exist");
|
||||||
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
||||||
if(minutesSinceMidnight > 130)
|
if (minutesSinceMidnight > 130)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ function test() {
|
||||||
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
ok(downloadExists(5555553), "<4 hour old download should still be present");
|
||||||
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
||||||
ok(downloadExists(5555550), "Year old download should still be present");
|
ok(downloadExists(5555550), "Year old download should still be present");
|
||||||
if(minutesSinceMidnight > 130)
|
if (minutesSinceMidnight > 130)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear 4 hours
|
// Clear 4 hours
|
||||||
|
@ -203,20 +203,20 @@ function test() {
|
||||||
|
|
||||||
ok(!bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should now be deleted");
|
ok(!bhist.isVisited(makeURI("http://4hour.com")), "Pretend visit to 4hour.com should now be deleted");
|
||||||
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
ok(bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should still exist");
|
||||||
if(hoursSinceMidnight > 4)
|
if (hoursSinceMidnight > 4)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
ok(!formhist.nameExists("4hour"), "4hour form entry should be deleted");
|
ok(!formhist.nameExists("4hour"), "4hour form entry should be deleted");
|
||||||
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
ok(formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should still exist");
|
||||||
if(hoursSinceMidnight > 4)
|
if (hoursSinceMidnight > 4)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
ok(!downloadExists(5555553), "<4 hour old download should now be deleted");
|
ok(!downloadExists(5555553), "<4 hour old download should now be deleted");
|
||||||
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
|
||||||
ok(downloadExists(5555550), "Year old download should still be present");
|
ok(downloadExists(5555550), "Year old download should still be present");
|
||||||
if(hoursSinceMidnight > 4)
|
if (hoursSinceMidnight > 4)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear 4 hours 10 minutes
|
// Clear 4 hours 10 minutes
|
||||||
|
@ -225,18 +225,18 @@ function test() {
|
||||||
s.range = null;
|
s.range = null;
|
||||||
|
|
||||||
ok(!bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should now be deleted");
|
ok(!bhist.isVisited(makeURI("http://4hour10minutes.com/")), "Pretend visit to 4hour10minutes.com should now be deleted");
|
||||||
if(minutesSinceMidnight > 250)
|
if (minutesSinceMidnight > 250)
|
||||||
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should still exist");
|
||||||
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
|
||||||
|
|
||||||
ok(!formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should be deleted");
|
ok(!formhist.nameExists("4hour10minutes"), "4hour10minutes form entry should be deleted");
|
||||||
if(minutesSinceMidnight > 250)
|
if (minutesSinceMidnight > 250)
|
||||||
ok(formhist.nameExists("today"), "today form entry should still exist");
|
ok(formhist.nameExists("today"), "today form entry should still exist");
|
||||||
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
|
||||||
|
|
||||||
ok(!downloadExists(5555558), "4 hour 10 minute download should now be deleted");
|
ok(!downloadExists(5555558), "4 hour 10 minute download should now be deleted");
|
||||||
ok(downloadExists(5555550), "Year old download should still be present");
|
ok(downloadExists(5555550), "Year old download should still be present");
|
||||||
if(minutesSinceMidnight > 250)
|
if (minutesSinceMidnight > 250)
|
||||||
ok(downloadExists(5555554), "'Today' download should still be present");
|
ok(downloadExists(5555554), "'Today' download should still be present");
|
||||||
|
|
||||||
// Clear Today
|
// Clear Today
|
||||||
|
|
|
@ -55,7 +55,7 @@ function test() {
|
||||||
"focusedElement after tab change, focus in url field, no focus in new tab");
|
"focusedElement after tab change, focus in url field, no focus in new tab");
|
||||||
|
|
||||||
// focusing a button in the current tab should focus it
|
// focusing a button in the current tab should focus it
|
||||||
var button1 = browser1.contentWindow.document.getElementById("button1");
|
var button1 = browser1.contentDocument.getElementById("button1");
|
||||||
expectFocusShift(function () button1.focus(),
|
expectFocusShift(function () button1.focus(),
|
||||||
browser1.contentWindow, button1, true,
|
browser1.contentWindow, button1, true,
|
||||||
"focusedWindow after focus in focused tab");
|
"focusedWindow after focus in focused tab");
|
||||||
|
@ -63,7 +63,7 @@ function test() {
|
||||||
// focusing a button in a background tab should not change the actual
|
// focusing a button in a background tab should not change the actual
|
||||||
// focus, but should set the focus that would be in that background tab to
|
// focus, but should set the focus that would be in that background tab to
|
||||||
// that button.
|
// that button.
|
||||||
var button2 = browser2.contentWindow.document.getElementById("button2");
|
var button2 = browser2.contentDocument.getElementById("button2");
|
||||||
button2.focus();
|
button2.focus();
|
||||||
|
|
||||||
expectFocusShift(function () button2.focus(),
|
expectFocusShift(function () button2.focus(),
|
||||||
|
|
|
@ -1,45 +1,40 @@
|
||||||
var newBrowser
|
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
var newTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = newTab;
|
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
|
||||||
|
|
||||||
// Navigate to a site with a broken cert
|
// Navigate to a site with a broken cert
|
||||||
window.addEventListener("DOMContentLoaded", testBrokenCert, true);
|
window.addEventListener("DOMContentLoaded", testBrokenCert, true);
|
||||||
newBrowser.contentWindow.location = 'https://nocert.example.com/';
|
content.location = "https://nocert.example.com/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrokenCert() {
|
function testBrokenCert() {
|
||||||
window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
|
window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
|
||||||
|
|
||||||
// Confirm that we are displaying the contributed error page, not the default
|
// Confirm that we are displaying the contributed error page, not the default
|
||||||
ok(/^about:certerror/.test(gBrowser.contentWindow.document.documentURI), "Broken page should go to about:certerror, not about:neterror");
|
ok(/^about:certerror/.test(gBrowser.contentDocument.documentURI), "Broken page should go to about:certerror, not about:neterror");
|
||||||
|
|
||||||
// Confirm that the expert section is collapsed
|
// Confirm that the expert section is collapsed
|
||||||
var expertDiv = gBrowser.contentWindow.document.getElementById("expertContent");
|
var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
|
||||||
ok(expertDiv, "Expert content div should exist");
|
ok(expertDiv, "Expert content div should exist");
|
||||||
ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default");
|
ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default");
|
||||||
|
|
||||||
// Tweak the expert mode pref
|
// Tweak the expert mode pref
|
||||||
Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
|
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
|
||||||
.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
|
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", testExpertPref, true);
|
window.addEventListener("DOMContentLoaded", testExpertPref, true);
|
||||||
newBrowser.reload();
|
gBrowser.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testExpertPref() {
|
function testExpertPref() {
|
||||||
|
|
||||||
window.removeEventListener("DOMContentLoaded", testExpertPref, true);
|
window.removeEventListener("DOMContentLoaded", testExpertPref, true);
|
||||||
var expertDiv = gBrowser.contentWindow.document.getElementById("expertContent");
|
var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
|
||||||
var technicalDiv = gBrowser.contentWindow.document.getElementById("technicalContent");
|
var technicalDiv = gBrowser.contentDocument.getElementById("technicalContent");
|
||||||
ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set");
|
ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set");
|
||||||
ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set");
|
ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set");
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
|
gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,50 +47,46 @@ function test() {
|
||||||
"browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html";
|
"browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html";
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
let pageTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = pageTab;
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||||
let pageBrowser = gBrowser.getBrowserForTab(pageTab);
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||||
pageBrowser.addEventListener("load", function () {
|
|
||||||
pageBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
// Make sure the notification is correctly displayed with a remember control
|
// Make sure the notification is correctly displayed with a remember control
|
||||||
let notificationBox = gBrowser.getNotificationBox(pageBrowser);
|
let notificationBox = gBrowser.getNotificationBox();
|
||||||
let notification = notificationBox.getNotificationWithValue("geolocation");
|
let notification = notificationBox.getNotificationWithValue("geolocation");
|
||||||
ok(notification, "Notification box should be displaying outside of private browsing mode");
|
ok(notification, "Notification box should be displaying outside of private browsing mode");
|
||||||
is(notification.getElementsByClassName("rememberChoice").length, 1,
|
is(notification.getElementsByClassName("rememberChoice").length, 1,
|
||||||
"The remember control must be displayed outside of private browsing mode");
|
"The remember control must be displayed outside of private browsing mode");
|
||||||
notificationBox.currentNotification.close();
|
notificationBox.currentNotification.close();
|
||||||
|
|
||||||
gBrowser.removeTab(pageTab);
|
gBrowser.removeCurrentTab();
|
||||||
|
|
||||||
// enter the private browsing mode
|
// enter the private browsing mode
|
||||||
pb.privateBrowsingEnabled = true;
|
pb.privateBrowsingEnabled = true;
|
||||||
|
|
||||||
pageTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = pageTab;
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||||
pageBrowser = gBrowser.getBrowserForTab(pageTab);
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||||
pageBrowser.addEventListener("load", function () {
|
|
||||||
pageBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
// Make sure the notification is correctly displayed without a remember control
|
// Make sure the notification is correctly displayed without a remember control
|
||||||
let notificationBox = gBrowser.getNotificationBox(pageBrowser);
|
let notificationBox = gBrowser.getNotificationBox();
|
||||||
let notification = notificationBox.getNotificationWithValue("geolocation");
|
let notification = notificationBox.getNotificationWithValue("geolocation");
|
||||||
ok(notification, "Notification box should be displaying outside of private browsing mode");
|
ok(notification, "Notification box should be displaying outside of private browsing mode");
|
||||||
is(notification.getElementsByClassName("rememberChoice").length, 0,
|
is(notification.getElementsByClassName("rememberChoice").length, 0,
|
||||||
"The remember control must not be displayed inside of private browsing mode");
|
"The remember control must not be displayed inside of private browsing mode");
|
||||||
notificationBox.currentNotification.close();
|
notificationBox.currentNotification.close();
|
||||||
|
|
||||||
gBrowser.removeTab(pageTab);
|
gBrowser.removeCurrentTab();
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
pb.privateBrowsingEnabled = false;
|
pb.privateBrowsingEnabled = false;
|
||||||
finish();
|
finish();
|
||||||
}, 100); // remember control is added in a setTimeout(0) call
|
}, 100); // remember control is added in a setTimeout(0) call
|
||||||
}, true);
|
}, true);
|
||||||
pageBrowser.contentWindow.location = testPageURL;
|
content.location = testPageURL;
|
||||||
}, 100); // remember control is added in a setTimeout(0) call
|
}, 100); // remember control is added in a setTimeout(0) call
|
||||||
}, true);
|
}, true);
|
||||||
pageBrowser.contentWindow.location = testPageURL;
|
content.location = testPageURL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ function test() {
|
||||||
dialog.addEventListener("load", function () {
|
dialog.addEventListener("load", function () {
|
||||||
dialog.removeEventListener("load", arguments.callee, false);
|
dialog.removeEventListener("load", arguments.callee, false);
|
||||||
|
|
||||||
let browser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
|
let browser = gBrowser.selectedBrowser;
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
|
|
|
@ -40,18 +40,15 @@
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
// initialization
|
// initialization
|
||||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||||
getService(Ci.nsIPrefBranch);
|
|
||||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
|
||||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||||
getService(Ci.nsIPrivateBrowsingService);
|
getService(Ci.nsIPrivateBrowsingService);
|
||||||
|
|
||||||
const kTestURL = "https://example.com/";
|
const TEST_URL = "https://example.com/";
|
||||||
|
|
||||||
// load an SSL site in the first tab and wait for it to finish loading
|
// load an SSL site in the first tab and wait for it to finish loading
|
||||||
let tab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = tab;
|
let browser = gBrowser.selectedBrowser;
|
||||||
let browser = gBrowser.getBrowserForTab(tab);
|
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
|
@ -62,19 +59,19 @@ function test() {
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
is(browser.contentWindow.location, kTestURL,
|
is(content.location, TEST_URL,
|
||||||
"The original SSL page should be loaded at this stage");
|
"The original SSL page should be loaded at this stage");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
gBrowser.removeCurrentTab();
|
||||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
executeSoon(function(){
|
executeSoon(function () {
|
||||||
browser.contentWindow.location = kTestURL;
|
content.location = TEST_URL;
|
||||||
});
|
});
|
||||||
}, true);
|
}, true);
|
||||||
browser.contentWindow.location = kTestURL;
|
content.location = TEST_URL;
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,9 @@ function test() {
|
||||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||||
getService(Ci.nsIPrivateBrowsingService);
|
getService(Ci.nsIPrivateBrowsingService);
|
||||||
|
|
||||||
const kTestURL = "data:text/plain,test";
|
const TEST_URL = "data:text/plain,test";
|
||||||
let tab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = tab;
|
let browser = gBrowser.selectedBrowser;
|
||||||
let browser = gBrowser.getBrowserForTab(tab);
|
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
|
@ -58,8 +57,7 @@ function test() {
|
||||||
|
|
||||||
// enter private browsing mode
|
// enter private browsing mode
|
||||||
pb.privateBrowsingEnabled = true;
|
pb.privateBrowsingEnabled = true;
|
||||||
tab = gBrowser.selectedTab;
|
browser = gBrowser.selectedBrowser;
|
||||||
browser = gBrowser.getBrowserForTab(tab);
|
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
// setTimeout is needed here because the onload handler of about:privatebrowsing sets the focus
|
// setTimeout is needed here because the onload handler of about:privatebrowsing sets the focus
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
@ -71,8 +69,7 @@ function test() {
|
||||||
|
|
||||||
// leave private browsing mode
|
// leave private browsing mode
|
||||||
pb.privateBrowsingEnabled = false;
|
pb.privateBrowsingEnabled = false;
|
||||||
tab = gBrowser.selectedTab;
|
browser = gBrowser.selectedBrowser;
|
||||||
browser = gBrowser.getBrowserForTab(tab);
|
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
// ensure that the URL bar is no longer focused after leaving the private browsing mode
|
// ensure that the URL bar is no longer focused after leaving the private browsing mode
|
||||||
isnot(document.commandDispatcher.focusedElement, gURLBar.inputField,
|
isnot(document.commandDispatcher.focusedElement, gURLBar.inputField,
|
||||||
|
@ -80,13 +77,13 @@ function test() {
|
||||||
// ensure that the URL bar is no longer empty after leaving the private browsing mode
|
// ensure that the URL bar is no longer empty after leaving the private browsing mode
|
||||||
isnot(gURLBar.value, "", "URL Bar should no longer be empty after leaving the private browsing mode");
|
isnot(gURLBar.value, "", "URL Bar should no longer be empty after leaving the private browsing mode");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
}, true);
|
||||||
}, 0);
|
}, 0);
|
||||||
}, true);
|
}, true);
|
||||||
}, true);
|
}, true);
|
||||||
browser.contentWindow.location = kTestURL;
|
content.location = TEST_URL;
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,7 @@
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
// initialization
|
// initialization
|
||||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||||
getService(Ci.nsIPrefBranch);
|
|
||||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
|
||||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||||
getService(Ci.nsIPrivateBrowsingService);
|
getService(Ci.nsIPrivateBrowsingService);
|
||||||
|
|
||||||
|
@ -80,9 +78,8 @@ function test() {
|
||||||
function testTabTitle(url, insidePB, expected_title, funcNext) {
|
function testTabTitle(url, insidePB, expected_title, funcNext) {
|
||||||
pb.privateBrowsingEnabled = insidePB;
|
pb.privateBrowsingEnabled = insidePB;
|
||||||
|
|
||||||
let tab = gBrowser.addTab();
|
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = tab;
|
let browser = gBrowser.selectedBrowser;
|
||||||
let browser = gBrowser.getBrowserForTab(tab);
|
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
|
@ -117,7 +114,7 @@ function test() {
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
pb.privateBrowsingEnabled = false;
|
pb.privateBrowsingEnabled = false;
|
||||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,38 @@
|
||||||
/* Check for the intended visibility of the "Ignore this warning" text*/
|
/* Check for the intended visibility of the "Ignore this warning" text*/
|
||||||
var newBrowser
|
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
var newTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = newTab;
|
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
|
||||||
|
|
||||||
// Navigate to malware site. Can't use an onload listener here since
|
// Navigate to malware site. Can't use an onload listener here since
|
||||||
// error pages don't fire onload
|
// error pages don't fire onload
|
||||||
window.addEventListener("DOMContentLoaded", testMalware, true);
|
window.addEventListener("DOMContentLoaded", testMalware, true);
|
||||||
newBrowser.contentWindow.location = 'http://www.mozilla.com/firefox/its-an-attack.html';
|
content.location = "http://www.mozilla.com/firefox/its-an-attack.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testMalware() {
|
function testMalware() {
|
||||||
window.removeEventListener("DOMContentLoaded", testMalware, true);
|
window.removeEventListener("DOMContentLoaded", testMalware, true);
|
||||||
|
|
||||||
// Confirm that "Ignore this warning" is visible - bug 422410
|
// Confirm that "Ignore this warning" is visible - bug 422410
|
||||||
var el = newBrowser.contentDocument.getElementById("ignoreWarningButton");
|
var el = content.document.getElementById("ignoreWarningButton");
|
||||||
ok(el, "Ignore warning button should be present for malware");
|
ok(el, "Ignore warning button should be present for malware");
|
||||||
|
|
||||||
var style = newBrowser.contentWindow.getComputedStyle(el, null);
|
var style = content.getComputedStyle(el, null);
|
||||||
is(style.display, "-moz-box", "Ignore Warning button should be display:-moz-box for malware");
|
is(style.display, "-moz-box", "Ignore Warning button should be display:-moz-box for malware");
|
||||||
|
|
||||||
// Now launch the phishing test
|
// Now launch the phishing test
|
||||||
window.addEventListener("DOMContentLoaded", testPhishing, true);
|
window.addEventListener("DOMContentLoaded", testPhishing, true);
|
||||||
newBrowser.contentWindow.location = 'http://www.mozilla.com/firefox/its-a-trap.html';
|
content.location = "http://www.mozilla.com/firefox/its-a-trap.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPhishing() {
|
function testPhishing() {
|
||||||
window.removeEventListener("DOMContentLoaded", testPhishing, true);
|
window.removeEventListener("DOMContentLoaded", testPhishing, true);
|
||||||
|
|
||||||
var el = newBrowser.contentDocument.getElementById("ignoreWarningButton");
|
var el = content.document.getElementById("ignoreWarningButton");
|
||||||
ok(el, "Ignore warning button should be present for phishing");
|
ok(el, "Ignore warning button should be present for phishing");
|
||||||
|
|
||||||
var style = newBrowser.contentWindow.getComputedStyle(el, null);
|
var style = content.getComputedStyle(el, null);
|
||||||
is(style.display, "-moz-box", "Ignore Warning button should be display:-moz-box for phishing");
|
is(style.display, "-moz-box", "Ignore Warning button should be display:-moz-box for phishing");
|
||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
|
|
|
@ -3,20 +3,16 @@ menu items.
|
||||||
|
|
||||||
Mac makes this astonishingly painful to test since their help menu is special magic,
|
Mac makes this astonishingly painful to test since their help menu is special magic,
|
||||||
but we can at least test it on the other platforms.*/
|
but we can at least test it on the other platforms.*/
|
||||||
var newBrowser;
|
|
||||||
var menu;
|
var menu;
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
var newTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = newTab;
|
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
|
||||||
|
|
||||||
// Navigate to a normal site
|
// Navigate to a normal site
|
||||||
gBrowser.addEventListener("load", testNormal, false);
|
gBrowser.addEventListener("load", testNormal, false);
|
||||||
newBrowser.contentWindow.location = 'http://example.com/';
|
content.location = "http://example.com/";
|
||||||
}
|
}
|
||||||
|
|
||||||
function testNormal() {
|
function testNormal() {
|
||||||
|
@ -41,7 +37,7 @@ function testNormal_PopupListener() {
|
||||||
|
|
||||||
// Now launch the phishing test. Can't use onload here because error pages don't
|
// Now launch the phishing test. Can't use onload here because error pages don't
|
||||||
// fire normal load events.
|
// fire normal load events.
|
||||||
newBrowser.contentWindow.location = 'http://www.mozilla.com/firefox/its-a-trap.html';
|
content.location = "http://www.mozilla.com/firefox/its-a-trap.html";
|
||||||
window.setTimeout(testPhishing, 2000);
|
window.setTimeout(testPhishing, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,7 @@ function test() {
|
||||||
tab.linkedBrowser.addEventListener("load", function(aEvent) {
|
tab.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||||
this.removeEventListener("load", arguments.callee, true);
|
this.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
let browser = tabbrowser.getBrowserForTab(tab);
|
let history = tab.linkedBrowser.webNavigation.sessionHistory;
|
||||||
let history = browser.webNavigation.sessionHistory;
|
|
||||||
ok(history.count >= 1, "the new tab does have at least one history entry");
|
ok(history.count >= 1, "the new tab does have at least one history entry");
|
||||||
|
|
||||||
ss.setTabState(tab, "{ entries: [] }");
|
ss.setTabState(tab, "{ entries: [] }");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче