dom/devicestorage/test/test_freeSpace.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=717103
     8 -->
     9 <head>
    10   <title>Test for the device storage API </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=717103">Mozilla Bug 717103</a>
    18 <p id="display"></p>
    19 <div id="content" style="display: none">
    21 </div>
    22 <pre id="test">
    23 <script class="testbody" type="text/javascript">
    25 devicestorage_setup();
    27 function freeSpaceSuccess(e) {
    28   ok(e.target.result  > 0, "free bytes should exist and be greater than zero");
    29   devicestorage_cleanup();
    30 }
    32 function freeSpaceError(e) {
    33   ok(false, "freeSpaceError was called");
    34   devicestorage_cleanup();
    35 }
    37 var storage = navigator.getDeviceStorage("pictures");
    39 function addError(e) {
    40   ok(false, "addError was called : " + e.target.error.name);
    41   devicestorage_cleanup();
    42 }
    44 function addSuccess(e) {
    45   request = storage.freeSpace();
    46   ok(request, "Should have a non-null request");
    48   request.onsuccess = freeSpaceSuccess;
    49   request.onerror = freeSpaceError;
    50 }
    52 var prefix = "devicestorage/" + randomFilename(12);
    53 request = storage.addNamed(createRandomBlob('image/png'), prefix + "/a/b.png");
    54 request.onsuccess = addSuccess;
    55 request.onerror = addError;
    57 </script>
    58 </pre>
    59 </body>
    60 </html>

mercurial