dom/datastore/tests/file_event_receiver.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <meta charset="utf-8">
     5   <title>Test for DataStore - event receiver</title>
     6 </head>
     7 <body>
     8 <script type="application/javascript;version=1.7">
    10   function ok(a, msg) {
    11     alert((a ? 'OK' : 'KO') + ' ' + msg)
    12   }
    14   function is(a, b, msg) {
    15     ok(a === b, msg);
    16   }
    18   function cbError() {
    19     alert('KO error');
    20   }
    22   function finish() {
    23     alert('DONE');
    24   }
    26   function eventListener(evt) {
    27     ok(evt, "OnChangeListener is called with data");
    28     finish();
    29   }
    31   navigator.getDataStores('foo').then(function(stores) {
    32     is(stores.length, 1, "getDataStores('foo') returns 1 element");
    33     is(stores[0].name, 'foo', 'The dataStore.name is foo');
    34     is(stores[0].readOnly, false, 'The dataStore foo is not in readonly');
    36     var store = stores[0];
    37     store.onchange = eventListener;
    38     alert("READY");
    39   });
    41 </script>
    42 </body>
    43 </html>

mercurial