зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382170 - Only run gSearchResultsPane.initializeCategories() when search is used for the first time, r=jaws
This shuffled what bug 1374852 did a little bit; instead of initialize all panes when the page loads, the call will happen inside an idle callback. An the event listener is added to ensure that even if idle callback doesn't run soon enough, the function is run already when the user starts search. MozReview-Commit-ID: LU4Nb8lql36 --HG-- extra : rebase_source : 653f068cec6d7a42d406ea0109358d0c48e195bf
This commit is contained in:
Родитель
ef6bb0ce7d
Коммит
02def262dc
|
@ -19,10 +19,11 @@ var gSearchResultsPane = {
|
|||
this.searchInput.hidden = !Services.prefs.getBoolPref("browser.preferences.search");
|
||||
if (!this.searchInput.hidden) {
|
||||
this.searchInput.addEventListener("command", this);
|
||||
window.addEventListener("load", () => {
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
this.searchInput.focus();
|
||||
this.initializeCategories();
|
||||
});
|
||||
// Initialize other panes in an idle callback.
|
||||
window.requestIdleCallback(() => this.initializeCategories());
|
||||
}
|
||||
let strings = this.strings;
|
||||
this.searchInput.placeholder = AppConstants.platform == "win" ?
|
||||
|
@ -31,9 +32,9 @@ var gSearchResultsPane = {
|
|||
},
|
||||
|
||||
handleEvent(event) {
|
||||
if (event.type === "command") {
|
||||
this.searchFunction(event);
|
||||
}
|
||||
// Ensure categories are initialized if idle callback didn't run sooo enough.
|
||||
this.initializeCategories();
|
||||
this.searchFunction(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче