Bug 915260 - "TypeError: Services.settings is undefined" error in B2G mochitest logs r=etienne

This commit is contained in:
Fabrice Desré 2013-09-12 01:57:15 -07:00
parent b2bf68955e
commit 8a9a977767
2 changed files with 18 additions and 6 deletions

View File

@ -317,8 +317,11 @@ let AdbController = {
// Check if we have a remote debugging session going on. If so, we won't
// disable adb even if the screen is locked.
let isDebugging = Object.keys(DebuggerServer._connections).length > 0;
this.debug("isDebugging=" + isDebugging);
let isDebugging = DebuggerServer._connections &&
Object.keys(DebuggerServer._connections).length > 0;
if (this.DEBUG) {
this.debug("isDebugging=" + isDebugging);
}
let enableAdb = this.remoteDebuggerEnabled &&
(!(this.lockEnabled && this.locked) || isDebugging);

View File

@ -9,8 +9,17 @@ this.EXPORTED_SYMBOLS = ["WebappsUpdater"];
const Cc = Components.classes;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "settings",
"@mozilla.org/settingsService;1",
"nsISettingsService");
function debug(aStr) {
//dump("--*-- WebappsUpdater: " + aStr);
}
this.WebappsUpdater = {
_checkingApps: false,
_pendingEvents: [],
@ -29,7 +38,7 @@ this.WebappsUpdater = {
let browser = Services.wm.getMostRecentWindow("navigator:browser");
if (!browser) {
this._pendingEvents.push(detail);
dump("Warning: Couldn't send update event " + aType +
debug("Warning: Couldn't send update event " + aType +
": no content browser. Will send again when content becomes available.");
return false;
}
@ -39,8 +48,8 @@ this.WebappsUpdater = {
},
_appsUpdated: function(aApps) {
dump("appsUpdated: " + aApps.length + " apps to update");
let lock = Services.settings.createLock();
debug("appsUpdated: " + aApps.length + " apps to update");
let lock = settings.createLock();
lock.set("apps.updateStatus", "check-complete", null);
this.sendChromeEvent("apps-update-check", { apps: aApps });
this._checkingApps = false;
@ -49,7 +58,7 @@ this.WebappsUpdater = {
// Trigger apps update check and wait for all to be done before
// notifying gaia.
updateApps: function() {
dump("updateApps (" + this._checkingApps + ")");
debug("updateApps (" + this._checkingApps + ")");
// Don't start twice.
if (this._checkingApps) {
return;