michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function run_test() { michael@0: var ps = Cc["@mozilla.org/preferences-service;1"]. michael@0: getService(Ci.nsIPrefService); michael@0: michael@0: var pb = Cc["@mozilla.org/preferences-service;1"]. michael@0: getService(Ci.nsIPrefBranch); michael@0: michael@0: var observer = { michael@0: QueryInterface: function QueryInterface(aIID) { michael@0: if (aIID.equals(Ci.nsIObserver) || michael@0: aIID.equals(Ci.nsISupports)) michael@0: return this; michael@0: throw Components.results.NS_NOINTERFACE; michael@0: }, michael@0: michael@0: observe: function observe(aSubject, aTopic, aState) { michael@0: // Don't do anything. michael@0: } michael@0: } michael@0: michael@0: /* Set the same pref twice. This shouldn't leak. */ michael@0: pb.addObserver("UserPref.nonexistent.setIntPref", observer, false); michael@0: pb.addObserver("UserPref.nonexistent.setIntPref", observer, false); michael@0: }