1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
const domains = [
"mochi.test:8888",
"www.example.com"
];
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;
function test()
{
requestLongerTimeout(2);
waitForExplicitFinish();
// Avoids the prompt
setPermission(testPageURL1, "indexedDB");
setPermission(testPageURL2, "indexedDB");
executeSoon(test1);
}
function test1()
{
// Set database version for domain 1
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == 11, "Set version on database in " + testPageURL1);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(test2);
});
}, true);
content.location = testPageURL1;
}
function test2()
{
// Set database version for domain 2
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == 11, "Set version on database in " + testPageURL2);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(test3);
});
}, true);
content.location = testPageURL2;
}
function test3()
{
// Remove database from domain 2
ForgetAboutSite.removeDataFromDomain(domains[1]);
setPermission(testPageURL4, "indexedDB");
executeSoon(test4);
}
function test4()
{
// Get database version for domain 1
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == 11, "Got correct version on database in " + testPageURL3);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(test5);
});
}, true);
content.location = testPageURL3;
}
function test5()
{
// Get database version for domain 2
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
setFinishedCallback(function(result, exception) {
ok(result == 1, "Got correct version on database in " + testPageURL4);
ok(!exception, "No exception");
gBrowser.removeCurrentTab();
executeSoon(finish);
});
}, true);
content.location = testPageURL4;
}
|