summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/localstorage/localStorageCommon.js
blob: 5ca4140679e963f547b12408b0910161a8784895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function localStorageFlush(cb)
{
  var ob = {
    observe : function(sub, top, dat)
    {
      os().removeObserver(ob, "domstorage-test-flushed");
      cb();
    }
  };
  os().addObserver(ob, "domstorage-test-flushed", false);
  notify("domstorage-test-flush-force");
}

function localStorageReload()
{
  notify("domstorage-test-reload");
}

function localStorageFlushAndReload(cb)
{
  localStorageFlush(function() {
    localStorageReload();
    cb();
  });
}

function localStorageClearAll()
{
  os().notifyObservers(null, "cookie-changed", "cleared");
}

function localStorageClearDomain(domain)
{
  os().notifyObservers(null, "browser:purge-domain-data", domain);
}

function os()
{
  return SpecialPowers.Services.obs;
}

function notify(top)
{
  os().notifyObservers(null, top, null);
}