mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 914369 - SimplePush: Add debug pref to allow toggling debug settings at runtime. r=dougt
--HG-- extra : rebase_source : 1bd40b20ea036906e532bdb56d44f9c40c15fd94
This commit is contained in:
parent
a4f0c0ea17
commit
9326e68f08
@ -400,6 +400,8 @@ pref("dom.mozAlarms.enabled", true);
|
||||
|
||||
// SimplePush
|
||||
pref("services.push.enabled", true);
|
||||
// Debugging enabled.
|
||||
pref("services.push.debug", false);
|
||||
// Is the network connection allowed to be up?
|
||||
// This preference should be used in UX to enable/disable push.
|
||||
pref("services.push.connection.enabled", true);
|
||||
|
@ -4,8 +4,12 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
// Don't modify this, instead set services.push.debug.
|
||||
let gDebuggingEnabled = false;
|
||||
|
||||
function debug(s) {
|
||||
// dump("-*- Push.js: " + s + "\n");
|
||||
if (gDebuggingEnabled)
|
||||
dump("-*- Push.js: " + s + "\n");
|
||||
}
|
||||
|
||||
const Cc = Components.classes;
|
||||
@ -39,6 +43,10 @@ Push.prototype = {
|
||||
Ci.nsISupportsWeakReference]),
|
||||
|
||||
init: function(aWindow) {
|
||||
// Set debug first so that all debugging actually works.
|
||||
// NOTE: We don't add an observer here like in PushService. Flipping the
|
||||
// pref will require a reload of the app/page, which seems acceptable.
|
||||
gDebuggingEnabled = Services.prefs.getBoolPref("services.push.debug");
|
||||
debug("init()");
|
||||
|
||||
let principal = aWindow.document.nodePrincipal;
|
||||
|
@ -4,8 +4,12 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
// Don't modify this, instead set services.push.debug.
|
||||
let gDebuggingEnabled = false;
|
||||
|
||||
function debug(s) {
|
||||
// dump("-*- PushService.jsm: " + s + "\n");
|
||||
if (gDebuggingEnabled)
|
||||
dump("-*- PushService.jsm: " + s + "\n");
|
||||
}
|
||||
|
||||
const Cc = Components.classes;
|
||||
@ -26,6 +30,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AlarmService",
|
||||
this.EXPORTED_SYMBOLS = ["PushService"];
|
||||
|
||||
const prefs = new Preferences("services.push.");
|
||||
// Set debug first so that all debugging actually works.
|
||||
gDebuggingEnabled = prefs.get("debug");
|
||||
|
||||
const kPUSHDB_DB_NAME = "push";
|
||||
const kPUSHDB_DB_VERSION = 1; // Change this if the IndexedDB format changes
|
||||
@ -318,6 +324,8 @@ this.PushService = {
|
||||
} else {
|
||||
this._shutdownWS();
|
||||
}
|
||||
} else if (aData == "services.push.debug") {
|
||||
gDebuggingEnabled = prefs.get("debug");
|
||||
}
|
||||
break;
|
||||
case "timer-callback":
|
||||
@ -467,6 +475,8 @@ this.PushService = {
|
||||
prefs.observe("serverURL", this);
|
||||
// Used to monitor if the user wishes to disable Push.
|
||||
prefs.observe("connection.enabled", this);
|
||||
// Debugging
|
||||
prefs.observe("debug", this);
|
||||
|
||||
this._started = true;
|
||||
},
|
||||
@ -493,6 +503,7 @@ this.PushService = {
|
||||
|
||||
debug("uninit()");
|
||||
|
||||
prefs.ignore("debug", this);
|
||||
prefs.ignore("connection.enabled", this);
|
||||
prefs.ignore("serverURL", this);
|
||||
Services.obs.removeObserver(this, this._getNetworkStateChangeEventName());
|
||||
|
Loading…
Reference in New Issue
Block a user