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:
@@ -4154,6 +4154,13 @@ const BrowserSearch = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addEngine(browser, engine, uri) {
|
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
|
// Check to see whether we've already added an engine with this title
|
||||||
if (browser.engines) {
|
if (browser.engines) {
|
||||||
if (browser.engines.some(e => e.title == engine.title))
|
if (browser.engines.some(e => e.title == engine.title))
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ const oneOffsContainer = searchPopup.searchOneOffsContainer;
|
|||||||
|
|
||||||
add_task(async function test_setup() {
|
add_task(async function test_setup() {
|
||||||
await gCUITestUtils.addSearchBar();
|
await gCUITestUtils.addSearchBar();
|
||||||
|
|
||||||
|
await Services.search.init();
|
||||||
registerCleanupFunction(() => {
|
registerCleanupFunction(() => {
|
||||||
gCUITestUtils.removeSearchBar();
|
gCUITestUtils.removeSearchBar();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user