dom/datastore/tests/file_changes2.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <meta charset="utf-8">
     5   <title>Test for DataStore - basic operation on a readonly db</title>
     6 </head>
     7 <body>
     8 <p id="display"></p>
     9 <div id="content" style="display: none">
    11 </div>
    12 <pre id="test">
    13   <script type="application/javascript;version=1.7">
    15   function is(a, b, msg) {
    16     alert((a === b ? 'OK' : 'KO') + ' ' + msg)
    17   }
    19   function ok(a, msg) {
    20     alert((a ? 'OK' : 'KO')+ ' ' + msg)
    21   }
    23   function cbError() {
    24     alert('KO error');
    25   }
    27   function finish() {
    28     alert('DONE');
    29   }
    31   function eventListener(obj) {
    32     ok(obj, "OnChangeListener is called with data");
    33     ok("revisionId" in obj, "the event contains a revisionId");
    34     ok("id" in obj, "the event contains a id");
    35     ok("operation" in obj, "the event contains a operation");
    36     ok("owner" in obj, "the event contains a owner");
    37     is(obj.owner, 'http://test/tests/dom/datastore/tests/file_app.sjs?testToken=file_changes.html', 'Owner matches');
    38     finish();
    39   }
    41   navigator.getDataStores('foo').then(function(stores) {
    42     is(stores.length, 1, "getDataStores('foo') returns 1 element");
    43     is(stores[0].name, 'foo', 'The dataStore.name is foo');
    45     stores[0].onchange = eventListener;
    46     alert('READY');
    47   });
    48   </script>
    49 </pre>
    50 </body>
    51 </html>

mercurial