Merge pull request #4791 from petoncle/fix-wrong-behavior-of-tabopen-with-containers

Fix wrong behavior of :tabopen with containers
This commit is contained in:
Oliver Blanthorn 2023-12-16 19:20:30 +00:00 committed by GitHub
commit dd535a4e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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