dom/devicestorage/test/test_watch.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 var gFileName = randomFilename(20) + ".png"
    29 function addSuccess(e) {
    30 }
    32 function addError(e) {
    33   ok(false, "addError was called : " + e.target.error.name);
    34   devicestorage_cleanup();
    35 }
    37 function onChange(e) {
    39   dump("we saw: " + e.path + " " + e.reason + "\n");
    41   var filename = e.path;
    42   if (filename[0] == "/") {
    43     // We got /storageName/prefix/filename
    44     // Remove the storageName (this shows up on FirefoxOS)
    45     filename = filename.substring(1); // Remove leading slash
    46     var slashIndex = filename.indexOf("/");
    47     if (slashIndex >= 0) {
    48       filename = filename.substring(slashIndex + 1); // Remove storageName
    49     }
    50   }
    51   if (filename == gFileName) {
    52     ok(true, "we saw the file get created");
    53     storage.removeEventListener("change", onChange);
    54     devicestorage_cleanup();
    55   }
    56   else {
    57     // we may see other file changes during the test, and
    58     // that is completely ok
    59   }
    60 }
    62 var storage = navigator.getDeviceStorage("pictures");
    63 ok(storage, "Should have storage");
    64 storage.addEventListener("change", onChange);
    66 request = storage.addNamed(createRandomBlob('image/png'), gFileName);
    67 ok(request, "Should have a non-null request");
    69 request.onsuccess = addSuccess;
    70 request.onerror = addError;
    72 </script>
    73 </pre>
    74 </body>
    75 </html>

mercurial