41 let ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].getService(
Ci.nsISessionStore);
42 let
os =
Cc[
"@mozilla.org/observer-service;1"].getService(
Ci.nsIObserverService);
46 let uniqueName =
"bug 448741";
47 let uniqueValue =
"as good as unique: " + Date.now();
50 var
tab = tabbrowser.addTab();
51 ss.setTabValue(tab, uniqueName, uniqueValue);
52 let valueWasCleaned =
false;
55 let cleaningObserver = {
57 ok(aTopic ==
"sessionstore-state-write",
"observed correct topic?");
58 ok(aSubject instanceof
Ci.nsISupportsString,
"subject is a string?");
59 ok(aSubject.data.indexOf(uniqueValue) > -1,
"data contains our value?");
62 let state = eval(aSubject.data);
63 for each (let
winData in state.windows) {
64 for each (let
tabData in winData.tabs) {
65 if (tabData.extData && uniqueName in tabData.extData &&
66 tabData.extData[uniqueName] == uniqueValue) {
67 delete tabData.extData[uniqueName];
68 valueWasCleaned =
true;
73 ok(valueWasCleaned,
"found and removed the specific tab value");
74 aSubject.data = uneval(state);
75 os.removeObserver(
this, aTopic,
false);
80 let checkingObserver = {
82 ok(valueWasCleaned && aSubject instanceof
Ci.nsISupportsString,
83 "ready to check the cleaned state?");
84 ok(aSubject.data.indexOf(uniqueValue) == -1,
"data no longer contains our value?");
87 tabbrowser.removeTab(tab);
88 os.removeObserver(
this, aTopic,
false);
89 if (
gPrefService.prefHasUserValue(
"browser.sessionstore.interval"))
90 gPrefService.clearUserPref(
"browser.sessionstore.interval");
96 os.addObserver(checkingObserver,
"sessionstore-state-write",
false);
97 os.addObserver(cleaningObserver,
"sessionstore-state-write",
false);
100 gPrefService.setIntPref(
"browser.sessionstore.interval", 0);
function getBrowser() gBrowser
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe