Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 const {Cc, Ci, Cu, Cr} = require("chrome");
9 Cu.import("resource://gre/modules/Services.jsm");
10 Cu.import("resource://gre/modules/devtools/event-emitter.js");
12 exports.PREF_ORIG_SOURCES = "devtools.styleeditor.source-maps-enabled";
14 /**
15 * A PreferenceObserver observes a pref branch for pref changes.
16 * It emits an event for each preference change.
17 */
18 function PrefObserver(branchName) {
19 this.branchName = branchName;
20 this.branch = Services.prefs.getBranch(branchName);
21 this.branch.addObserver("", this, false);
23 EventEmitter.decorate(this);
24 }
26 exports.PrefObserver = PrefObserver;
28 PrefObserver.prototype = {
29 observe: function(subject, topic, data) {
30 if (topic == "nsPref:changed") {
31 this.emit(this.branchName + data);
32 }
33 },
35 destroy: function() {
36 if (this.branch) {
37 this.branch.removeObserver('', this);
38 }
39 }
40 };