diff --git a/browser/components/touchbar/MacTouchBar.js b/browser/components/touchbar/MacTouchBar.js index c38724d15c3e..b831782e5c0f 100644 --- a/browser/components/touchbar/MacTouchBar.js +++ b/browser/components/touchbar/MacTouchBar.js @@ -411,14 +411,9 @@ class TouchBarHelper { if (!TouchBarHelper.window) { return; } - let searchString = ""; - if ( - TouchBarHelper.window.gURLBar.getAttribute("pageproxystate") != "valid" - ) { - searchString = TouchBarHelper.window.gURLBar.lastSearchString.trimStart(); - if (Object.values(UrlbarTokenizer.RESTRICT).includes(searchString[0])) { - searchString = searchString.substring(1).trimStart(); - } + let searchString = TouchBarHelper.window.gURLBar.lastSearchString.trimStart(); + if (Object.values(UrlbarTokenizer.RESTRICT).includes(searchString[0])) { + searchString = searchString.substring(1).trimStart(); } TouchBarHelper.window.gURLBar.search(`${restrictionToken} ${searchString}`); diff --git a/browser/components/touchbar/tests/browser/browser_touchbar_searchrestrictions.js b/browser/components/touchbar/tests/browser/browser_touchbar_searchrestrictions.js index a7a997846718..9126027eacb2 100644 --- a/browser/components/touchbar/tests/browser/browser_touchbar_searchrestrictions.js +++ b/browser/components/touchbar/tests/browser/browser_touchbar_searchrestrictions.js @@ -127,32 +127,3 @@ add_task(async function stripSpaces() { ); } }); - -add_task(async function clearURLs() { - const tests = [ - { - loadUrl: "https://example.com", - token: UrlbarTokenizer.RESTRICT.HISTORY, - expected: "^ ", - }, - { - loadUrl: "about:blank", - token: UrlbarTokenizer.RESTRICT.BOOKMARK, - expected: "* ", - }, - ]; - let win = BrowserWindowTracker.getTopWindow(); - for (let { loadUrl, token, expected } of tests) { - let loadedPromise = BrowserTestUtils.browserLoaded( - gBrowser.selectedBrowser - ); - BrowserTestUtils.loadURI(gBrowser.selectedBrowser, loadUrl); - await loadedPromise; - TouchBarHelper.insertRestrictionInUrlbar(token); - Assert.equal( - win.gURLBar.value, - expected, - "The search restriction token should have cleared out the URL." - ); - } -});