dom/tests/mochitest/localstorage/localStorageCommon.js

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 function localStorageFlush(cb)
     2 {
     3   var ob = {
     4     observe : function(sub, top, dat)
     5     {
     6       os().removeObserver(ob, "domstorage-test-flushed");
     7       cb();
     8     }
     9   };
    10   os().addObserver(ob, "domstorage-test-flushed", false);
    11   notify("domstorage-test-flush-force");
    12 }
    14 function localStorageReload()
    15 {
    16   notify("domstorage-test-reload");
    17 }
    19 function localStorageFlushAndReload(cb)
    20 {
    21   localStorageFlush(function() {
    22     localStorageReload();
    23     cb();
    24   });
    25 }
    27 function localStorageClearAll()
    28 {
    29   os().notifyObservers(null, "cookie-changed", "cleared");
    30 }
    32 function localStorageClearDomain(domain)
    33 {
    34   os().notifyObservers(null, "browser:purge-domain-data", domain);
    35 }
    37 function os()
    38 {
    39   return SpecialPowers.Services.obs;
    40 }
    42 function notify(top)
    43 {
    44   os().notifyObservers(null, top, null);
    45 }

mercurial