mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1219504 - Test changes (r=Gijs,mconley,jryans,MattN,Mossop)
This commit is contained in:
parent
2e51589db8
commit
cbca5a7c3e
@ -70,12 +70,8 @@ function loadTabInWindow(win, callback) {
|
|||||||
info("Loading tab");
|
info("Loading tab");
|
||||||
let url = "http://user:pass@example.com/";
|
let url = "http://user:pass@example.com/";
|
||||||
let tab = win.gBrowser.selectedTab = win.gBrowser.addTab(url);
|
let tab = win.gBrowser.selectedTab = win.gBrowser.addTab(url);
|
||||||
tab.linkedBrowser.addEventListener("load", function listener() {
|
BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url).then(() => {
|
||||||
info("Tab loaded");
|
info("Tab loaded");
|
||||||
if (tab.linkedBrowser.currentURI.spec != url)
|
|
||||||
return;
|
|
||||||
tab.linkedBrowser.removeEventListener("load", listener, true);
|
|
||||||
|
|
||||||
is(win.gURLBar.textValue, "example.com", "URL bar had user/pass stripped initially");
|
is(win.gURLBar.textValue, "example.com", "URL bar had user/pass stripped initially");
|
||||||
callback(tab);
|
callback(tab);
|
||||||
}, true);
|
}, true);
|
||||||
|
@ -2,9 +2,7 @@ function test () {
|
|||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
let doc = gBrowser.contentDocument;
|
let doc = gBrowser.contentDocument;
|
||||||
let tooltip = document.getElementById("aHTMLTooltip");
|
let tooltip = document.getElementById("aHTMLTooltip");
|
||||||
|
|
||||||
@ -35,9 +33,10 @@ function test () {
|
|||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
content.location =
|
gBrowser.loadURI(
|
||||||
"http://mochi.test:8888/browser/browser/base/content/test/general/title_test.svg";
|
"http://mochi.test:8888/browser/browser/base/content/test/general/title_test.svg"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
function test () {
|
function test () {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
let doc = gBrowser.contentDocument;
|
let doc = gBrowser.contentDocument;
|
||||||
let tooltip = document.getElementById("aHTMLTooltip");
|
let tooltip = document.getElementById("aHTMLTooltip");
|
||||||
|
|
||||||
@ -15,9 +13,10 @@ function test () {
|
|||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
content.location =
|
gBrowser.loadURI(
|
||||||
"http://mochi.test:8888/browser/browser/base/content/test/general/xul_tooltiptext.xhtml";
|
"http://mochi.test:8888/browser/browser/base/content/test/general/xul_tooltiptext.xhtml"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,42 +1,63 @@
|
|||||||
function test() {
|
function remote(task) {
|
||||||
waitForExplicitFinish();
|
return ContentTask.spawn(gBrowser.selectedBrowser, null, task);
|
||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
|
||||||
|
|
||||||
// Navigate to a site with a broken cert
|
|
||||||
window.addEventListener("DOMContentLoaded", testBrokenCert, true);
|
|
||||||
content.location = "https://nocert.example.com/";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testBrokenCert() {
|
add_task(function* () {
|
||||||
if (gBrowser.contentDocument.documentURI === "about:blank")
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
return;
|
|
||||||
window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
|
let promise = remote(function () {
|
||||||
|
return ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true, event => {
|
||||||
|
return content.document.documentURI != "about:blank";
|
||||||
|
}).then(() => 0); // don't want to send the event to the chrome process
|
||||||
|
});
|
||||||
|
gBrowser.loadURI("https://nocert.example.com/");
|
||||||
|
yield promise;
|
||||||
|
|
||||||
|
let uri = yield remote(() => {
|
||||||
|
return content.document.documentURI;
|
||||||
|
});
|
||||||
|
|
||||||
// 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(gBrowser.contentDocument.documentURI.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
|
ok(uri.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
|
||||||
|
|
||||||
|
let advancedDiv, advancedDivVisibility, technicalDivCollapsed;
|
||||||
|
|
||||||
|
[advancedDiv, advancedDivVisibility] = yield remote(() => {
|
||||||
|
let div = content.document.getElementById("advancedPanel");
|
||||||
|
if (div) {
|
||||||
|
return [true, div.ownerDocument.defaultView.getComputedStyle(div, "").visibility];
|
||||||
|
} else {
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Confirm that the expert section is collapsed
|
// Confirm that the expert section is collapsed
|
||||||
var advancedDiv = gBrowser.contentDocument.getElementById("advancedPanel");
|
|
||||||
ok(advancedDiv, "Advanced content div should exist");
|
ok(advancedDiv, "Advanced content div should exist");
|
||||||
is_element_hidden(advancedDiv, "Advanced content should not be visible by default");
|
is(advancedDivVisibility, "hidden", "Advanced content should not be visible by default");
|
||||||
|
|
||||||
// Tweak the expert mode pref
|
// Tweak the expert mode pref
|
||||||
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
|
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", testExpertPref, true);
|
promise = remote(function () {
|
||||||
|
return ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
|
||||||
|
});
|
||||||
gBrowser.reload();
|
gBrowser.reload();
|
||||||
}
|
yield promise;
|
||||||
|
|
||||||
|
[advancedDiv, advancedDivVisibility] = yield remote(() => {
|
||||||
|
let div = content.document.getElementById("advancedPanel");
|
||||||
|
if (div) {
|
||||||
|
return [true, div.ownerDocument.defaultView.getComputedStyle(div, "").visibility];
|
||||||
|
} else {
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function testExpertPref() {
|
|
||||||
window.removeEventListener("DOMContentLoaded", testExpertPref, true);
|
|
||||||
var advancedDiv = gBrowser.contentDocument.getElementById("advancedPanel");
|
|
||||||
ok(advancedDiv, "Advanced content div should exist");
|
ok(advancedDiv, "Advanced content div should exist");
|
||||||
is_element_visible(advancedDiv, "Advanced content should be visible by default");
|
is(advancedDivVisibility, "visible", "Advanced content should be visible by default");
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
|
if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
|
||||||
gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
|
gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
|
||||||
finish();
|
});
|
||||||
}
|
|
||||||
|
@ -2,15 +2,16 @@ function test() {
|
|||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
is(document.getElementById("identity-box").className,
|
is(document.getElementById("identity-box").className,
|
||||||
"unknownIdentity mixedDisplayContent",
|
"unknownIdentity mixedDisplayContent",
|
||||||
"identity box has class name for mixed content");
|
"identity box has class name for mixed content");
|
||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
content.location = "https://example.com/browser/browser/base/content/test/general/test_bug435035.html";
|
gBrowser.loadURI(
|
||||||
|
"https://example.com/browser/browser/base/content/test/general/test_bug435035.html"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,16 @@ function test() {
|
|||||||
// Start the sub-document load.
|
// Start the sub-document load.
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
executeSoon(function () {
|
executeSoon(function () {
|
||||||
testBrowser.addEventListener("load", function (e) {
|
BrowserTestUtils.browserLoaded(testBrowser, true).then(url => {
|
||||||
testBrowser.removeEventListener("load", arguments.callee, true);
|
is(url, TEST_IFRAME_URL, "got the load event for the iframe");
|
||||||
|
|
||||||
is(e.target.defaultView.location, TEST_IFRAME_URL, "got the load event for the iframe");
|
|
||||||
is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load");
|
is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load");
|
||||||
|
|
||||||
FullZoomHelper.removeTabAndWaitForLocationChange().
|
FullZoomHelper.removeTabAndWaitForLocationChange().
|
||||||
then(() => deferred.resolve());
|
then(() => deferred.resolve());
|
||||||
}, true);
|
});
|
||||||
content.document.querySelector("iframe").src = TEST_IFRAME_URL;
|
ContentTask.spawn(testBrowser, TEST_IFRAME_URL, url => {
|
||||||
|
content.document.querySelector("iframe").src = url;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
yield deferred.promise;
|
yield deferred.promise;
|
||||||
}).then(finish, FullZoomHelper.failAndContinue(finish));
|
}).then(finish, FullZoomHelper.failAndContinue(finish));
|
||||||
|
@ -803,12 +803,9 @@ function test_urlbar() {
|
|||||||
|
|
||||||
function test_wronghost() {
|
function test_wronghost() {
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.addEventListener("load", function() {
|
|
||||||
if (gBrowser.currentURI.spec != TESTROOT2 + "enabled.html")
|
|
||||||
return;
|
|
||||||
|
|
||||||
gBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
|
let requestedUrl = TESTROOT2 + "enabled.html";
|
||||||
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, requestedUrl).then(() => {
|
||||||
// Wait for the progress notification
|
// Wait for the progress notification
|
||||||
wait_for_progress_notification(function(aPanel) {
|
wait_for_progress_notification(function(aPanel) {
|
||||||
// Wait for the complete notification
|
// Wait for the complete notification
|
||||||
@ -825,7 +822,7 @@ function test_wronghost() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gBrowser.loadURI(TESTROOT + "corrupt.xpi");
|
gBrowser.loadURI(TESTROOT + "corrupt.xpi");
|
||||||
}, true);
|
});
|
||||||
gBrowser.loadURI(TESTROOT2 + "enabled.html");
|
gBrowser.loadURI(TESTROOT2 + "enabled.html");
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -848,12 +845,8 @@ function test_reload() {
|
|||||||
|
|
||||||
PopupNotifications.panel.addEventListener("popuphiding", test_fail, false);
|
PopupNotifications.panel.addEventListener("popuphiding", test_fail, false);
|
||||||
|
|
||||||
gBrowser.addEventListener("load", function() {
|
let requestedUrl = TESTROOT2 + "enabled.html";
|
||||||
if (gBrowser.currentURI.spec != TESTROOT2 + "enabled.html")
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, requestedUrl).then(() => {
|
||||||
return;
|
|
||||||
|
|
||||||
gBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
PopupNotifications.panel.removeEventListener("popuphiding", test_fail, false);
|
PopupNotifications.panel.removeEventListener("popuphiding", test_fail, false);
|
||||||
|
|
||||||
AddonManager.getAllInstalls(function(aInstalls) {
|
AddonManager.getAllInstalls(function(aInstalls) {
|
||||||
@ -864,7 +857,7 @@ function test_reload() {
|
|||||||
wait_for_notification_close(runNextTest);
|
wait_for_notification_close(runNextTest);
|
||||||
gBrowser.removeTab(gBrowser.selectedTab);
|
gBrowser.removeTab(gBrowser.selectedTab);
|
||||||
});
|
});
|
||||||
}, true);
|
});
|
||||||
gBrowser.loadURI(TESTROOT2 + "enabled.html");
|
gBrowser.loadURI(TESTROOT2 + "enabled.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
let doc = gBrowser.contentDocument;
|
let doc = gBrowser.contentDocument;
|
||||||
let tooltip = document.getElementById("aHTMLTooltip");
|
let tooltip = document.getElementById("aHTMLTooltip");
|
||||||
let i = doc.getElementById("i");
|
let i = doc.getElementById("i");
|
||||||
@ -21,9 +19,10 @@ function test() {
|
|||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
content.location =
|
gBrowser.loadURI(
|
||||||
"data:text/html,<!DOCTYPE html><html><body><input id='i'></body></html>";
|
"data:text/html,<!DOCTYPE html><html><body><input id='i'></body></html>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,13 +14,11 @@ function test() {
|
|||||||
is(gURLBar.value, URI, "location bar value matches test URI after switching tabs");
|
is(gURLBar.value, URI, "location bar value matches test URI after switching tabs");
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
is(gBrowser.userTypedValue, null, "userTypedValue is null as the page has loaded");
|
is(gBrowser.userTypedValue, null, "userTypedValue is null as the page has loaded");
|
||||||
is(gURLBar.value, URI, "location bar value matches test URI as the page has loaded");
|
is(gURLBar.value, URI, "location bar value matches test URI as the page has loaded");
|
||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
}
|
}
|
||||||
|
@ -8,19 +8,18 @@ function test() {
|
|||||||
let uriObj = Services.io.newURI(uriString, null, null)
|
let uriObj = Services.io.newURI(uriString, null, null)
|
||||||
let cp = Components.classes["@mozilla.org/cookie/permission;1"]
|
let cp = Components.classes["@mozilla.org/cookie/permission;1"]
|
||||||
.getService(Components.interfaces.nsICookiePermission);
|
.getService(Components.interfaces.nsICookiePermission);
|
||||||
|
|
||||||
Services.prefs.setIntPref(cookieBehavior, 2);
|
Services.prefs.setIntPref(cookieBehavior, 2);
|
||||||
|
|
||||||
cp.setAccess(uriObj, cp.ACCESS_ALLOW);
|
cp.setAccess(uriObj, cp.ACCESS_ALLOW);
|
||||||
gBrowser.selectedTab = gBrowser.addTab(uriString);
|
gBrowser.selectedTab = gBrowser.addTab(uriString);
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", onTabLoaded, true);
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(onTabLoaded);
|
||||||
|
|
||||||
function onTabLoaded() {
|
function onTabLoaded() {
|
||||||
is(gBrowser.selectedBrowser.contentWindow.navigator.cookieEnabled, true,
|
is(gBrowser.selectedBrowser.contentWindow.navigator.cookieEnabled, true,
|
||||||
"navigator.cookieEnabled should be true");
|
"navigator.cookieEnabled should be true");
|
||||||
// Clean up
|
// Clean up
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", onTabLoaded, true);
|
|
||||||
gBrowser.removeTab(gBrowser.selectedTab);
|
gBrowser.removeTab(gBrowser.selectedTab);
|
||||||
Services.prefs.setIntPref(cookieBehavior, 0);
|
Services.prefs.setIntPref(cookieBehavior, 0);
|
||||||
cp.setAccess(uriObj, cp.ACCESS_DEFAULT);
|
cp.setAccess(uriObj, cp.ACCESS_DEFAULT);
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
function test() {
|
function test() {
|
||||||
let newTab = gBrowser.addTab();
|
let newTab = gBrowser.addTab();
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
newTab.linkedBrowser.addEventListener("load", mainPart, true);
|
BrowserTestUtils.browserLoaded(newTab.linkedBrowser).then(mainPart);
|
||||||
|
|
||||||
function mainPart() {
|
function mainPart() {
|
||||||
gBrowser.pinTab(newTab);
|
gBrowser.pinTab(newTab);
|
||||||
gBrowser.selectedTab = newTab;
|
gBrowser.selectedTab = newTab;
|
||||||
@ -20,7 +20,6 @@ function test() {
|
|||||||
openUILinkIn("http://example.org/", "current");
|
openUILinkIn("http://example.org/", "current");
|
||||||
is(gBrowser.tabs.length, 3, "Should open in new tab");
|
is(gBrowser.tabs.length, 3, "Should open in new tab");
|
||||||
|
|
||||||
newTab.removeEventListener("load", mainPart, true);
|
|
||||||
gBrowser.removeTab(newTab);
|
gBrowser.removeTab(newTab);
|
||||||
gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
|
gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
|
||||||
finish();
|
finish();
|
||||||
|
@ -17,12 +17,10 @@ function test() {
|
|||||||
|
|
||||||
var tab = gBrowser.addTab("http://mochi.test:8888/");
|
var tab = gBrowser.addTab("http://mochi.test:8888/");
|
||||||
var browser = gBrowser.getBrowserForTab(tab);
|
var browser = gBrowser.getBrowserForTab(tab);
|
||||||
browser.addEventListener("load", function() {
|
BrowserTestUtils.browserLoaded(browser).then(() => {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
BrowserTestUtils.removeTab(tab).then(() => {
|
BrowserTestUtils.removeTab(tab).then(() => {
|
||||||
ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
|
ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
}, true);
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,7 @@ function todo_check(aElementName, aBarred) {
|
|||||||
function test () {
|
function test () {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
let testData = [
|
let testData = [
|
||||||
/* element name, barred */
|
/* element name, barred */
|
||||||
[ 'input', false, null],
|
[ 'input', false, null],
|
||||||
@ -87,9 +85,10 @@ function test () {
|
|||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
content.location =
|
gBrowser.loadURI(
|
||||||
"data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>";
|
"data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,9 @@
|
|||||||
function test() {
|
function test() {
|
||||||
let newTab = gBrowser.addTab("http://example.com");
|
let newTab = gBrowser.addTab("http://example.com");
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
newTab.linkedBrowser.addEventListener("load", mainPart, true);
|
BrowserTestUtils.browserLoaded(newTab.linkedBrowser).then(mainPart);
|
||||||
|
|
||||||
function mainPart() {
|
function mainPart() {
|
||||||
newTab.linkedBrowser.removeEventListener("load", mainPart, true);
|
|
||||||
|
|
||||||
gBrowser.pinTab(newTab);
|
gBrowser.pinTab(newTab);
|
||||||
gBrowser.selectedTab = newTab;
|
gBrowser.selectedTab = newTab;
|
||||||
|
|
||||||
|
@ -17,15 +17,13 @@ function test() {
|
|||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||||
tab.linkedBrowser.addEventListener("load", (function(event) {
|
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
|
||||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
if (BookmarkingUI.status == BookmarkingUI.STATUS_UPDATING) {
|
if (BookmarkingUI.status == BookmarkingUI.STATUS_UPDATING) {
|
||||||
waitForCondition(() => BookmarkingUI.status != BookmarkingUI.STATUS_UPDATING, finishTest, "BookmarkingUI was updating for too long");
|
waitForCondition(() => BookmarkingUI.status != BookmarkingUI.STATUS_UPDATING, finishTest, "BookmarkingUI was updating for too long");
|
||||||
} else {
|
} else {
|
||||||
finishTest();
|
finishTest();
|
||||||
}
|
}
|
||||||
}), true);
|
});
|
||||||
|
|
||||||
tab.linkedBrowser.loadURI("http://example.com/browser/browser/base/content/test/general/dummy_page.html");
|
tab.linkedBrowser.loadURI("http://example.com/browser/browser/base/content/test/general/dummy_page.html");
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,12 @@
|
|||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab("data:text/html,<iframe width='700' height='700' src='about:certerror'></iframe>");
|
||||||
// Open a html page with about:certerror in an iframe
|
// Open a html page with about:certerror in an iframe
|
||||||
gBrowser.selectedBrowser.addEventListener("load", testIframeCert, true);
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(testIframeCert);
|
||||||
content.location = "data:text/html,<iframe width='700' height='700' src='about:certerror'></iframe>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testIframeCert(e) {
|
function testIframeCert(e) {
|
||||||
if (e.target.location.href == "about:blank") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", testIframeCert, true);
|
|
||||||
// Confirm that the expert section is hidden
|
// Confirm that the expert section is hidden
|
||||||
var doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument;
|
var doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument;
|
||||||
var aP = doc.getElementById("advancedPanel");
|
var aP = doc.getElementById("advancedPanel");
|
||||||
|
@ -3,14 +3,7 @@ function test () {
|
|||||||
|
|
||||||
var isHTTPS = false;
|
var isHTTPS = false;
|
||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
function loadListener() {
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
|
||||||
if (isHTTPS) {
|
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
}
|
|
||||||
let doc = gBrowser.contentDocument;
|
|
||||||
|
|
||||||
|
|
||||||
function testLocation(link, url, next) {
|
function testLocation(link, url, next) {
|
||||||
var tabOpenListener = new TabOpenListener(url, function () {
|
var tabOpenListener = new TabOpenListener(url, function () {
|
||||||
gBrowser.removeTab(this.tab);
|
gBrowser.removeTab(this.tab);
|
||||||
@ -18,18 +11,26 @@ function test () {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
doc.getElementById(link).click();
|
ContentTask.spawn(gBrowser.selectedBrowser, link, link => {
|
||||||
|
content.document.getElementById(link).click();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLink(link, name, next) {
|
function testLink(link, name, next) {
|
||||||
addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function (win) {
|
addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function (win) {
|
||||||
is(doc.getElementById("unload-flag").textContent, "Okay", "beforeunload shouldn't have fired");
|
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
|
||||||
is(win.document.getElementById("location").value, name, "file name should match");
|
return content.document.getElementById("unload-flag").textContent;
|
||||||
win.close();
|
}).then(unloadFlag => {
|
||||||
next();
|
is(unloadFlag, "Okay", "beforeunload shouldn't have fired");
|
||||||
|
is(win.document.getElementById("location").value, name, "file name should match");
|
||||||
|
win.close();
|
||||||
|
next();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
doc.getElementById(link).click();
|
ContentTask.spawn(gBrowser.selectedBrowser, link, link => {
|
||||||
|
content.document.getElementById(link).click();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
testLink("link1", "test.txt",
|
testLink("link1", "test.txt",
|
||||||
@ -41,18 +42,22 @@ function test () {
|
|||||||
testLocation.bind(null, "link7", "http://example.com/",
|
testLocation.bind(null, "link7", "http://example.com/",
|
||||||
function () {
|
function () {
|
||||||
if (isHTTPS) {
|
if (isHTTPS) {
|
||||||
gBrowser.removeCurrentTab();
|
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
// same test again with https:
|
// same test again with https:
|
||||||
isHTTPS = true;
|
isHTTPS = true;
|
||||||
content.location = "https://example.com:443/browser/browser/base/content/test/general/download_page.html";
|
gBrowser.loadURI("https://example.com:443/browser/browser/base/content/test/general/download_page.html");
|
||||||
}
|
}
|
||||||
})))))));
|
})))))));
|
||||||
|
|
||||||
}, true);
|
}
|
||||||
|
|
||||||
content.location = "http://mochi.test:8888/browser/browser/base/content/test/general/download_page.html";
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
|
loadListener();
|
||||||
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(loadListener);
|
||||||
|
});
|
||||||
|
|
||||||
|
gBrowser.loadURI("http://mochi.test:8888/browser/browser/base/content/test/general/download_page.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -97,15 +102,12 @@ TabOpenListener.prototype = {
|
|||||||
gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
|
gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
|
||||||
this.tab = event.originalTarget;
|
this.tab = event.originalTarget;
|
||||||
this.browser = this.tab.linkedBrowser;
|
this.browser = this.tab.linkedBrowser;
|
||||||
gBrowser.addEventListener("pageshow", this, false);
|
BrowserTestUtils.browserLoaded(this.browser, false, this.url).then(() => {
|
||||||
} else if (event.type == "pageshow") {
|
this.tab.addEventListener("TabClose", this, false);
|
||||||
if (event.target.location.href != this.url)
|
var url = this.browser.currentURI.spec;
|
||||||
return;
|
is(url, this.url, "Should have opened the correct tab");
|
||||||
gBrowser.removeEventListener("pageshow", this, false);
|
this.opencallback();
|
||||||
this.tab.addEventListener("TabClose", this, false);
|
});
|
||||||
var url = this.browser.contentDocument.location.href;
|
|
||||||
is(url, this.url, "Should have opened the correct tab");
|
|
||||||
this.opencallback(this.tab, this.browser.contentWindow);
|
|
||||||
} else if (event.type == "TabClose") {
|
} else if (event.type == "TabClose") {
|
||||||
if (event.originalTarget != this.tab)
|
if (event.originalTarget != this.tab)
|
||||||
return;
|
return;
|
||||||
|
@ -45,10 +45,7 @@ function cleanUpAfterTests() {
|
|||||||
//------------------------ Test 1 ------------------------------
|
//------------------------ Test 1 ------------------------------
|
||||||
|
|
||||||
function test1A() {
|
function test1A() {
|
||||||
// Removing EventListener because we have to register a new
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test1B);
|
||||||
// one once the page is loaded with mixed content blocker disabled
|
|
||||||
gTestBrowser.removeEventListener("load", test1A, true);
|
|
||||||
gTestBrowser.addEventListener("load", test1B, true);
|
|
||||||
|
|
||||||
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
|
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
|
||||||
|
|
||||||
@ -65,21 +62,18 @@ function test1B() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test1C() {
|
function test1C() {
|
||||||
gTestBrowser.removeEventListener("load", test1B, true);
|
|
||||||
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
||||||
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1C");
|
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1C");
|
||||||
|
|
||||||
// The Script loaded after we disabled the page, now we are going to reload the
|
// The Script loaded after we disabled the page, now we are going to reload the
|
||||||
// page and see if our decision is persistent
|
// page and see if our decision is persistent
|
||||||
gTestBrowser.addEventListener("load", test1D, true);
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test1D);
|
||||||
|
|
||||||
var url = gHttpTestRoot1 + "file_bug902156_2.html";
|
var url = gHttpTestRoot1 + "file_bug902156_2.html";
|
||||||
gTestBrowser.contentWindow.location = url;
|
gTestBrowser.loadURI(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test1D() {
|
function test1D() {
|
||||||
gTestBrowser.removeEventListener("load", test1D, true);
|
|
||||||
|
|
||||||
// The Control Center button should appear but isMixedContentBlocked should be NOT true,
|
// The Control Center button should appear but isMixedContentBlocked should be NOT true,
|
||||||
// because our decision of disabling the mixed content blocker is persistent.
|
// because our decision of disabling the mixed content blocker is persistent.
|
||||||
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
|
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
|
||||||
@ -94,16 +88,13 @@ function test1D() {
|
|||||||
//------------------------ Test 2 ------------------------------
|
//------------------------ Test 2 ------------------------------
|
||||||
|
|
||||||
function test2() {
|
function test2() {
|
||||||
gTestBrowser.addEventListener("load", test2A, true);
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test2A);
|
||||||
var url = gHttpTestRoot2 + "file_bug902156_2.html";
|
var url = gHttpTestRoot2 + "file_bug902156_2.html";
|
||||||
gTestBrowser.contentWindow.location = url;
|
gTestBrowser.loadURI(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test2A() {
|
function test2A() {
|
||||||
// Removing EventListener because we have to register a new
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test2B);
|
||||||
// one once the page is loaded with mixed content blocker disabled
|
|
||||||
gTestBrowser.removeEventListener("load", test2A, true);
|
|
||||||
gTestBrowser.addEventListener("load", test2B, true);
|
|
||||||
|
|
||||||
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
|
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
|
||||||
|
|
||||||
@ -120,13 +111,12 @@ function test2B() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test2C() {
|
function test2C() {
|
||||||
gTestBrowser.removeEventListener("load", test2B, true);
|
|
||||||
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
var actual = content.document.getElementById('mctestdiv').innerHTML;
|
||||||
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2C");
|
is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2C");
|
||||||
|
|
||||||
// The Script loaded after we disabled the page, now we are going to reload the
|
// The Script loaded after we disabled the page, now we are going to reload the
|
||||||
// page and see if our decision is persistent
|
// page and see if our decision is persistent
|
||||||
gTestBrowser.addEventListener("load", test2D, true);
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test2D);
|
||||||
|
|
||||||
// reload the page using the provided link in the html file
|
// reload the page using the provided link in the html file
|
||||||
var mctestlink = content.document.getElementById("mctestlink");
|
var mctestlink = content.document.getElementById("mctestlink");
|
||||||
@ -134,8 +124,6 @@ function test2C() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test2D() {
|
function test2D() {
|
||||||
gTestBrowser.removeEventListener("load", test2D, true);
|
|
||||||
|
|
||||||
// The Control Center button should appear but isMixedContentBlocked should be NOT true,
|
// The Control Center button should appear but isMixedContentBlocked should be NOT true,
|
||||||
// because our decision of disabling the mixed content blocker is persistent.
|
// because our decision of disabling the mixed content blocker is persistent.
|
||||||
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
|
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
|
||||||
@ -150,16 +138,12 @@ function test2D() {
|
|||||||
//------------------------ Test 3 ------------------------------
|
//------------------------ Test 3 ------------------------------
|
||||||
|
|
||||||
function test3() {
|
function test3() {
|
||||||
gTestBrowser.addEventListener("load", test3A, true);
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test3A);
|
||||||
var url = gHttpTestRoot1 + "file_bug902156_3.html";
|
var url = gHttpTestRoot1 + "file_bug902156_3.html";
|
||||||
gTestBrowser.contentWindow.location = url;
|
gTestBrowser.loadURI(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test3A() {
|
function test3A() {
|
||||||
// Removing EventListener because we have to register a new
|
|
||||||
// one once the page is loaded with mixed content blocker disabled
|
|
||||||
gTestBrowser.removeEventListener("load", test3A, true);
|
|
||||||
|
|
||||||
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
|
assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
|
||||||
|
|
||||||
// We are done with tests, clean up
|
// We are done with tests, clean up
|
||||||
@ -184,7 +168,7 @@ function test() {
|
|||||||
newTab.linkedBrowser.stop()
|
newTab.linkedBrowser.stop()
|
||||||
|
|
||||||
// Starting Test Number 1:
|
// Starting Test Number 1:
|
||||||
gTestBrowser.addEventListener("load", test1A, true);
|
BrowserTestUtils.browserLoaded(gTestBrowser).then(test1A);
|
||||||
var url = gHttpTestRoot1 + "file_bug902156_1.html";
|
var url = gHttpTestRoot1 + "file_bug902156_1.html";
|
||||||
gTestBrowser.contentWindow.location = url;
|
gTestBrowser.loadURI(url);
|
||||||
}
|
}
|
||||||
|
@ -3,32 +3,27 @@
|
|||||||
|
|
||||||
// Tests find bar auto-close behavior
|
// Tests find bar auto-close behavior
|
||||||
|
|
||||||
var newTab, iframe;
|
var newTab;
|
||||||
|
|
||||||
function test() {
|
add_task(function* findbar_test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
newTab = gBrowser.addTab("about:blank");
|
newTab = gBrowser.addTab("about:blank");
|
||||||
newTab.linkedBrowser.addEventListener("DOMContentLoaded",
|
|
||||||
prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
|
|
||||||
newTab.linkedBrowser.contentWindow.location = "http://example.com/browser/" +
|
|
||||||
"browser/base/content/test/general/test_bug628179.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepareTestFindBarStaysOpenOnSubdocumentLocationChange() {
|
let promise = ContentTask.spawn(newTab.linkedBrowser, null, function* () {
|
||||||
newTab.linkedBrowser.removeEventListener("DOMContentLoaded",
|
yield ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", false);
|
||||||
prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
|
});
|
||||||
|
newTab.linkedBrowser.loadURI("http://example.com/browser/" +
|
||||||
|
"browser/base/content/test/general/test_bug628179.html");
|
||||||
|
yield promise;
|
||||||
|
|
||||||
gFindBar.open();
|
gFindBar.open();
|
||||||
|
|
||||||
iframe = newTab.linkedBrowser.contentDocument.getElementById("iframe");
|
yield new ContentTask.spawn(newTab.linkedBrowser, null, function* () {
|
||||||
iframe.addEventListener("load",
|
let iframe = content.document.getElementById("iframe");
|
||||||
testFindBarStaysOpenOnSubdocumentLocationChange, false);
|
let promise = ContentTaskUtils.waitForEvent(iframe, "load", false);
|
||||||
iframe.src = "http://example.org/";
|
iframe.src = "http://example.org/";
|
||||||
}
|
yield promise;
|
||||||
|
});
|
||||||
function testFindBarStaysOpenOnSubdocumentLocationChange() {
|
|
||||||
iframe.removeEventListener("load",
|
|
||||||
testFindBarStaysOpenOnSubdocumentLocationChange, false);
|
|
||||||
|
|
||||||
ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
|
ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
|
||||||
"subdocument changes");
|
"subdocument changes");
|
||||||
@ -36,5 +31,5 @@ function testFindBarStaysOpenOnSubdocumentLocationChange() {
|
|||||||
gFindBar.close();
|
gFindBar.close();
|
||||||
gBrowser.removeTab(newTab);
|
gBrowser.removeTab(newTab);
|
||||||
finish();
|
finish();
|
||||||
}
|
});
|
||||||
|
|
||||||
|
@ -3,17 +3,16 @@ function test() {
|
|||||||
gPrefService.setBoolPref("dom.disable_open_during_load", false);
|
gPrefService.setBoolPref("dom.disable_open_during_load", false);
|
||||||
|
|
||||||
var browser = gBrowser.selectedBrowser;
|
var browser = gBrowser.selectedBrowser;
|
||||||
browser.addEventListener("load", function () {
|
BrowserTestUtils.browserLoaded(browser).then(() => {
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
if (gPrefService.prefHasUserValue("dom.disable_open_during_load"))
|
if (gPrefService.prefHasUserValue("dom.disable_open_during_load"))
|
||||||
gPrefService.clearUserPref("dom.disable_open_during_load");
|
gPrefService.clearUserPref("dom.disable_open_during_load");
|
||||||
|
|
||||||
findPopup();
|
findPopup();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
content.location =
|
browser.loadURI(
|
||||||
"data:text/html,<html><script>popup=open('about:blank','','width=300,height=200')</script>";
|
"data:text/html,<html><script>popup=open('about:blank','','width=300,height=200')</script>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function findPopup() {
|
function findPopup() {
|
||||||
|
@ -41,22 +41,20 @@ function test_getBoolPref() {
|
|||||||
function test_openNewTabWith() {
|
function test_openNewTabWith() {
|
||||||
openNewTabWith("http://example.com/");
|
openNewTabWith("http://example.com/");
|
||||||
let tab = gBrowser.selectedTab = gBrowser.tabs[1];
|
let tab = gBrowser.selectedTab = gBrowser.tabs[1];
|
||||||
tab.linkedBrowser.addEventListener("load", function onLoad(event) {
|
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
|
||||||
tab.linkedBrowser.removeEventListener("load", onLoad, true);
|
|
||||||
is(tab.linkedBrowser.currentURI.spec, "http://example.com/", "example.com loaded");
|
is(tab.linkedBrowser.currentURI.spec, "http://example.com/", "example.com loaded");
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
runNextTest();
|
runNextTest();
|
||||||
}, true);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_openUILink() {
|
function test_openUILink() {
|
||||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||||
tab.linkedBrowser.addEventListener("load", function onLoad(event) {
|
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
|
||||||
tab.linkedBrowser.removeEventListener("load", onLoad, true);
|
|
||||||
is(tab.linkedBrowser.currentURI.spec, "http://example.org/", "example.org loaded");
|
is(tab.linkedBrowser.currentURI.spec, "http://example.org/", "example.org loaded");
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
runNextTest();
|
runNextTest();
|
||||||
}, true);
|
});
|
||||||
|
|
||||||
openUILink("http://example.org/"); // defaults to "current"
|
openUILink("http://example.org/"); // defaults to "current"
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ function test() {
|
|||||||
/** Test for Bug 522545 **/
|
/** Test for Bug 522545 **/
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
requestLongerTimeout(2);
|
requestLongerTimeout(3);
|
||||||
|
|
||||||
// This tests the following use case:
|
// This tests the following use case:
|
||||||
// User opens a new tab which gets focus. The user types something into the
|
// User opens a new tab which gets focus. The user types something into the
|
||||||
@ -159,12 +159,10 @@ function test() {
|
|||||||
|
|
||||||
ok(hasUTV, "At least one tab has a userTypedValue with userTypedClear with no loaded URL");
|
ok(hasUTV, "At least one tab has a userTypedValue with userTypedClear with no loaded URL");
|
||||||
|
|
||||||
gBrowser.addEventListener("load", firstLoad, true);
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(firstLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
function firstLoad() {
|
function firstLoad() {
|
||||||
gBrowser.removeEventListener("load", firstLoad, true);
|
|
||||||
|
|
||||||
let state = JSON.parse(ss.getBrowserState());
|
let state = JSON.parse(ss.getBrowserState());
|
||||||
let hasSH = state.windows[0].tabs.some(function(aTab) {
|
let hasSH = state.windows[0].tabs.some(function(aTab) {
|
||||||
return !("userTypedValue" in aTab) && aTab.entries[0].url;
|
return !("userTypedValue" in aTab) && aTab.entries[0].url;
|
||||||
|
@ -9,12 +9,10 @@ function test()
|
|||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", onLoad, true);
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(onLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoad(evt) {
|
function onLoad() {
|
||||||
gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
|
|
||||||
|
|
||||||
target = TargetFactory.forTab(gBrowser.selectedTab);
|
target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||||
|
|
||||||
is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");
|
is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");
|
||||||
|
@ -131,26 +131,22 @@ function* testTheBasics(widget) {
|
|||||||
*/
|
*/
|
||||||
function checkLinkClick(link) {
|
function checkLinkClick(link) {
|
||||||
|
|
||||||
function loadListener(e) {
|
function loadListener(tab) {
|
||||||
let tab = e.target;
|
|
||||||
var browser = getBrowser().getBrowserForTab(tab);
|
var browser = getBrowser().getBrowserForTab(tab);
|
||||||
var uri = browser.currentURI.spec;
|
var uri = browser.currentURI.spec;
|
||||||
// this is horrible, and it's because when we open a new tab
|
|
||||||
// "about:blank: is first loaded into it, before the actual
|
info("New browser tab has loaded");
|
||||||
// document we want to load.
|
gBrowser.removeTab(tab);
|
||||||
if (uri != "about:blank") {
|
info("Resolve promise with new tab URI");
|
||||||
info("New browser tab has loaded");
|
deferred.resolve(uri);
|
||||||
tab.removeEventListener("load", loadListener);
|
|
||||||
gBrowser.removeTab(tab);
|
|
||||||
info("Resolve promise with new tab URI");
|
|
||||||
deferred.resolve(uri);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function newTabListener(e) {
|
function newTabListener(e) {
|
||||||
gBrowser.tabContainer.removeEventListener("TabOpen", newTabListener);
|
gBrowser.tabContainer.removeEventListener("TabOpen", newTabListener);
|
||||||
var tab = e.target;
|
var tab = e.target;
|
||||||
tab.addEventListener("load", loadListener, false);
|
BrowserTestUtils.browserLoaded(tab.linkedBrowser, false,
|
||||||
|
url => { return url != "about:blank"; })
|
||||||
|
.then(url => loadListener(tab));
|
||||||
}
|
}
|
||||||
|
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
|
@ -27,17 +27,16 @@ function addTab(aURL, aCallback)
|
|||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
content.location = aURL;
|
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab;
|
let tab = gBrowser.selectedTab;
|
||||||
let browser = gBrowser.getBrowserForTab(tab);
|
let browser = gBrowser.getBrowserForTab(tab);
|
||||||
|
|
||||||
function onTabLoad() {
|
let url = encodeURI(aURL);
|
||||||
browser.removeEventListener("load", onTabLoad, true);
|
|
||||||
aCallback(browser, tab, browser.contentDocument);
|
|
||||||
}
|
|
||||||
|
|
||||||
browser.addEventListener("load", onTabLoad, true);
|
BrowserTestUtils.browserLoaded(browser, false, url).then(() => {
|
||||||
|
aCallback(browser, tab, browser.contentDocument);
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.loadURI(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseTab(aURL) {
|
function promiseTab(aURL) {
|
||||||
|
@ -123,12 +123,11 @@ var doc = null;
|
|||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
|
||||||
doc = content.document;
|
doc = content.document;
|
||||||
runTests();
|
runTests();
|
||||||
}, true);
|
});
|
||||||
content.location = TEST_URI;
|
gBrowser.loadURI(TEST_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTests() {
|
function runTests() {
|
||||||
|
@ -58,13 +58,11 @@ const TEST_URI = "data:text/html;charset=UTF-8," + encodeURIComponent(
|
|||||||
var doc = null;
|
var doc = null;
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
|
||||||
doc = content.document;
|
doc = content.document;
|
||||||
runTests();
|
runTests();
|
||||||
}, true);
|
});
|
||||||
content.location = TEST_URI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTests() {
|
function runTests() {
|
||||||
|
@ -1,31 +1,37 @@
|
|||||||
/* Make sure that netError won't allow HTML injection through badcert parameters. See bug 441169. */
|
/* Make sure that netError won't allow HTML injection through badcert parameters. See bug 441169. */
|
||||||
var newBrowser
|
var newBrowser
|
||||||
|
|
||||||
// An edited version of the standard neterror url which attempts to
|
function task() {
|
||||||
// insert a <span id="test_span"> tag into the text. We will navigate to this page
|
let resolve;
|
||||||
// and ensure that the span tag is not parsed as HTML.
|
let promise = new Promise(r => { resolve = r; });
|
||||||
var chromeURL = "about:neterror?e=nssBadCert&u=https%3A//test.kuix.de/&c=UTF-8&d=This%20sentence%20should%20not%20be%20parsed%20to%20include%20a%20%3Cspan%20id=%22test_span%22%3Enamed%3C/span%3E%20span%20tag.%0A%0AThe%20certificate%20is%20only%20valid%20for%20%3Ca%20id=%22cert_domain_link%22%20title=%22kuix.de%22%3Ekuix.de%3C/a%3E%0A%0A(Error%20code%3A%20ssl_error_bad_cert_domain)";
|
|
||||||
|
addEventListener("DOMContentLoaded", checkPage, false);
|
||||||
|
|
||||||
|
function checkPage(event) {
|
||||||
|
if (event.target != content.document) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
removeEventListener("DOMContentLoaded", checkPage, false);
|
||||||
|
|
||||||
|
is(content.document.getElementById("test_span"), null, "Error message should not be parsed as HTML, and hence shouldn't include the 'test_span' element.");
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
var chromeURL = "about:neterror?e=nssBadCert&u=https%3A//test.kuix.de/&c=UTF-8&d=This%20sentence%20should%20not%20be%20parsed%20to%20include%20a%20%3Cspan%20id=%22test_span%22%3Enamed%3C/span%3E%20span%20tag.%0A%0AThe%20certificate%20is%20only%20valid%20for%20%3Ca%20id=%22cert_domain_link%22%20title=%22kuix.de%22%3Ekuix.de%3C/a%3E%0A%0A(Error%20code%3A%20ssl_error_bad_cert_domain)";
|
||||||
|
content.location = chromeURL;
|
||||||
|
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
var newTab = gBrowser.addTab();
|
var newTab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = newTab;
|
gBrowser.selectedTab = newTab;
|
||||||
newBrowser = gBrowser.getBrowserForTab(newTab);
|
newBrowser = gBrowser.getBrowserForTab(newTab);
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", checkPage, false);
|
|
||||||
newBrowser.contentWindow.location = chromeURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkPage(event) {
|
ContentTask.spawn(newBrowser, null, task).then(() => {
|
||||||
if (event.target != gBrowser.selectedBrowser.contentDocument) {
|
gBrowser.removeCurrentTab();
|
||||||
return;
|
finish();
|
||||||
}
|
});
|
||||||
|
|
||||||
window.removeEventListener("DOMContentLoaded", checkPage, false);
|
|
||||||
|
|
||||||
is(newBrowser.contentDocument.getElementById("test_span"), null, "Error message should not be parsed as HTML, and hence shouldn't include the 'test_span' element.");
|
|
||||||
|
|
||||||
gBrowser.removeCurrentTab();
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,7 @@ function test() {
|
|||||||
let tab = gBrowser.addTab('http://example.com');
|
let tab = gBrowser.addTab('http://example.com');
|
||||||
let tabBrowser = tab.linkedBrowser;
|
let tabBrowser = tab.linkedBrowser;
|
||||||
|
|
||||||
tabBrowser.addEventListener('load', function(aEvent) {
|
BrowserTestUtils.browserLoaded(tab.linkedBrowser).then(() => {
|
||||||
tabBrowser.removeEventListener('load', arguments.callee, true);
|
|
||||||
|
|
||||||
let cw = tabBrowser.contentWindow;
|
let cw = tabBrowser.contentWindow;
|
||||||
let oldTitle = cw.document.title;
|
let oldTitle = cw.document.title;
|
||||||
ok(oldTitle, 'Content window should initially have a title.');
|
ok(oldTitle, 'Content window should initially have a title.');
|
||||||
@ -31,5 +29,5 @@ function test() {
|
|||||||
|
|
||||||
gBrowser.removeTab(tab);
|
gBrowser.removeTab(tab);
|
||||||
finish();
|
finish();
|
||||||
}, true);
|
});
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,9 @@ function runPass(getterFile, finishedCallback) {
|
|||||||
|
|
||||||
// First, set the cookie in a normal window.
|
// First, set the cookie in a normal window.
|
||||||
gBrowser.selectedTab = gBrowser.addTab(rootDir + "file_bug1108547-1.html");
|
gBrowser.selectedTab = gBrowser.addTab(rootDir + "file_bug1108547-1.html");
|
||||||
gBrowser.selectedBrowser.addEventListener("load", afterOpenCookieSetter, true);
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(afterOpenCookieSetter);
|
||||||
|
|
||||||
function afterOpenCookieSetter() {
|
function afterOpenCookieSetter() {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", afterOpenCookieSetter, true);
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
|
|
||||||
// Now, open a private window.
|
// Now, open a private window.
|
||||||
@ -47,18 +46,21 @@ function runPass(getterFile, finishedCallback) {
|
|||||||
privateWin.gBrowser.tabContainer.addEventListener("TabOpen", onNewTabOpened, true);
|
privateWin.gBrowser.tabContainer.addEventListener("TabOpen", onNewTabOpened, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fetchResult() {
|
||||||
|
return ContentTask.spawn(testBrowser, null, function() {
|
||||||
|
return content.document.getElementById("result").textContent;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function onNewTabOpened() {
|
function onNewTabOpened() {
|
||||||
// When the new tab is opened, wait for it to load.
|
// When the new tab is opened, wait for it to load.
|
||||||
privateWin.gBrowser.tabContainer.removeEventListener("TabOpen", onNewTabOpened, true);
|
privateWin.gBrowser.tabContainer.removeEventListener("TabOpen", onNewTabOpened, true);
|
||||||
privateWin.gBrowser.tabs[privateWin.gBrowser.tabs.length - 1].linkedBrowser.addEventListener("load", onNewTabLoaded, true);
|
BrowserTestUtils.browserLoaded(privateWin.gBrowser.tabs[privateWin.gBrowser.tabs.length - 1].linkedBrowser).then(fetchResult).then(onNewTabLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNewTabLoaded() {
|
function onNewTabLoaded(result) {
|
||||||
privateWin.gBrowser.tabs[privateWin.gBrowser.tabs.length - 1].linkedBrowser.removeEventListener("load", onNewTabLoaded, true);
|
|
||||||
|
|
||||||
// Now, ensure that the private tab doesn't have access to the cookie set in normal mode.
|
// Now, ensure that the private tab doesn't have access to the cookie set in normal mode.
|
||||||
is(testBrowser.contentDocument.getElementById("result").textContent, "",
|
is(result, "", "Shouldn't have access to the cookies");
|
||||||
"Shouldn't have access to the cookies");
|
|
||||||
|
|
||||||
// We're done with the private window, close it.
|
// We're done with the private window, close it.
|
||||||
privateWin.close();
|
privateWin.close();
|
||||||
@ -74,7 +76,7 @@ function runPass(getterFile, finishedCallback) {
|
|||||||
function afterPrivateWindowOpened2() {
|
function afterPrivateWindowOpened2() {
|
||||||
// In the private window, open the setter file, and wait for it to load.
|
// In the private window, open the setter file, and wait for it to load.
|
||||||
privateWin.gBrowser.selectedTab = privateWin.gBrowser.addTab(rootDir + "file_bug1108547-1.html");
|
privateWin.gBrowser.selectedTab = privateWin.gBrowser.addTab(rootDir + "file_bug1108547-1.html");
|
||||||
privateWin.gBrowser.selectedBrowser.addEventListener("load", afterOpenCookieSetter2, true);
|
BrowserTestUtils.browserLoaded(privateWin.gBrowser.selectedBrowser).then(afterOpenCookieSetter2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterOpenCookieSetter2() {
|
function afterOpenCookieSetter2() {
|
||||||
@ -90,15 +92,12 @@ function runPass(getterFile, finishedCallback) {
|
|||||||
function onNewTabOpened2() {
|
function onNewTabOpened2() {
|
||||||
// When the new tab is opened, wait for it to load.
|
// When the new tab is opened, wait for it to load.
|
||||||
gBrowser.tabContainer.removeEventListener("TabOpen", onNewTabOpened2, true);
|
gBrowser.tabContainer.removeEventListener("TabOpen", onNewTabOpened2, true);
|
||||||
gBrowser.tabs[gBrowser.tabs.length - 1].linkedBrowser.addEventListener("load", onNewTabLoaded2, true);
|
BrowserTestUtils.browserLoaded(gBrowser.tabs[gBrowser.tabs.length - 1].linkedBrowser).then(fetchResult).then(onNewTabLoaded2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNewTabLoaded2() {
|
function onNewTabLoaded2(result) {
|
||||||
gBrowser.tabs[gBrowser.tabs.length - 1].linkedBrowser.removeEventListener("load", onNewTabLoaded2, true);
|
|
||||||
|
|
||||||
// Now, ensure that the normal tab doesn't have access to the cookie set in private mode.
|
// Now, ensure that the normal tab doesn't have access to the cookie set in private mode.
|
||||||
is(testBrowser.contentDocument.getElementById("result").textContent, "",
|
is(result, "", "Shouldn't have access to the cookies");
|
||||||
"Shouldn't have access to the cookies");
|
|
||||||
|
|
||||||
// Remove both of the tabs opened here.
|
// Remove both of the tabs opened here.
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
|
@ -12,6 +12,18 @@ function forceRefresh() {
|
|||||||
EventUtils.synthesizeKey('R', { accelKey: true, shiftKey: true });
|
EventUtils.synthesizeKey('R', { accelKey: true, shiftKey: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function frameScript() {
|
||||||
|
function eventHandler(event) {
|
||||||
|
sendAsyncMessage("test:event", {type: event.type});
|
||||||
|
}
|
||||||
|
|
||||||
|
// These are tab-local, so no need to unregister them.
|
||||||
|
addEventListener('base-load', eventHandler, true, true);
|
||||||
|
addEventListener('base-register', eventHandler, true, true);
|
||||||
|
addEventListener('base-sw-ready', eventHandler, true, true);
|
||||||
|
addEventListener('cached-load', eventHandler, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
SpecialPowers.pushPrefEnv({'set': [['dom.serviceWorkers.enabled', true],
|
SpecialPowers.pushPrefEnv({'set': [['dom.serviceWorkers.enabled', true],
|
||||||
@ -21,24 +33,29 @@ function test() {
|
|||||||
['dom.caches.enabled', true]]},
|
['dom.caches.enabled', true]]},
|
||||||
function() {
|
function() {
|
||||||
var url = gTestRoot + 'browser_base_force_refresh.html';
|
var url = gTestRoot + 'browser_base_force_refresh.html';
|
||||||
var tab = gBrowser.addTab(url);
|
var tab = gBrowser.addTab();
|
||||||
gBrowser.selectedTab = tab;
|
gBrowser.selectedTab = tab;
|
||||||
|
|
||||||
|
tab.linkedBrowser.messageManager.loadFrameScript("data:,(" + encodeURIComponent(frameScript) + ")()", true);
|
||||||
|
gBrowser.loadURI(url);
|
||||||
|
|
||||||
var cachedLoad = false;
|
var cachedLoad = false;
|
||||||
|
|
||||||
function eventHandler(event) {
|
function eventHandler(msg) {
|
||||||
if (event.type === 'base-load') {
|
if (msg.data.type === 'base-load') {
|
||||||
if (cachedLoad) {
|
if (cachedLoad) {
|
||||||
|
tab.linkedBrowser.messageManager.removeMessageListener("test:event", eventHandler);
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
gBrowser.removeTab(tab);
|
||||||
executeSoon(finish);
|
executeSoon(finish);
|
||||||
}
|
}
|
||||||
} else if (event.type === 'base-register') {
|
} else if (msg.data.type === 'base-register') {
|
||||||
ok(!cachedLoad, 'cached load should not occur before base register');
|
ok(!cachedLoad, 'cached load should not occur before base register');
|
||||||
refresh();
|
refresh();
|
||||||
} else if (event.type === 'base-sw-ready') {
|
} else if (msg.data.type === 'base-sw-ready') {
|
||||||
ok(!cachedLoad, 'cached load should not occur before base ready');
|
ok(!cachedLoad, 'cached load should not occur before base ready');
|
||||||
refresh();
|
refresh();
|
||||||
} else if (event.type === 'cached-load') {
|
} else if (msg.data.type === 'cached-load') {
|
||||||
ok(!cachedLoad, 'cached load should not occur twice');
|
ok(!cachedLoad, 'cached load should not occur twice');
|
||||||
cachedLoad = true;
|
cachedLoad = true;
|
||||||
forceRefresh();
|
forceRefresh();
|
||||||
@ -47,9 +64,6 @@ function test() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addEventListener('base-load', eventHandler, true, true);
|
tab.linkedBrowser.messageManager.addMessageListener("test:event", eventHandler);
|
||||||
addEventListener('base-register', eventHandler, true, true);
|
|
||||||
addEventListener('base-sw-ready', eventHandler, true, true);
|
|
||||||
addEventListener('cached-load', eventHandler, true, true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,17 @@ var gWin;
|
|||||||
var gBrowser;
|
var gBrowser;
|
||||||
var ok, is, info;
|
var ok, is, info;
|
||||||
|
|
||||||
|
function removeTab(tab, done)
|
||||||
|
{
|
||||||
|
// Remove the tab in a different turn of the event loop. This way
|
||||||
|
// the nested event loop in removeTab doesn't conflict with the
|
||||||
|
// event listener shims.
|
||||||
|
gWin.setTimeout(() => {
|
||||||
|
gBrowser.removeTab(tab);
|
||||||
|
done();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure that the shims for window.content, browser.contentWindow,
|
// Make sure that the shims for window.content, browser.contentWindow,
|
||||||
// and browser.contentDocument are working.
|
// and browser.contentDocument are working.
|
||||||
function testContentWindow()
|
function testContentWindow()
|
||||||
@ -56,8 +67,7 @@ function testContentWindow()
|
|||||||
// FIXME: Waiting on bug 1073631.
|
// FIXME: Waiting on bug 1073631.
|
||||||
//is(browser.contentWindow.wrappedJSObject.global, 3, "global available on document");
|
//is(browser.contentWindow.wrappedJSObject.global, 3, "global available on document");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -108,8 +118,7 @@ function testListeners()
|
|||||||
is(event.target.documentURI, url2, "second load is for second page loaded");
|
is(event.target.documentURI, url2, "second load is for second page loaded");
|
||||||
is(loadWithRemoveCount, 1, "load handler is only called once");
|
is(loadWithRemoveCount, 1, "load handler is only called once");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
@ -162,8 +171,7 @@ function testCapturing()
|
|||||||
gBrowser.removeEventListener("mousedown", capturingHandler, true);
|
gBrowser.removeEventListener("mousedown", capturingHandler, true);
|
||||||
gBrowser.removeEventListener("mousedown", nonCapturingHandler, false);
|
gBrowser.removeEventListener("mousedown", nonCapturingHandler, false);
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -194,8 +202,7 @@ function testObserver()
|
|||||||
|
|
||||||
is(observerFired, 1, "got observer notification");
|
is(observerFired, 1, "got observer notification");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
@ -232,8 +239,7 @@ function testSandbox()
|
|||||||
is(browser.contentDocument.getElementById("output").innerHTML, "hello2",
|
is(browser.contentDocument.getElementById("output").innerHTML, "hello2",
|
||||||
"EP sandbox code ran successfully");
|
"EP sandbox code ran successfully");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
}, true);
|
}, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -255,10 +261,8 @@ function testAddonContent()
|
|||||||
let tab = gBrowser.addTab(url);
|
let tab = gBrowser.addTab(url);
|
||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
addLoadListener(browser, function handler() {
|
addLoadListener(browser, function handler() {
|
||||||
gBrowser.removeTab(tab);
|
|
||||||
res.setSubstitution("addonshim1", null);
|
res.setSubstitution("addonshim1", null);
|
||||||
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -501,9 +505,8 @@ function testAboutModuleRegistration()
|
|||||||
|
|
||||||
addLoadListener(browser, function() {
|
addLoadListener(browser, function() {
|
||||||
testAboutModulesWork(browser).then(() => {
|
testAboutModulesWork(browser).then(() => {
|
||||||
gBrowser.removeTab(newTab);
|
|
||||||
unregisterModules();
|
unregisterModules();
|
||||||
resolve();
|
removeTab(newTab, resolve);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -545,10 +548,9 @@ function testProgressListener()
|
|||||||
ok(sawGlobalLocChange, "Saw global onLocationChange");
|
ok(sawGlobalLocChange, "Saw global onLocationChange");
|
||||||
ok(sawTabsLocChange, "Saw tabs onLocationChange");
|
ok(sawTabsLocChange, "Saw tabs onLocationChange");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
|
||||||
gBrowser.removeProgressListener(globalListener);
|
gBrowser.removeProgressListener(globalListener);
|
||||||
gBrowser.removeTabsProgressListener(tabsListener);
|
gBrowser.removeTabsProgressListener(tabsListener);
|
||||||
resolve();
|
removeTab(tab, resolve);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -572,8 +574,7 @@ function testRootTreeItem()
|
|||||||
.getInterface(Components.interfaces.nsIDOMWindow);
|
.getInterface(Components.interfaces.nsIDOMWindow);
|
||||||
is(root, gWin, "got correct chrome window");
|
is(root, gWin, "got correct chrome window");
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -598,8 +599,7 @@ function testImportNode()
|
|||||||
is(result, node, "got expected import result");
|
is(result, node, "got expected import result");
|
||||||
}
|
}
|
||||||
|
|
||||||
gBrowser.removeTab(tab);
|
removeTab(tab, resolve);
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,82 +1,94 @@
|
|||||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
const ids = {
|
||||||
|
INPUT_ID: "input1",
|
||||||
|
FORM1_ID: "form1",
|
||||||
|
FORM2_ID: "form2",
|
||||||
|
CHANGE_INPUT_ID: "input2",
|
||||||
|
};
|
||||||
|
|
||||||
const INPUT_ID = "input1";
|
function task(ids) {
|
||||||
const FORM1_ID = "form1";
|
let resolve;
|
||||||
const FORM2_ID = "form2";
|
let promise = new Promise(r => { resolve = r; });
|
||||||
const CHANGE_INPUT_ID = "input2";
|
|
||||||
|
|
||||||
function test() {
|
function unexpectedContentEvent(evt) {
|
||||||
waitForExplicitFinish();
|
ok(false, "Received a " + evt.type + " event on content");
|
||||||
let tab = gBrowser.selectedTab =
|
}
|
||||||
gBrowser.addTab("data:text/html;charset=utf-8," +
|
|
||||||
"<html><body>" +
|
var gDoc = null;
|
||||||
"<form id='" + FORM1_ID + "'><input id='" + CHANGE_INPUT_ID + "'></form>" +
|
|
||||||
"<form id='" + FORM2_ID + "'></form>" +
|
addEventListener("load", tabLoad, true);
|
||||||
"</body></html>");
|
|
||||||
tab.linkedBrowser.addEventListener("load", tabLoad, true);
|
function tabLoad() {
|
||||||
|
if (content.location.href == "about:blank")
|
||||||
|
return;
|
||||||
|
removeEventListener("load", tabLoad, true);
|
||||||
|
|
||||||
|
gDoc = content.document;
|
||||||
|
gDoc.addEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
|
||||||
|
gDoc.defaultView.setTimeout(test_inputAdd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputAdd() {
|
||||||
|
addEventListener("DOMFormHasPassword", test_inputAddHandler, false);
|
||||||
|
let input = gDoc.createElementNS("http://www.w3.org/1999/xhtml", "input");
|
||||||
|
input.setAttribute("type", "password");
|
||||||
|
input.setAttribute("id", ids.INPUT_ID);
|
||||||
|
input.setAttribute("data-test", "unique-attribute");
|
||||||
|
gDoc.getElementById(ids.FORM1_ID).appendChild(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputAddHandler(evt) {
|
||||||
|
removeEventListener(evt.type, test_inputAddHandler, false);
|
||||||
|
is(evt.target.id, ids.FORM1_ID,
|
||||||
|
evt.type + " event targets correct form element (added password element)");
|
||||||
|
gDoc.defaultView.setTimeout(test_inputChangeForm, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputChangeForm() {
|
||||||
|
addEventListener("DOMFormHasPassword", test_inputChangeFormHandler, false);
|
||||||
|
let input = gDoc.getElementById(ids.INPUT_ID);
|
||||||
|
input.setAttribute("form", ids.FORM2_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputChangeFormHandler(evt) {
|
||||||
|
removeEventListener(evt.type, test_inputChangeFormHandler, false);
|
||||||
|
is(evt.target.id, ids.FORM2_ID,
|
||||||
|
evt.type + " event targets correct form element (changed form)");
|
||||||
|
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputChangesType() {
|
||||||
|
addEventListener("DOMFormHasPassword", test_inputChangesTypeHandler, false);
|
||||||
|
let input = gDoc.getElementById(ids.CHANGE_INPUT_ID);
|
||||||
|
input.setAttribute("type", "password");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputChangesTypeHandler(evt) {
|
||||||
|
removeEventListener(evt.type, test_inputChangesTypeHandler, false);
|
||||||
|
is(evt.target.id, ids.FORM1_ID,
|
||||||
|
evt.type + " event targets correct form element (changed type)");
|
||||||
|
gDoc.defaultView.setTimeout(finish, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function finish() {
|
||||||
|
gDoc.removeEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unexpectedContentEvent(evt) {
|
add_task(function* () {
|
||||||
ok(false, "Received a " + evt.type + " event on content");
|
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||||
}
|
|
||||||
|
|
||||||
var gDoc = null;
|
let promise = ContentTask.spawn(tab.linkedBrowser, ids, task);
|
||||||
|
tab.linkedBrowser.loadURI("data:text/html;charset=utf-8," +
|
||||||
|
"<html><body>" +
|
||||||
|
"<form id='" + ids.FORM1_ID + "'>" +
|
||||||
|
"<input id='" + ids.CHANGE_INPUT_ID + "'></form>" +
|
||||||
|
"<form id='" + ids.FORM2_ID + "'></form>" +
|
||||||
|
"</body></html>");
|
||||||
|
yield promise;
|
||||||
|
|
||||||
function tabLoad() {
|
|
||||||
let tab = gBrowser.selectedTab;
|
|
||||||
tab.linkedBrowser.removeEventListener("load", tabLoad, true);
|
|
||||||
gDoc = gBrowser.selectedBrowser.contentDocument;
|
|
||||||
// These events shouldn't escape to content.
|
|
||||||
gDoc.addEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
|
|
||||||
gDoc.defaultView.setTimeout(test_inputAdd, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputAdd() {
|
|
||||||
gBrowser.addEventListener("DOMFormHasPassword", test_inputAddHandler, false);
|
|
||||||
let input = gDoc.createElementNS(HTML_NS, "input");
|
|
||||||
input.setAttribute("type", "password");
|
|
||||||
input.setAttribute("id", INPUT_ID);
|
|
||||||
input.setAttribute("data-test", "unique-attribute");
|
|
||||||
gDoc.getElementById(FORM1_ID).appendChild(input);
|
|
||||||
info("Done appending the input element");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputAddHandler(evt) {
|
|
||||||
gBrowser.removeEventListener(evt.type, test_inputAddHandler, false);
|
|
||||||
is(evt.target.id, FORM1_ID,
|
|
||||||
evt.type + " event targets correct form element (added password element)");
|
|
||||||
gDoc.defaultView.setTimeout(test_inputChangeForm, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputChangeForm() {
|
|
||||||
gBrowser.addEventListener("DOMFormHasPassword", test_inputChangeFormHandler, false);
|
|
||||||
let input = gDoc.getElementById(INPUT_ID);
|
|
||||||
input.setAttribute("form", FORM2_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputChangeFormHandler(evt) {
|
|
||||||
gBrowser.removeEventListener(evt.type, test_inputChangeFormHandler, false);
|
|
||||||
is(evt.target.id, FORM2_ID,
|
|
||||||
evt.type + " event targets correct form element (changed form)");
|
|
||||||
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputChangesType() {
|
|
||||||
gBrowser.addEventListener("DOMFormHasPassword", test_inputChangesTypeHandler, false);
|
|
||||||
let input = gDoc.getElementById(CHANGE_INPUT_ID);
|
|
||||||
input.setAttribute("type", "password");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputChangesTypeHandler(evt) {
|
|
||||||
gBrowser.removeEventListener(evt.type, test_inputChangesTypeHandler, false);
|
|
||||||
is(evt.target.id, FORM1_ID,
|
|
||||||
evt.type + " event targets correct form element (changed type)");
|
|
||||||
gDoc.defaultView.setTimeout(completeTest, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function completeTest() {
|
|
||||||
ok(true, "Test completed");
|
ok(true, "Test completed");
|
||||||
gDoc.removeEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
});
|
||||||
}
|
|
||||||
|
@ -1,87 +1,99 @@
|
|||||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
const consts = {
|
||||||
|
HTML_NS: "http://www.w3.org/1999/xhtml",
|
||||||
|
|
||||||
const INPUT_ID = "input1";
|
INPUT_ID: "input1",
|
||||||
const FORM1_ID = "form1";
|
FORM1_ID: "form1",
|
||||||
const FORM2_ID = "form2";
|
FORM2_ID: "form2",
|
||||||
const CHANGE_INPUT_ID = "input2";
|
CHANGE_INPUT_ID: "input2",
|
||||||
const BODY_INPUT_ID = "input3";
|
BODY_INPUT_ID: "input3",
|
||||||
|
};
|
||||||
|
|
||||||
function test() {
|
function task(consts) {
|
||||||
waitForExplicitFinish();
|
let resolve;
|
||||||
let tab = gBrowser.selectedTab =
|
let promise = new Promise(r => { resolve = r; });
|
||||||
gBrowser.addTab("data:text/html;charset=utf-8," +
|
|
||||||
"<html><body>" +
|
function unexpectedContentEvent(evt) {
|
||||||
"<form id='" + FORM1_ID + "'><input id='" + CHANGE_INPUT_ID + "'></form>" +
|
ok(false, "Received a " + evt.type + " event on content");
|
||||||
"<form id='" + FORM2_ID + "'></form>" +
|
}
|
||||||
"</body></html>");
|
|
||||||
tab.linkedBrowser.addEventListener("load", tabLoad, true);
|
var gDoc = null;
|
||||||
|
|
||||||
|
addEventListener("load", tabLoad, true);
|
||||||
|
|
||||||
|
function tabLoad() {
|
||||||
|
removeEventListener("load", tabLoad, true);
|
||||||
|
gDoc = content.document;
|
||||||
|
// These events shouldn't escape to content.
|
||||||
|
gDoc.addEventListener("DOMInputPasswordAdded", unexpectedContentEvent, false);
|
||||||
|
gDoc.defaultView.setTimeout(test_inputAdd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputAdd() {
|
||||||
|
addEventListener("DOMInputPasswordAdded", test_inputAddHandler, false);
|
||||||
|
let input = gDoc.createElementNS(consts.HTML_NS, "input");
|
||||||
|
input.setAttribute("type", "password");
|
||||||
|
input.setAttribute("id", consts.INPUT_ID);
|
||||||
|
input.setAttribute("data-test", "unique-attribute");
|
||||||
|
gDoc.getElementById(consts.FORM1_ID).appendChild(input);
|
||||||
|
info("Done appending the input element");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputAddHandler(evt) {
|
||||||
|
removeEventListener(evt.type, test_inputAddHandler, false);
|
||||||
|
is(evt.target.id, consts.INPUT_ID,
|
||||||
|
evt.type + " event targets correct input element (added password element)");
|
||||||
|
gDoc.defaultView.setTimeout(test_inputAddOutsideForm, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputAddOutsideForm() {
|
||||||
|
addEventListener("DOMInputPasswordAdded", test_inputAddOutsideFormHandler, false);
|
||||||
|
let input = gDoc.createElementNS(consts.HTML_NS, "input");
|
||||||
|
input.setAttribute("type", "password");
|
||||||
|
input.setAttribute("id", consts.BODY_INPUT_ID);
|
||||||
|
input.setAttribute("data-test", "unique-attribute");
|
||||||
|
gDoc.body.appendChild(input);
|
||||||
|
info("Done appending the input element to the body");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputAddOutsideFormHandler(evt) {
|
||||||
|
removeEventListener(evt.type, test_inputAddOutsideFormHandler, false);
|
||||||
|
is(evt.target.id, consts.BODY_INPUT_ID,
|
||||||
|
evt.type + " event targets correct input element (added password element outside form)");
|
||||||
|
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputChangesType() {
|
||||||
|
addEventListener("DOMInputPasswordAdded", test_inputChangesTypeHandler, false);
|
||||||
|
let input = gDoc.getElementById(consts.CHANGE_INPUT_ID);
|
||||||
|
input.setAttribute("type", "password");
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_inputChangesTypeHandler(evt) {
|
||||||
|
removeEventListener(evt.type, test_inputChangesTypeHandler, false);
|
||||||
|
is(evt.target.id, consts.CHANGE_INPUT_ID,
|
||||||
|
evt.type + " event targets correct input element (changed type)");
|
||||||
|
gDoc.defaultView.setTimeout(completeTest, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function completeTest() {
|
||||||
|
ok(true, "Test completed");
|
||||||
|
gDoc.removeEventListener("DOMInputPasswordAdded", unexpectedContentEvent, false);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unexpectedContentEvent(evt) {
|
add_task(function* () {
|
||||||
ok(false, "Received a " + evt.type + " event on content");
|
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||||
}
|
let promise = ContentTask.spawn(tab.linkedBrowser, consts, task);
|
||||||
|
tab.linkedBrowser.loadURI("data:text/html;charset=utf-8," +
|
||||||
var gDoc = null;
|
"<html><body>" +
|
||||||
|
"<form id='" + consts.FORM1_ID + "'>" +
|
||||||
function tabLoad() {
|
"<input id='" + consts.CHANGE_INPUT_ID + "'></form>" +
|
||||||
let tab = gBrowser.selectedTab;
|
"<form id='" + consts.FORM2_ID + "'></form>" +
|
||||||
tab.linkedBrowser.removeEventListener("load", tabLoad, true);
|
"</body></html>");
|
||||||
gDoc = gBrowser.selectedBrowser.contentDocument;
|
yield promise;
|
||||||
// These events shouldn't escape to content.
|
|
||||||
gDoc.addEventListener("DOMInputPasswordAdded", unexpectedContentEvent, false);
|
|
||||||
gDoc.defaultView.setTimeout(test_inputAdd, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputAdd() {
|
|
||||||
gBrowser.addEventListener("DOMInputPasswordAdded", test_inputAddHandler, false);
|
|
||||||
let input = gDoc.createElementNS(HTML_NS, "input");
|
|
||||||
input.setAttribute("type", "password");
|
|
||||||
input.setAttribute("id", INPUT_ID);
|
|
||||||
input.setAttribute("data-test", "unique-attribute");
|
|
||||||
gDoc.getElementById(FORM1_ID).appendChild(input);
|
|
||||||
info("Done appending the input element");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputAddHandler(evt) {
|
|
||||||
gBrowser.removeEventListener(evt.type, test_inputAddHandler, false);
|
|
||||||
is(evt.target.id, INPUT_ID,
|
|
||||||
evt.type + " event targets correct input element (added password element)");
|
|
||||||
gDoc.defaultView.setTimeout(test_inputAddOutsideForm, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputAddOutsideForm() {
|
|
||||||
gBrowser.addEventListener("DOMInputPasswordAdded", test_inputAddOutsideFormHandler, false);
|
|
||||||
let input = gDoc.createElementNS(HTML_NS, "input");
|
|
||||||
input.setAttribute("type", "password");
|
|
||||||
input.setAttribute("id", BODY_INPUT_ID);
|
|
||||||
input.setAttribute("data-test", "unique-attribute");
|
|
||||||
gDoc.body.appendChild(input);
|
|
||||||
info("Done appending the input element to the body");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputAddOutsideFormHandler(evt) {
|
|
||||||
gBrowser.removeEventListener(evt.type, test_inputAddOutsideFormHandler, false);
|
|
||||||
is(evt.target.id, BODY_INPUT_ID,
|
|
||||||
evt.type + " event targets correct input element (added password element outside form)");
|
|
||||||
gDoc.defaultView.setTimeout(test_inputChangesType, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputChangesType() {
|
|
||||||
gBrowser.addEventListener("DOMInputPasswordAdded", test_inputChangesTypeHandler, false);
|
|
||||||
let input = gDoc.getElementById(CHANGE_INPUT_ID);
|
|
||||||
input.setAttribute("type", "password");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_inputChangesTypeHandler(evt) {
|
|
||||||
gBrowser.removeEventListener(evt.type, test_inputChangesTypeHandler, false);
|
|
||||||
is(evt.target.id, CHANGE_INPUT_ID,
|
|
||||||
evt.type + " event targets correct input element (changed type)");
|
|
||||||
gDoc.defaultView.setTimeout(completeTest, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function completeTest() {
|
|
||||||
ok(true, "Test completed");
|
|
||||||
gDoc.removeEventListener("DOMInputPasswordAdded", unexpectedContentEvent, false);
|
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
});
|
||||||
}
|
|
||||||
|
@ -2,15 +2,7 @@
|
|||||||
// Test whether setting a new property in InstallTrigger then persists to other
|
// Test whether setting a new property in InstallTrigger then persists to other
|
||||||
// page loads
|
// page loads
|
||||||
function loadURI(aUri, aCallback) {
|
function loadURI(aUri, aCallback) {
|
||||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, aUri).then(aCallback);
|
||||||
if (gBrowser.selectedBrowser.currentURI.spec != aUri)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
||||||
|
|
||||||
aCallback();
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
gBrowser.loadURI(aUri);
|
gBrowser.loadURI(aUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,20 +5,25 @@ function test() {
|
|||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
|
|
||||||
function loadListener() {
|
ContentTask.spawn(gBrowser.selectedBrowser, TESTROOT + "enabled.html", function (url) {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
|
return new Promise(resolve => {
|
||||||
gBrowser.contentWindow.addEventListener("PageLoaded", page_loaded, false);
|
function page_loaded() {
|
||||||
}
|
content.removeEventListener("PageLoaded", page_loaded, false);
|
||||||
|
resolve(content.document.getElementById("enabled").textContent);
|
||||||
|
}
|
||||||
|
|
||||||
gBrowser.selectedBrowser.addEventListener("load", loadListener, true);
|
function load_listener() {
|
||||||
gBrowser.loadURI(TESTROOT + "enabled.html");
|
removeEventListener("load", load_listener, true);
|
||||||
}
|
content.addEventListener("PageLoaded", page_loaded, false);
|
||||||
|
}
|
||||||
function page_loaded() {
|
|
||||||
gBrowser.contentWindow.removeEventListener("PageLoaded", page_loaded, false);
|
addEventListener("load", load_listener, true);
|
||||||
|
|
||||||
var doc = gBrowser.contentDocument;
|
content.location.href = url;
|
||||||
is(doc.getElementById("enabled").textContent, "true", "installTrigger should have been enabled");
|
});
|
||||||
gBrowser.removeCurrentTab();
|
}).then(text => {
|
||||||
finish();
|
is(text, "true", "installTrigger should have been enabled");
|
||||||
|
gBrowser.removeCurrentTab();
|
||||||
|
finish();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -7,21 +7,26 @@ function test() {
|
|||||||
|
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
|
|
||||||
function loadListener() {
|
ContentTask.spawn(gBrowser.selectedBrowser, TESTROOT + "enabled.html", function (url) {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
|
return new Promise(resolve => {
|
||||||
gBrowser.contentWindow.addEventListener("PageLoaded", page_loaded, false);
|
function page_loaded() {
|
||||||
}
|
content.removeEventListener("PageLoaded", page_loaded, false);
|
||||||
|
resolve(content.document.getElementById("enabled").textContent);
|
||||||
|
}
|
||||||
|
|
||||||
gBrowser.selectedBrowser.addEventListener("load", loadListener, true);
|
function load_listener() {
|
||||||
gBrowser.loadURI(TESTROOT + "enabled.html");
|
removeEventListener("load", load_listener, true);
|
||||||
}
|
content.addEventListener("PageLoaded", page_loaded, false);
|
||||||
|
}
|
||||||
function page_loaded() {
|
|
||||||
gBrowser.contentWindow.removeEventListener("PageLoaded", page_loaded, false);
|
addEventListener("load", load_listener, true);
|
||||||
Services.prefs.clearUserPref("xpinstall.enabled");
|
|
||||||
|
content.location.href = url;
|
||||||
var doc = gBrowser.contentDocument;
|
});
|
||||||
is(doc.getElementById("enabled").textContent, "false", "installTrigger should have not been enabled");
|
}).then(text => {
|
||||||
gBrowser.removeCurrentTab();
|
is(text, "false", "installTrigger should have not been enabled");
|
||||||
finish();
|
Services.prefs.clearUserPref("xpinstall.enabled");
|
||||||
|
gBrowser.removeCurrentTab();
|
||||||
|
finish();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,28 @@ function test() {
|
|||||||
}));
|
}));
|
||||||
gBrowser.selectedTab = gBrowser.addTab();
|
gBrowser.selectedTab = gBrowser.addTab();
|
||||||
|
|
||||||
function loadListener() {
|
ContentTask.spawn(gBrowser.selectedBrowser, TESTROOT + "installtrigger.html?" + triggers, url => {
|
||||||
gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
|
return new Promise(resolve => {
|
||||||
gBrowser.contentWindow.addEventListener("InstallTriggered", page_loaded, false);
|
function page_loaded() {
|
||||||
}
|
content.removeEventListener("PageLoaded", page_loaded, false);
|
||||||
|
resolve(content.document.getElementById("return").textContent);
|
||||||
|
}
|
||||||
|
|
||||||
gBrowser.selectedBrowser.addEventListener("load", loadListener, true);
|
function load_listener() {
|
||||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
removeEventListener("load", load_listener, true);
|
||||||
|
content.addEventListener("InstallTriggered", page_loaded, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventListener("load", load_listener, true);
|
||||||
|
|
||||||
|
content.location.href = url;
|
||||||
|
});
|
||||||
|
}).then(text => {
|
||||||
|
is(text, "false", "installTrigger should have not been enabled");
|
||||||
|
Services.prefs.clearUserPref("xpinstall.enabled");
|
||||||
|
gBrowser.removeCurrentTab();
|
||||||
|
Harness.finish();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_disabled(installInfo) {
|
function install_disabled(installInfo) {
|
||||||
@ -35,14 +50,3 @@ function confirm_install(window) {
|
|||||||
ok(false, "Should never see an install confirmation dialog");
|
ok(false, "Should never see an install confirmation dialog");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function page_loaded() {
|
|
||||||
gBrowser.contentWindow.removeEventListener("InstallTriggered", page_loaded, false);
|
|
||||||
Services.prefs.clearUserPref("xpinstall.enabled");
|
|
||||||
|
|
||||||
var doc = gBrowser.contentDocument;
|
|
||||||
is(doc.getElementById("return").textContent, "false", "installTrigger should have not been enabled");
|
|
||||||
gBrowser.removeCurrentTab();
|
|
||||||
Harness.finish();
|
|
||||||
}
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
@ -34,8 +34,9 @@ function finish_test(count) {
|
|||||||
info("Checking if the browser is still offline...");
|
info("Checking if the browser is still offline...");
|
||||||
|
|
||||||
let tab = gBrowser.selectedTab;
|
let tab = gBrowser.selectedTab;
|
||||||
tab.linkedBrowser.addEventListener("DOMContentLoaded", function errorLoad() {
|
ContentTask.spawn(tab.linkedBrowser, null, () => {
|
||||||
tab.linkedBrowser.removeEventListener("DOMContentLoaded", errorLoad, true);
|
return ContentTaskUtils.waitForEvent(this, "DOMContentLoaded", true);
|
||||||
|
}).then(() => {
|
||||||
let url = tab.linkedBrowser.contentDocument.documentURI;
|
let url = tab.linkedBrowser.contentDocument.documentURI;
|
||||||
info("loaded: " + url);
|
info("loaded: " + url);
|
||||||
if (/^about:neterror\?e=netOffline/.test(url)) {
|
if (/^about:neterror\?e=netOffline/.test(url)) {
|
||||||
@ -44,7 +45,7 @@ function finish_test(count) {
|
|||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
Harness.finish();
|
Harness.finish();
|
||||||
}
|
}
|
||||||
}, true);
|
});
|
||||||
tab.linkedBrowser.loadURI("http://example.com/");
|
tab.linkedBrowser.loadURI("http://example.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user