Bug 1578381 - Rename HomePage.init to delayedStartup to better describe when it gets called normally. r=mixedpuppy

Depends on D48169

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2019-10-07 17:05:09 +00:00
Родитель 3bd76b3e1b
Коммит 526c10a89d
3 изменённых файлов: 5 добавлений и 5 удалений

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

@ -2072,7 +2072,7 @@ var gBrowserInit = {
BrowserSearch.delayedStartupInit(); BrowserSearch.delayedStartupInit();
AutoShowBookmarksToolbar.init(); AutoShowBookmarksToolbar.init();
gProtectionsHandler.init(); gProtectionsHandler.init();
HomePage.init().catch(Cu.reportError); HomePage.delayedStartup().catch(Cu.reportError);
let safeMode = document.getElementById("helpSafeMode"); let safeMode = document.getElementById("helpSafeMode");
if (Services.appinfo.inSafeMode) { if (Services.appinfo.inSafeMode) {

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

@ -71,7 +71,7 @@ let HomePage = {
* homepage, but this is deemed acceptable, as we'll correct it once * homepage, but this is deemed acceptable, as we'll correct it once
* initialised. * initialised.
*/ */
async init() { async delayedStartup() {
if (this._initializationPromise) { if (this._initializationPromise) {
await this._initializationPromise; await this._initializationPromise;
return; return;
@ -178,7 +178,7 @@ let HomePage = {
* `|` separated list of URLs. * `|` separated list of URLs.
*/ */
async set(value) { async set(value) {
await this.init(); await this.delayedStartup();
if (await this.shouldIgnore(value)) { if (await this.shouldIgnore(value)) {
Cu.reportError( Cu.reportError(
@ -234,7 +234,7 @@ let HomePage = {
* True if the url should be ignored. * True if the url should be ignored.
*/ */
async shouldIgnore(url) { async shouldIgnore(url) {
await this.init(); await this.delayedStartup();
const lowerURL = url.toLowerCase(); const lowerURL = url.toLowerCase();
return this._ignoreList.some(code => lowerURL.includes(code.toLowerCase())); return this._ignoreList.some(code => lowerURL.includes(code.toLowerCase()));

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

@ -44,7 +44,7 @@ add_task(async function test_initWithIgnoredPageCausesReset() {
); );
Assert.ok(HomePage.overridden, "Should have overriden the homepage"); Assert.ok(HomePage.overridden, "Should have overriden the homepage");
await HomePage.init(); await HomePage.delayedStartup();
Assert.ok( Assert.ok(
!HomePage.overridden, !HomePage.overridden,