gecko-dev/browser/extensions/webcompat-reporter/bootstrap.js
Mark Banner e5c2479848 Bug 1336070 - Enable eslint no-undef for browser/, apart from components/ and base/content/. r=mossop
MozReview-Commit-ID: CJtpm8zlLxa

--HG--
extra : rebase_source : c6a834d5aaba0f84f5e147333085883de1a118e8
2017-02-02 09:08:42 +00:00

48 lines
1.4 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global APP_SHUTDOWN:false */
let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const WEBCOMPATREPORTER_JSM = "chrome://webcompat-reporter/content/WebCompatReporter.jsm";
XPCOMUtils.defineLazyModuleGetter(this, "WebCompatReporter",
WEBCOMPATREPORTER_JSM);
const PREF_WC_REPORTER_ENABLED = "extensions.webcompat-reporter.enabled";
let prefObserver = function(aSubject, aTopic, aData) {
let enabled = Services.prefs.getBoolPref(PREF_WC_REPORTER_ENABLED);
if (enabled) {
WebCompatReporter.init();
} else {
WebCompatReporter.uninit();
}
};
function startup(aData, aReason) {
// Observe pref changes and enable/disable as necessary.
Services.prefs.addObserver(PREF_WC_REPORTER_ENABLED, prefObserver, false);
// Only initialize if pref is enabled.
let enabled = Services.prefs.getBoolPref(PREF_WC_REPORTER_ENABLED);
if (enabled) {
WebCompatReporter.init();
}
}
function shutdown(aData, aReason) {
if (aReason === APP_SHUTDOWN) {
return;
}
Cu.unload(WEBCOMPATREPORTER_JSM);
}
function install(aData, aReason) {}
function uninstall(aData, aReason) {}