2011-01-11 03:09:56 +03:00
|
|
|
/**
|
|
|
|
* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*/
|
|
|
|
|
2018-03-12 20:43:35 +03:00
|
|
|
let {ForgetAboutSite} = ChromeUtils.import("resource://gre/modules/ForgetAboutSite.jsm", {});
|
2012-10-03 19:29:10 +04:00
|
|
|
|
2011-01-11 03:09:56 +03:00
|
|
|
const domains = [
|
|
|
|
"mochi.test:8888",
|
2018-10-19 15:55:39 +03:00
|
|
|
"www.example.com",
|
2011-01-11 03:09:56 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
const addPath = "/browser/dom/indexedDB/test/browser_forgetThisSiteAdd.html";
|
|
|
|
const getPath = "/browser/dom/indexedDB/test/browser_forgetThisSiteGet.html";
|
|
|
|
|
|
|
|
const testPageURL1 = "http://" + domains[0] + addPath;
|
|
|
|
const testPageURL2 = "http://" + domains[1] + addPath;
|
|
|
|
const testPageURL3 = "http://" + domains[0] + getPath;
|
|
|
|
const testPageURL4 = "http://" + domains[1] + getPath;
|
|
|
|
|
2017-07-20 10:10:30 +03:00
|
|
|
add_task(async function test1() {
|
2014-03-30 17:59:07 +04:00
|
|
|
requestLongerTimeout(2);
|
2011-01-11 03:09:56 +03:00
|
|
|
// Avoids the prompt
|
2014-11-28 11:44:12 +03:00
|
|
|
setPermission(testPageURL1, "indexedDB");
|
|
|
|
setPermission(testPageURL2, "indexedDB");
|
2011-01-11 03:09:56 +03:00
|
|
|
|
|
|
|
// Set database version for domain 1
|
2017-05-15 22:49:50 +03:00
|
|
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
2018-08-29 17:47:29 +03:00
|
|
|
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testPageURL1);
|
2017-07-20 10:10:30 +03:00
|
|
|
await waitForMessage(11, gBrowser);
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
});
|
2011-01-11 03:09:56 +03:00
|
|
|
|
2017-07-20 10:10:30 +03:00
|
|
|
add_task(async function test2() {
|
2011-01-11 03:09:56 +03:00
|
|
|
// Set database version for domain 2
|
2017-05-15 22:49:50 +03:00
|
|
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
2018-08-29 17:47:29 +03:00
|
|
|
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testPageURL2);
|
2017-07-20 10:10:30 +03:00
|
|
|
await waitForMessage(11, gBrowser);
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
});
|
2011-01-11 03:09:56 +03:00
|
|
|
|
2017-07-20 10:10:30 +03:00
|
|
|
add_task(async function test3() {
|
2011-01-11 03:09:56 +03:00
|
|
|
// Remove database from domain 2
|
2017-03-17 11:59:48 +03:00
|
|
|
ForgetAboutSite.removeDataFromDomain(domains[1]).then(() => {
|
|
|
|
setPermission(testPageURL4, "indexedDB");
|
|
|
|
});
|
2017-07-20 10:10:30 +03:00
|
|
|
});
|
2011-01-11 03:09:56 +03:00
|
|
|
|
2017-07-20 10:10:30 +03:00
|
|
|
add_task(async function test4() {
|
2011-01-11 03:09:56 +03:00
|
|
|
// Get database version for domain 1
|
2017-05-15 22:49:50 +03:00
|
|
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
2018-08-29 17:47:29 +03:00
|
|
|
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testPageURL3);
|
2017-07-20 10:10:30 +03:00
|
|
|
await waitForMessage(11, gBrowser);
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
});
|
2011-01-11 03:09:56 +03:00
|
|
|
|
2017-07-20 10:10:30 +03:00
|
|
|
add_task(async function test5() {
|
2011-01-11 03:09:56 +03:00
|
|
|
// Get database version for domain 2
|
2017-05-15 22:49:50 +03:00
|
|
|
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
2018-08-29 17:47:29 +03:00
|
|
|
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, testPageURL4);
|
2017-07-20 10:10:30 +03:00
|
|
|
await waitForMessage(1, gBrowser);
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
});
|