Bug 1893823 - Contextual Search breaks urlbar when no engine is present. r=daisuke

Differential Revision: https://phabricator.services.mozilla.com/D208835
This commit is contained in:
Dale Harvey 2024-04-27 21:31:04 +00:00
Родитель 8c366161bb
Коммит a904cc5aeb
2 изменённых файлов: 25 добавлений и 1 удалений

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

@ -53,7 +53,7 @@ class ProviderContextualSearch extends ActionsProvider {
}
let engine = await this.fetchEngine(controller);
let icon = engine?.icon || (await engine.getIconURL?.());
let icon = engine?.icon || (await engine?.getIconURL?.());
let defaultEngine = lazy.UrlbarSearchUtils.getDefaultEngine();
if (

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

@ -26,6 +26,30 @@ add_setup(async function setup() {
await AddonTestUtils.waitForSearchProviderStartup(ext);
});
add_task(async function test_no_engine() {
const ENGINE_TEST_URL = "https://example.org/";
let onLoaded = BrowserTestUtils.browserLoaded(
gBrowser.selectedBrowser,
false,
ENGINE_TEST_URL
);
BrowserTestUtils.startLoadingURIString(
gBrowser.selectedBrowser,
ENGINE_TEST_URL
);
await onLoaded;
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: "test",
});
Assert.ok(
UrlbarTestUtils.getResultCount(window) > 0,
"At least one result is shown"
);
});
add_task(async function test_selectContextualSearchResult_already_installed() {
const ENGINE_TEST_URL = "https://example.com/";
let onLoaded = BrowserTestUtils.browserLoaded(