зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 3a7f5b6a794f (bug 1598655) for browser chrome facilures on browser_touchbar_searchrestrictions.js.
This commit is contained in:
Родитель
f559512182
Коммит
9a6eadda59
|
@ -411,15 +411,10 @@ class TouchBarHelper {
|
||||||
if (!TouchBarHelper.window) {
|
if (!TouchBarHelper.window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let searchString = "";
|
let searchString = TouchBarHelper.window.gURLBar.lastSearchString.trimStart();
|
||||||
if (
|
|
||||||
TouchBarHelper.window.gURLBar.getAttribute("pageproxystate") != "valid"
|
|
||||||
) {
|
|
||||||
searchString = TouchBarHelper.window.gURLBar.lastSearchString.trimStart();
|
|
||||||
if (Object.values(UrlbarTokenizer.RESTRICT).includes(searchString[0])) {
|
if (Object.values(UrlbarTokenizer.RESTRICT).includes(searchString[0])) {
|
||||||
searchString = searchString.substring(1).trimStart();
|
searchString = searchString.substring(1).trimStart();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TouchBarHelper.window.gURLBar.search(`${restrictionToken} ${searchString}`);
|
TouchBarHelper.window.gURLBar.search(`${restrictionToken} ${searchString}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче