Bug 1548750 - Harden the search link added mechanisms and browser_tooManyEnginesOffered.js against the search service initialisation not having completed yet. r=mikedeboer

Differential Revision: https://phabricator.services.mozilla.com/D29807
This commit is contained in:
Mark Banner
2019-05-07 10:51:44 +00:00
parent a61401a248
commit e57171b69b
2 changed files with 9 additions and 0 deletions

View File

@@ -4154,6 +4154,13 @@ const BrowserSearch = {
},
addEngine(browser, engine, uri) {
if (!this._searchInitComplete) {
// We haven't finished initialising search yet. This means we can't
// call getEngineByName here. Since this is only on start-up and unlikely
// to happen in the normal case, we'll just return early rather than
// trying to handle it asynchronously.
return;
}
// Check to see whether we've already added an engine with this title
if (browser.engines) {
if (browser.engines.some(e => e.title == engine.title))

View File

@@ -9,6 +9,8 @@ const oneOffsContainer = searchPopup.searchOneOffsContainer;
add_task(async function test_setup() {
await gCUITestUtils.addSearchBar();
await Services.search.init();
registerCleanupFunction(() => {
gCUITestUtils.removeSearchBar();
});