Backed out changeset e0677d0ad42a (bug 1803056) for causing mochitest failures on browser-tips/browser_searchTips.js CLOSED TREE

This commit is contained in:
Cristian Tuns
2022-12-16 19:34:12 -05:00
parent 4909a6004d
commit abdd8ae86a
3 changed files with 0 additions and 65 deletions

View File

@@ -484,21 +484,6 @@ class ProviderSearchTips extends UrlbarProvider {
return;
}
// Don't show a tip if a request is in progress, and the URI associated
// with the request differs from the URI that triggered the search tip.
// One contraint with this approach is related to Bug 1797748: SERPs
// that use the History API to navigate between views will call
// onLocationChange without a request, and thus, no originalUri is
// available to check against, so the search tip and search terms may
// show on search pages outside of the default SERP.
let { documentRequest } = window.gBrowser.selectedBrowser.webProgress;
if (
documentRequest instanceof Ci.nsIChannel &&
documentRequest.originalUri?.spec != originalUri?.spec
) {
return;
}
// At this point, we're showing a tip.
this.disableTipsForCurrentSession = true;

View File

@@ -12,8 +12,6 @@ support-files =
[browser_searchTips_interaction.js]
https_first_disabled = true
[browser_searchTips.js]
support-files =
../browser/slow-page.sjs
https_first_disabled = true
[browser_selection.js]
[browser_updateAsk.js]

View File

@@ -13,7 +13,6 @@
ChromeUtils.defineESModuleGetters(this, {
AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.sys.mjs",
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
UrlbarProviderSearchTips:
"resource:///modules/UrlbarProviderSearchTips.sys.mjs",
@@ -420,53 +419,6 @@ add_task(async function shortcut_buttons_with_tip() {
);
});
// Don't show the persist search tip when a page is loading.
add_task(async function noSearchTipWhileAPageLoads() {
await setDefaultEngine("Example");
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.showSearchTerms.featureGate", true]],
});
// Create a slow endpoint.
const SLOW_PAGE =
getRootDirectory(gTestPath).replace(
"chrome://mochitests/content",
"http://www.example.com"
) + "slow-page.sjs";
let tab = await BrowserTestUtils.openNewForegroundTab({
gBrowser,
url: SEARCH_SERP_URL,
});
// Load a slow URI to cause an onStateChange event but
// not an onLocationChange event.
BrowserTestUtils.loadURI(tab.linkedBrowser, SLOW_PAGE);
// Wait roughly for the amount of time it would take for the
// persist search tip to show.
await new Promise(resolve =>
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
setTimeout(resolve, UrlbarProviderSearchTips.SHOW_PERSIST_TIP_DELAY_MS * 2)
);
// Check the search tip didn't show while the page was loading.
Assert.equal(
UrlbarPrefs.get(
`tipShownCount.${UrlbarProviderSearchTips.TIP_TYPE.PERSIST}`
),
0,
"The shownCount pref should be 0."
);
Assert.equal(false, window.gURLBar.view.isOpen, "Urlbar should be closed.");
// Clean up.
await SpecialPowers.popPrefEnv();
resetSearchTipsProvider();
BrowserTestUtils.removeTab(tab);
});
function waitForBrowserWindowActive(win) {
return new Promise(resolve => {
if (Services.focus.activeWindow == win) {