From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../test/browser_perwindow_privateBrowsing.js | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 dom/indexedDB/test/browser_perwindow_privateBrowsing.js (limited to 'dom/indexedDB/test/browser_perwindow_privateBrowsing.js') diff --git a/dom/indexedDB/test/browser_perwindow_privateBrowsing.js b/dom/indexedDB/test/browser_perwindow_privateBrowsing.js new file mode 100644 index 000000000..08d329cbc --- /dev/null +++ b/dom/indexedDB/test/browser_perwindow_privateBrowsing.js @@ -0,0 +1,69 @@ +/** + * 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(); + // Avoids the actual prompt + setPermission(testPageURL, "indexedDB"); + executeSoon(test1); +} + +function test1() +{ + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.selectedBrowser.addEventListener("load", function () { + if (content.location != testPageURL) { + content.location = testPageURL; + return; + } + gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); + + setFinishedCallback(function(isIDBDatabase, exception) { + ok(isIDBDatabase, + "First database creation was successful"); + ok(!exception, "No exception"); + gBrowser.removeCurrentTab(); + + executeSoon(test2); + }); + }, true); + content.location = testPageURL; +} + +function test2() +{ + var win = OpenBrowserWindow({private: true}); + win.addEventListener("load", function onLoad() { + win.removeEventListener("load", onLoad, false); + executeSoon(() => test3(win)); + }, false); + registerCleanupFunction(() => win.close()); +} + +function test3(win) +{ + win.gBrowser.selectedTab = win.gBrowser.addTab(); + win.gBrowser.selectedBrowser.addEventListener("load", function () { + if (win.content.location != testPageURL) { + win.content.location = testPageURL; + return; + } + win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); + + setFinishedCallback(function(isIDBDatabase, exception) { + ok(!isIDBDatabase, "No database"); + is(exception, "InvalidStateError", "Correct exception"); + win.gBrowser.removeCurrentTab(); + + executeSoon(finish); + }, win); + }, true); + win.content.location = testPageURL; +} -- cgit v1.2.3