Bug 1220748 - Enable browser_permissionsPromptDeny.js in e10s, r=felipe.

This commit is contained in:
Florian Quèze 2016-02-29 11:44:49 +01:00
Родитель 7f956c0bfb
Коммит 7d8de4e227
3 изменённых файлов: 107 добавлений и 107 удалений

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

@ -16,7 +16,6 @@ support-files =
[browser_forgetThisSite.js]
[browser_permissionsPromptAllow.js]
[browser_permissionsPromptDeny.js]
skip-if = e10s # bug 1220748 - Attempts to touch content docshell to set usePrivateBrowsing.
[browser_permissionsPromptWorker.js]
[browser_perwindow_privateBrowsing.js]
[browser_bug839193.js]

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

@ -8,11 +8,6 @@ var testGenerator = testSteps();
var testResult;
var testException;
function testFinishedCallback(result, exception)
{
throw new Error("Bad testFinishedCallback!");
}
function runTest()
{
testGenerator.next();
@ -29,7 +24,18 @@ function finishTestNow()
function finishTest()
{
setTimeout(finishTestNow, 0);
setTimeout(testFinishedCallback, 0, testResult, testException);
setTimeout(() => {
if (window.testFinishedCallback)
window.testFinishedCallback(testResult, testException);
else {
let message;
if (testResult)
message = "ok";
else
message = testException;
window.parent.postMessage(message, "*");
}
}, 0);
}
function grabEventAndContinueHandler(event)

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

@ -7,118 +7,113 @@ const testPageURL = "http://mochi.test:8888/browser/" +
"dom/indexedDB/test/browser_permissionsPrompt.html";
const notificationID = "indexedDB-permissions-prompt";
function test()
{
waitForExplicitFinish();
// We want the prompt.
function setUsePrivateBrowsing(browser, val) {
if (!browser.isRemoteBrowser) {
browser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = val;
return;
}
return ContentTask.spawn(browser, val, function* (val) {
docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = val;
});
};
function promiseMessage(aMessage) {
return new Promise(function(resolve, reject) {
content.addEventListener("message", function messageListener(event) {
content.removeEventListener("message", messageListener);
is(event.data, aMessage, "received " + aMessage);
if (event.data == aMessage)
resolve();
else
reject();
});
});
}
add_task(function test1() {
removePermission(testPageURL, "indexedDB");
executeSoon(test1);
}
function test1()
{
info("creating tab");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(!result, "No database created");
is(exception, "InvalidStateError", "Correct exception");
is(getPermission(testPageURL, "indexedDB"),
Components.interfaces.nsIPermissionManager.DENY_ACTION,
"Correct permission set");
gBrowser.removeCurrentTab();
executeSoon(test2);
});
registerPopupEventHandler("popupshowing", function () {
ok(true, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
ok(true, "prompt shown");
triggerSecondaryCommand(this, 0);
});
registerPopupEventHandler("popuphidden", function () {
ok(true, "prompt hidden");
});
}, true);
info("loading test page: " + testPageURL);
content.location = testPageURL;
}
gBrowser.selectedBrowser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
function test2()
{
info("creating tab");
registerPopupEventHandler("popupshowing", function () {
ok(true, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
ok(true, "prompt shown");
triggerSecondaryCommand(this, 0);
});
registerPopupEventHandler("popuphidden", function () {
ok(true, "prompt hidden");
});
yield promiseMessage("InvalidStateError");
is(getPermission(testPageURL, "indexedDB"),
Components.interfaces.nsIPermissionManager.DENY_ACTION,
"Correct permission set");
gBrowser.removeCurrentTab();
});
add_task(function test2() {
info("creating private tab");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(!result, "No database created");
is(exception, "InvalidStateError", "Correct exception");
is(getPermission(testPageURL, "indexedDB"),
Components.interfaces.nsIPermissionManager.DENY_ACTION,
"Correct permission set");
gBrowser.selectedBrowser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
unregisterAllPopupEventHandlers();
gBrowser.removeCurrentTab();
executeSoon(test3);
});
registerPopupEventHandler("popupshowing", function () {
ok(false, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
ok(false, "prompt shown");
});
registerPopupEventHandler("popuphidden", function () {
ok(false, "prompt hidden");
});
}, true);
yield setUsePrivateBrowsing(gBrowser.selectedBrowser, true);
info("loading test page: " + testPageURL);
content.location = testPageURL;
}
gBrowser.selectedBrowser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
function test3()
{
registerPopupEventHandler("popupshowing", function () {
ok(false, "prompt showing");
});
registerPopupEventHandler("popupshown", function () {
ok(false, "prompt shown");
});
registerPopupEventHandler("popuphidden", function () {
ok(false, "prompt hidden");
});
yield promiseMessage("InvalidStateError");
is(getPermission(testPageURL, "indexedDB"),
Components.interfaces.nsIPermissionManager.DENY_ACTION,
"Correct permission set");
unregisterAllPopupEventHandlers();
yield setUsePrivateBrowsing(gBrowser.selectedBrowser, false);
gBrowser.removeCurrentTab();
});
add_task(function test3() {
info("creating tab");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(!result, "No database created");
is(exception, "InvalidStateError", "Correct exception");
is(getPermission(testPageURL, "indexedDB"),
Components.interfaces.nsIPermissionManager.DENY_ACTION,
"Correct permission set");
gBrowser.removeCurrentTab();
unregisterAllPopupEventHandlers();
removePermission(testPageURL, "indexedDB");
executeSoon(finish);
});
registerPopupEventHandler("popupshowing", function () {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popupshown", function () {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popuphidden", function () {
ok(false, "Shouldn't show a popup this time");
});
}, true);
info("loading test page: " + testPageURL);
content.location = testPageURL;
}
gBrowser.selectedBrowser.loadURI(testPageURL);
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
registerPopupEventHandler("popupshowing", function () {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popupshown", function () {
ok(false, "Shouldn't show a popup this time");
});
registerPopupEventHandler("popuphidden", function () {
ok(false, "Shouldn't show a popup this time");
});
yield promiseMessage("InvalidStateError");
is(getPermission(testPageURL, "indexedDB"),
Components.interfaces.nsIPermissionManager.DENY_ACTION,
"Correct permission set");
gBrowser.removeCurrentTab();
unregisterAllPopupEventHandlers();
removePermission(testPageURL, "indexedDB");
});