2012-11-09 00:30:48 +04: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();
|
2014-11-28 11:44:12 +03:00
|
|
|
// Avoids the actual prompt
|
|
|
|
setPermission(testPageURL, "indexedDB");
|
2012-11-09 00:30:48 +04:00
|
|
|
executeSoon(test1);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test1()
|
|
|
|
{
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function () {
|
2013-12-14 16:32:08 +04:00
|
|
|
if (content.location != testPageURL) {
|
|
|
|
content.location = testPageURL;
|
|
|
|
return;
|
|
|
|
}
|
2012-11-09 00:30:48 +04:00
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
|
2016-10-19 05:55:12 +03:00
|
|
|
setFinishedCallback(function(isIDBDatabase, exception) {
|
|
|
|
ok(isIDBDatabase,
|
2012-11-09 00:30:48 +04:00
|
|
|
"First database creation was successful");
|
|
|
|
ok(!exception, "No exception");
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
|
|
|
|
executeSoon(test2);
|
|
|
|
});
|
|
|
|
}, true);
|
|
|
|
content.location = testPageURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
function test2()
|
|
|
|
{
|
|
|
|
var win = OpenBrowserWindow({private: true});
|
2017-01-25 09:01:52 +03:00
|
|
|
win.addEventListener("load", function() {
|
2015-09-23 12:39:14 +03:00
|
|
|
executeSoon(() => test3(win));
|
2017-01-25 09:01:52 +03:00
|
|
|
}, {once: true});
|
2015-09-23 12:39:14 +03:00
|
|
|
registerCleanupFunction(() => win.close());
|
2012-11-09 00:30:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
function test3(win)
|
|
|
|
{
|
|
|
|
win.gBrowser.selectedTab = win.gBrowser.addTab();
|
|
|
|
win.gBrowser.selectedBrowser.addEventListener("load", function () {
|
2013-12-14 16:32:08 +04:00
|
|
|
if (win.content.location != testPageURL) {
|
|
|
|
win.content.location = testPageURL;
|
|
|
|
return;
|
|
|
|
}
|
2012-11-09 00:30:48 +04:00
|
|
|
win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
|
2016-10-19 05:55:12 +03:00
|
|
|
setFinishedCallback(function(isIDBDatabase, exception) {
|
|
|
|
ok(!isIDBDatabase, "No database");
|
2012-11-09 00:30:48 +04:00
|
|
|
is(exception, "InvalidStateError", "Correct exception");
|
|
|
|
win.gBrowser.removeCurrentTab();
|
|
|
|
|
|
|
|
executeSoon(finish);
|
|
|
|
}, win);
|
|
|
|
}, true);
|
|
|
|
win.content.location = testPageURL;
|
|
|
|
}
|