dom/indexedDB/test/browser_perwindow_privateBrowsing.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:929ccf89aae5
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
5
6 const testPageURL = "http://mochi.test:8888/browser/" +
7 "dom/indexedDB/test/browser_permissionsPrompt.html";
8 const notificationID = "indexedDB-permissions-prompt";
9
10 function test()
11 {
12 waitForExplicitFinish();
13 executeSoon(test1);
14 }
15
16 function test1()
17 {
18 gBrowser.selectedTab = gBrowser.addTab();
19 gBrowser.selectedBrowser.addEventListener("load", function () {
20 if (content.location != testPageURL) {
21 content.location = testPageURL;
22 return;
23 }
24 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
25
26 setFinishedCallback(function(result, exception) {
27 ok(result instanceof IDBDatabase,
28 "First database creation was successful");
29 ok(!exception, "No exception");
30 gBrowser.removeCurrentTab();
31
32 executeSoon(test2);
33 });
34 }, true);
35 content.location = testPageURL;
36 }
37
38 function test2()
39 {
40 var win = OpenBrowserWindow({private: true});
41 win.addEventListener("load", function onLoad() {
42 win.removeEventListener("load", onLoad, false);
43 executeSoon(function() test3(win));
44 }, false);
45 registerCleanupFunction(function() win.close());
46 }
47
48 function test3(win)
49 {
50 win.gBrowser.selectedTab = win.gBrowser.addTab();
51 win.gBrowser.selectedBrowser.addEventListener("load", function () {
52 if (win.content.location != testPageURL) {
53 win.content.location = testPageURL;
54 return;
55 }
56 win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
57
58 setFinishedCallback(function(result, exception) {
59 ok(!result, "No database");
60 is(exception, "InvalidStateError", "Correct exception");
61 win.gBrowser.removeCurrentTab();
62
63 executeSoon(finish);
64 }, win);
65 }, true);
66 win.content.location = testPageURL;
67 }

mercurial