michael@0: function localStorageFlush(cb) michael@0: { michael@0: var ob = { michael@0: observe : function(sub, top, dat) michael@0: { michael@0: os().removeObserver(ob, "domstorage-test-flushed"); michael@0: cb(); michael@0: } michael@0: }; michael@0: os().addObserver(ob, "domstorage-test-flushed", false); michael@0: notify("domstorage-test-flush-force"); michael@0: } michael@0: michael@0: function localStorageReload() michael@0: { michael@0: notify("domstorage-test-reload"); michael@0: } michael@0: michael@0: function localStorageFlushAndReload(cb) michael@0: { michael@0: localStorageFlush(function() { michael@0: localStorageReload(); michael@0: cb(); michael@0: }); michael@0: } michael@0: michael@0: function localStorageClearAll() michael@0: { michael@0: os().notifyObservers(null, "cookie-changed", "cleared"); michael@0: } michael@0: michael@0: function localStorageClearDomain(domain) michael@0: { michael@0: os().notifyObservers(null, "browser:purge-domain-data", domain); michael@0: } michael@0: michael@0: function os() michael@0: { michael@0: return SpecialPowers.Services.obs; michael@0: } michael@0: michael@0: function notify(top) michael@0: { michael@0: os().notifyObservers(null, top, null); michael@0: }