Loading browser/components/preferences/findInPage.js +4 −7 Original line number Diff line number Diff line Loading @@ -105,13 +105,10 @@ var gSearchResultsPane = { if (!this.categoriesInitialized) { this.categoriesInitialized = true; // Each element of gCategoryInits is a name for (let category of gCategoryInits.values()) { category.init(); for (let [, /* name */ category] of gCategoryInits) { if (!category.inited) { await category.init(); } if (document.hasPendingL10nMutations) { await new Promise(r => document.addEventListener("L10nMutationsFinished", r, { once: true }) ); } } }, Loading browser/components/preferences/preferences.js +41 −26 Original line number Diff line number Diff line Loading @@ -156,24 +156,43 @@ var gLastCategory = { category: undefined, subcategory: undefined }; const gXULDOMParser = new DOMParser(); var gCategoryModules = new Map(); var gCategoryInits = new Map(); function init_category_if_required(category) { let categoryInfo = gCategoryInits.get(category); if (!categoryInfo) { throw new Error( "Unknown in-content prefs category! Can't init " + category ); } if (categoryInfo.inited) { return null; } return categoryInfo.init(); } function register_module(categoryName, categoryObject) { gCategoryModules.set(categoryName, categoryObject); gCategoryInits.set(categoryName, { _initted: false, init() { inited: false, async init() { let startTime = performance.now(); if (this._initted) { return; } this._initted = true; let template = document.getElementById("template-" + categoryName); if (template) { // Replace the template element with the nodes inside of it. template.replaceWith(template.content); let frag = template.content; await document.l10n.translateFragment(frag); // Actually insert them into the DOM. document.l10n.pauseObserving(); template.replaceWith(frag); document.l10n.resumeObserving(); // We need to queue an update again because the previous update might // have happened while we awaited on translateFragment. Preferences.queueUpdateOfAllElements(); } categoryObject.init(); this.inited = true; ChromeUtils.addProfilerMarker( "Preferences", { startTime }, Loading Loading @@ -368,20 +387,17 @@ async function gotoPref( } window.history.replaceState(category, document.title); let categoryInfo = gCategoryInits.get(category); if (!categoryInfo) { let err = new Error( "Unknown in-content prefs category! Can't init " + category try { await init_category_if_required(category); } catch (ex) { console.error( new Error( "Error initializing preference category " + category + ": " + ex ) ); console.error(err); throw err; throw ex; } categoryInfo.init(); if (document.hasPendingL10nMutations) { await new Promise(r => document.addEventListener("L10nMutationsFinished", r, { once: true }) ); // Bail out of this goToPref if the category // or subcategory changed during async operation. if ( Loading @@ -390,7 +406,6 @@ async function gotoPref( ) { return; } } search(category, "data-category"); Loading browser/components/preferences/tests/browser_experimental_features_filter.js +2 −12 Original line number Diff line number Diff line Loading @@ -143,27 +143,17 @@ add_task(async function testFilterFeatures() { ); } // Check that switching to a non-find-in-page category changes item // visibility appropriately. EventUtils.synthesizeMouseAtCenter( doc.getElementById(category), {}, gBrowser.contentWindow ); // Ensure that async passes of localization and any code waiting for // those passes have finished running. await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)) ); let shouldShow = category == "category-experimental"; for (let definition of definitions) { checkVisibility( doc.getElementById(definition.id), shouldShow, `${definition.id} should be ${ shouldShow ? "visible" : "hidden" } after category change to ${category}` true, `${definition.id} should be visible after category change to ${category}` ); } } Loading browser/modules/test/browser/browser_UsageTelemetry_interaction.js +2 −5 Original line number Diff line number Diff line Loading @@ -689,12 +689,9 @@ add_task(async function mainMenu() { }); add_task(async function preferences() { let finalPaneEvent = Services.prefs.getBoolPref("identity.fxaccounts.enabled") ? "sync-pane-loaded" : "privacy-pane-loaded"; let finalPrefPaneLoaded = TestUtils.topicObserved(finalPaneEvent, () => true); let initialized = BrowserTestUtils.waitForEvent(gBrowser, "Initialized"); await BrowserTestUtils.withNewTab("about:preferences", async browser => { await finalPrefPaneLoaded; await initialized; Services.telemetry.getSnapshotForKeyedScalars("main", true); Loading Loading
browser/components/preferences/findInPage.js +4 −7 Original line number Diff line number Diff line Loading @@ -105,13 +105,10 @@ var gSearchResultsPane = { if (!this.categoriesInitialized) { this.categoriesInitialized = true; // Each element of gCategoryInits is a name for (let category of gCategoryInits.values()) { category.init(); for (let [, /* name */ category] of gCategoryInits) { if (!category.inited) { await category.init(); } if (document.hasPendingL10nMutations) { await new Promise(r => document.addEventListener("L10nMutationsFinished", r, { once: true }) ); } } }, Loading
browser/components/preferences/preferences.js +41 −26 Original line number Diff line number Diff line Loading @@ -156,24 +156,43 @@ var gLastCategory = { category: undefined, subcategory: undefined }; const gXULDOMParser = new DOMParser(); var gCategoryModules = new Map(); var gCategoryInits = new Map(); function init_category_if_required(category) { let categoryInfo = gCategoryInits.get(category); if (!categoryInfo) { throw new Error( "Unknown in-content prefs category! Can't init " + category ); } if (categoryInfo.inited) { return null; } return categoryInfo.init(); } function register_module(categoryName, categoryObject) { gCategoryModules.set(categoryName, categoryObject); gCategoryInits.set(categoryName, { _initted: false, init() { inited: false, async init() { let startTime = performance.now(); if (this._initted) { return; } this._initted = true; let template = document.getElementById("template-" + categoryName); if (template) { // Replace the template element with the nodes inside of it. template.replaceWith(template.content); let frag = template.content; await document.l10n.translateFragment(frag); // Actually insert them into the DOM. document.l10n.pauseObserving(); template.replaceWith(frag); document.l10n.resumeObserving(); // We need to queue an update again because the previous update might // have happened while we awaited on translateFragment. Preferences.queueUpdateOfAllElements(); } categoryObject.init(); this.inited = true; ChromeUtils.addProfilerMarker( "Preferences", { startTime }, Loading Loading @@ -368,20 +387,17 @@ async function gotoPref( } window.history.replaceState(category, document.title); let categoryInfo = gCategoryInits.get(category); if (!categoryInfo) { let err = new Error( "Unknown in-content prefs category! Can't init " + category try { await init_category_if_required(category); } catch (ex) { console.error( new Error( "Error initializing preference category " + category + ": " + ex ) ); console.error(err); throw err; throw ex; } categoryInfo.init(); if (document.hasPendingL10nMutations) { await new Promise(r => document.addEventListener("L10nMutationsFinished", r, { once: true }) ); // Bail out of this goToPref if the category // or subcategory changed during async operation. if ( Loading @@ -390,7 +406,6 @@ async function gotoPref( ) { return; } } search(category, "data-category"); Loading
browser/components/preferences/tests/browser_experimental_features_filter.js +2 −12 Original line number Diff line number Diff line Loading @@ -143,27 +143,17 @@ add_task(async function testFilterFeatures() { ); } // Check that switching to a non-find-in-page category changes item // visibility appropriately. EventUtils.synthesizeMouseAtCenter( doc.getElementById(category), {}, gBrowser.contentWindow ); // Ensure that async passes of localization and any code waiting for // those passes have finished running. await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)) ); let shouldShow = category == "category-experimental"; for (let definition of definitions) { checkVisibility( doc.getElementById(definition.id), shouldShow, `${definition.id} should be ${ shouldShow ? "visible" : "hidden" } after category change to ${category}` true, `${definition.id} should be visible after category change to ${category}` ); } } Loading
browser/modules/test/browser/browser_UsageTelemetry_interaction.js +2 −5 Original line number Diff line number Diff line Loading @@ -689,12 +689,9 @@ add_task(async function mainMenu() { }); add_task(async function preferences() { let finalPaneEvent = Services.prefs.getBoolPref("identity.fxaccounts.enabled") ? "sync-pane-loaded" : "privacy-pane-loaded"; let finalPrefPaneLoaded = TestUtils.topicObserved(finalPaneEvent, () => true); let initialized = BrowserTestUtils.waitForEvent(gBrowser, "Initialized"); await BrowserTestUtils.withNewTab("about:preferences", async browser => { await finalPrefPaneLoaded; await initialized; Services.telemetry.getSnapshotForKeyedScalars("main", true); Loading