diff --git a/src/excmds.ts b/src/excmds.ts index 0ad2a0aa..d6aeef58 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -2837,16 +2837,13 @@ export async function tabopen_helper({ addressarr = [], waitForDom = false }): P } if (typeof maybeURL === "object") { - if (await firefoxVersionAtLeast(80)) { - // work around #2695 until we can work out what is going on - if (args.active === false || args.cookieStoreId !== undefined || waitForDom === true) { - throw new Error("Firefox search engines do not support containers or background tabs in FF >80. `:set searchengine google` or see issue https://github.com/tridactyl/tridactyl/issues/2695") - } - - // This ignores :set tabopenpos / issue #342. TODO: fix that somehow. - return browser.search.search(maybeURL) - } - return openInNewTab(null, args, waitForDom).then(tab => browser.search.search({ tabId: tab.id, ...maybeURL })) + // browser.search.search(tabId, ...) sometimes does not work when it is executed + // right after openInNewTab(). Calling browser.tabs.get() between openInNewTab() + // and browser.search.search() seems to fix that problem. + // See https://github.com/tridactyl/tridactyl/pull/4791. + return openInNewTab(null, args, waitForDom) + .then(tab => browser.tabs.get(tab.id)) + .then(tab => browser.search.search({tabId: tab.id, ...maybeURL})) } // Fall back to about:newtab