2010-12-30 10:04:24 -08:00
|
|
|
/**
|
|
|
|
* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*/
|
|
|
|
|
|
|
|
const testPageURL = "http://mochi.test:8888/browser/" +
|
|
|
|
"dom/indexedDB/test/browser_permissionsPrompt.html";
|
|
|
|
const notificationID = "indexedDB-permissions-prompt";
|
|
|
|
|
|
|
|
function test()
|
|
|
|
{
|
|
|
|
waitForExplicitFinish();
|
2011-01-10 16:09:56 -08:00
|
|
|
executeSoon(test1);
|
2010-12-30 10:04:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function test1()
|
|
|
|
{
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
|
|
|
|
setFinishedCallback(function(result, exception) {
|
|
|
|
ok(result instanceof Components.interfaces.nsIIDBDatabase,
|
|
|
|
"First database creation was successful");
|
|
|
|
ok(!exception, "No exception");
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
|
|
|
|
executeSoon(test2);
|
|
|
|
});
|
|
|
|
}, true);
|
|
|
|
content.location = testPageURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
function test2()
|
|
|
|
{
|
|
|
|
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
|
|
|
getService(Ci.nsIPrivateBrowsingService);
|
|
|
|
pb.privateBrowsingEnabled = true;
|
|
|
|
|
|
|
|
executeSoon(test3);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test3()
|
|
|
|
{
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
|
|
|
|
setFinishedCallback(function(result, exception) {
|
|
|
|
ok(!result, "No database");
|
2012-04-11 14:55:22 -07:00
|
|
|
is(exception, "InvalidStateError", "Correct exception");
|
2010-12-30 10:04:24 -08:00
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
|
|
|
|
executeSoon(test4);
|
|
|
|
});
|
|
|
|
}, true);
|
|
|
|
content.location = testPageURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
function test4()
|
|
|
|
{
|
|
|
|
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
|
|
|
getService(Ci.nsIPrivateBrowsingService);
|
|
|
|
pb.privateBrowsingEnabled = false;
|
|
|
|
|
|
|
|
executeSoon(finish);
|
|
|
|
}
|