dom/indexedDB/test/browser_perwindow_privateBrowsing.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /**
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 const testPageURL = "http://mochi.test:8888/browser/" +
     7   "dom/indexedDB/test/browser_permissionsPrompt.html";
     8 const notificationID = "indexedDB-permissions-prompt";
    10 function test()
    11 {
    12   waitForExplicitFinish();
    13   executeSoon(test1);
    14 }
    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);
    26     setFinishedCallback(function(result, exception) {
    27       ok(result instanceof IDBDatabase,
    28          "First database creation was successful");
    29       ok(!exception, "No exception");
    30       gBrowser.removeCurrentTab();
    32       executeSoon(test2);
    33     });
    34   }, true);
    35   content.location = testPageURL;
    36 }
    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 }
    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);
    58     setFinishedCallback(function(result, exception) {
    59       ok(!result, "No database");
    60       is(exception, "InvalidStateError", "Correct exception");
    61       win.gBrowser.removeCurrentTab();
    63       executeSoon(finish);
    64     }, win);
    65   }, true);
    66   win.content.location = testPageURL;
    67 }

mercurial