B2G/gecko/browser/components/sessionstore/test/browser_448741.js
// prevent our value from being written to disk
prevent our value from being written to disk
prevent our value from being written to disk
function cleaningObserver(aSubject, aTopic, aData) {
    ok(aTopic == "sessionstore-state-write", "observed correct topic?");
    ok(aSubject instanceof Ci.nsISupportsString, "subject is a string?");
    ok(aSubject.data.indexOf(uniqueValue) > -1, "data contains our value?");
    let state = JSON.parse(aSubject.data);
    state.windows.forEach(function (winData) {
      winData.tabs.forEach(function (tabData) {
        if (tabData.extData && uniqueName in tabData.extData &&
            tabData.extData[uniqueName] == uniqueValue) {
          delete tabData.extData[uniqueName];
          valueWasCleaned = true;
        }
      });
    });
    ok(valueWasCleaned, "found and removed the specific tab value");
    aSubject.data = JSON.stringify(state);
    Services.obs.removeObserver(cleaningObserver, aTopic, false);
  }
function cleaningObserver ( aSubject , aTopic , aData ) { ok ( aTopic == "sessionstore-state-write" , "observed correct topic?" ) ; ok ( aSubject instanceof Ci . nsISupportsString , "subject is a string?" ) ; ok ( aSubject . data . indexOf ( uniqueValue ) > - 1 , "data contains our value?" ) ; let state = JSON . parse ( aSubject . data ) ; state . windows . forEach ( function ( winData ) { winData . tabs . forEach ( function ( tabData ) { if ( tabData . extData && uniqueName in tabData . extData && tabData . extData [ uniqueName ] == uniqueValue ) { delete tabData . extData [ uniqueName ] ; valueWasCleaned = true ; } } ) ; } ) ; ok ( valueWasCleaned , "found and removed the specific tab value" ) ; aSubject . data = JSON . stringify ( state ) ; Services . obs . removeObserver ( cleaningObserver , aTopic , false ) ; }
prevent our value from being written to disk
prevent our value from being written to disk
// find the data for the newly added tab and delete it