tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug345529.js (798B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/licenses/publicdomain/  */
      3 
      4 // Regression test for bug 345529 - crash removing an observer during an
      5 // nsPref:changed notification.
      6 function run_test() {
      7  const PREF_NAME = "testPref";
      8 
      9  var observer = {
     10    QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
     11 
     12    observe: function observe() {
     13      Services.prefs.removeObserver(PREF_NAME, observer);
     14    },
     15  };
     16  Services.prefs.addObserver(PREF_NAME, observer);
     17 
     18  Services.prefs.setCharPref(PREF_NAME, "test0");
     19  // This second call isn't needed on a clean profile: it makes sure
     20  // the observer gets called even if the pref already had the value
     21  // "test0" before this test.
     22  Services.prefs.setCharPref(PREF_NAME, "test1");
     23 
     24  Assert.ok(true);
     25 }