dom/tests/mochitest/localstorage/localStorageCommon.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:a94d4bd2d445
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 }
13
14 function localStorageReload()
15 {
16 notify("domstorage-test-reload");
17 }
18
19 function localStorageFlushAndReload(cb)
20 {
21 localStorageFlush(function() {
22 localStorageReload();
23 cb();
24 });
25 }
26
27 function localStorageClearAll()
28 {
29 os().notifyObservers(null, "cookie-changed", "cleared");
30 }
31
32 function localStorageClearDomain(domain)
33 {
34 os().notifyObservers(null, "browser:purge-domain-data", domain);
35 }
36
37 function os()
38 {
39 return SpecialPowers.Services.obs;
40 }
41
42 function notify(top)
43 {
44 os().notifyObservers(null, top, null);
45 }

mercurial