bug 1543676: remote: avoid Preferences.jsm before first paint; r=yulia

It is illegal for any code to depend on
Preferences.jsm before first paint.  This enforced by
browser/base/content/test/performance/browser_startup.js, so we
must change remote/RemoteAgent.jsm to use an alternate mechanism
for getting at the preferences it needs.

Differential Revision: https://phabricator.services.mozilla.com/D27246

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2019-04-15 14:41:21 +00:00
Родитель b024b00b94
Коммит f7c6bb254b
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -6,8 +6,8 @@
var EXPORTED_SYMBOLS = ["Log"];
const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
const {Log: StdLog} = ChromeUtils.import("resource://gre/modules/Log.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const LOG_LEVEL = "remote.log.level";
@ -23,6 +23,9 @@ class Log {
}
static get verbose() {
return StdLog.Level[Preferences.get(LOG_LEVEL)] >= StdLog.Level.Info;
// we can't use Preferences.jsm before first paint,
// see ../browser/base/content/test/performance/browser_startup.js
const level = Services.prefs.getStringPref(LOG_LEVEL, "Info");
return StdLog.Level[level] >= StdLog.Level.Info;
}
}