1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/test/browser_perwindow_privateBrowsing.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/** 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 + 1.9 +const testPageURL = "http://mochi.test:8888/browser/" + 1.10 + "dom/indexedDB/test/browser_permissionsPrompt.html"; 1.11 +const notificationID = "indexedDB-permissions-prompt"; 1.12 + 1.13 +function test() 1.14 +{ 1.15 + waitForExplicitFinish(); 1.16 + executeSoon(test1); 1.17 +} 1.18 + 1.19 +function test1() 1.20 +{ 1.21 + gBrowser.selectedTab = gBrowser.addTab(); 1.22 + gBrowser.selectedBrowser.addEventListener("load", function () { 1.23 + if (content.location != testPageURL) { 1.24 + content.location = testPageURL; 1.25 + return; 1.26 + } 1.27 + gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); 1.28 + 1.29 + setFinishedCallback(function(result, exception) { 1.30 + ok(result instanceof IDBDatabase, 1.31 + "First database creation was successful"); 1.32 + ok(!exception, "No exception"); 1.33 + gBrowser.removeCurrentTab(); 1.34 + 1.35 + executeSoon(test2); 1.36 + }); 1.37 + }, true); 1.38 + content.location = testPageURL; 1.39 +} 1.40 + 1.41 +function test2() 1.42 +{ 1.43 + var win = OpenBrowserWindow({private: true}); 1.44 + win.addEventListener("load", function onLoad() { 1.45 + win.removeEventListener("load", onLoad, false); 1.46 + executeSoon(function() test3(win)); 1.47 + }, false); 1.48 + registerCleanupFunction(function() win.close()); 1.49 +} 1.50 + 1.51 +function test3(win) 1.52 +{ 1.53 + win.gBrowser.selectedTab = win.gBrowser.addTab(); 1.54 + win.gBrowser.selectedBrowser.addEventListener("load", function () { 1.55 + if (win.content.location != testPageURL) { 1.56 + win.content.location = testPageURL; 1.57 + return; 1.58 + } 1.59 + win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); 1.60 + 1.61 + setFinishedCallback(function(result, exception) { 1.62 + ok(!result, "No database"); 1.63 + is(exception, "InvalidStateError", "Correct exception"); 1.64 + win.gBrowser.removeCurrentTab(); 1.65 + 1.66 + executeSoon(finish); 1.67 + }, win); 1.68 + }, true); 1.69 + win.content.location = testPageURL; 1.70 +}