dom/devicestorage/test/test_fs_basic.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!--
     2   Any copyright is dedicated to the Public Domain.
     3   http://creativecommons.org/publicdomain/zero/1.0/
     4 -->
     5 <!DOCTYPE HTML>
     6 <html> <!--
     7 https://bugzilla.mozilla.org/show_bug.cgi?id=910412
     8 -->
     9 <head>
    10   <title>Test for the FileSystem API for device storage</title>
    11   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    12   <script type="text/javascript" src="devicestorage_common.js"></script>
    14 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    15 </head>
    16 <body>
    17 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=910412">Mozilla Bug 910412</a>
    18 <p id="display"></p>
    19 <div id="content" style="display: none">
    20 </div>
    21 <pre id="test">
    22 <script class="testbody" type="text/javascript">
    24 devicestorage_setup();
    26 var gFileName = randomFilename(12);
    28 // The root directory object.
    29 var gRoot;
    31 function getRootSuccess(r) {
    32   ok(r && r.name === storage.storageName, "Failed to get the root directory.");
    34   gRoot = r;
    36   // Create a new directory under the root.
    37   gRoot.createDirectory(gFileName).then(createDirectorySuccess, cbError);
    38 }
    40 function createDirectorySuccess(d) {
    41   ok(d.name === gFileName, "Failed to create directory: name mismatch.");
    43   // Get the new created directory from the root.
    44   gRoot.get(gFileName).then(getSuccess, cbError);
    45 }
    47 function getSuccess(d) {
    48   ok(d.name === gFileName, "Should get directory - " + gFileName + ".");
    49   devicestorage_cleanup();
    50 }
    52 function cbError(e) {
    53   ok(false,  "Should not arrive here! Error: " + e.name);
    54   devicestorage_cleanup();
    55 }
    57 ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
    59 var storage = navigator.getDeviceStorage("pictures");
    60 ok(storage, "Should have gotten a storage");
    62 var promise = storage.getRoot();
    63 ok(promise, "Should have a non-null promise");
    65 promise.then(getRootSuccess, cbError);
    66 </script>
    67 </pre>
    68 </body>
    69 </html>

mercurial