Skip to content

Commit

Permalink
Merge autoland to mozilla-central. a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chorotan committed Feb 23, 2023
2 parents ddfb394 + f1f60de commit 3ede9de
Show file tree
Hide file tree
Showing 71 changed files with 643 additions and 6,268 deletions.
26 changes: 23 additions & 3 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7826,7 +7826,7 @@ var WebAuthnPromptHelper = {
});
}
let mainAction = this.buildCancelAction(mgr, tid);
let options = {};
let options = { escAction: "buttoncommand" };
this.show(
tid,
"select-sign-result",
Expand Down Expand Up @@ -7855,6 +7855,8 @@ var WebAuthnPromptHelper = {

register(mgr, { origin, tid, is_ctap2, device_selected }) {
let mainAction = this.buildCancelAction(mgr, tid);
let options = { escAction: "buttoncommand" };
let secondaryActions = [];
let message;
if (is_ctap2) {
if (device_selected) {
Expand All @@ -7865,7 +7867,15 @@ var WebAuthnPromptHelper = {
} else {
message = "webauthn.registerPrompt2";
}
this.show(tid, "register", message, origin, mainAction);
this.show(
tid,
"register",
message,
origin,
mainAction,
secondaryActions,
options
);
},

registerDirect(mgr, { origin, tid }) {
Expand Down Expand Up @@ -7896,6 +7906,8 @@ var WebAuthnPromptHelper = {

sign(mgr, { origin, tid, is_ctap2, device_selected }) {
let mainAction = this.buildCancelAction(mgr, tid);
let options = { escAction: "buttoncommand" };
let secondaryActions = [];
let message;
if (is_ctap2) {
if (device_selected) {
Expand All @@ -7906,7 +7918,15 @@ var WebAuthnPromptHelper = {
} else {
message = "webauthn.signPrompt2";
}
this.show(tid, "sign", message, origin, mainAction);
this.show(
tid,
"sign",
message,
origin,
mainAction,
secondaryActions,
options
);
},

show_info(mgr, origin, tid, id, stringId) {
Expand Down
23 changes: 13 additions & 10 deletions browser/components/search/test/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ support-files =
contentSearchUI.js
searchSuggestionEngine.sjs
[browser_contentSearchUI_default.js]
[browser_contextSearchTabPosition.js]
[browser_contextmenu.js]
[browser_contextmenu_whereToOpenLink.js]
[browser_contextSearchTabPosition.js]
[browser_defaultPrivate_nimbus.js]
support-files =
search-engines/basic/manifest.json
Expand All @@ -40,8 +40,10 @@ support-files =
[browser_oneOffContextMenu.js]
[browser_oneOffContextMenu_setDefault.js]
[browser_private_search_perwindowpb.js]
[browser_searchEngine_behaviors.js]
[browser_search_annotation.js]
[browser_search_discovery.js]
[browser_search_nimbus_reload.js]
[browser_search_telemetry_aboutHome.js]
tags = search-telemetry
[browser_search_telemetry_content.js]
Expand All @@ -55,6 +57,11 @@ support-files =
slow_loading_page_with_ads.sjs
telemetrySearchSuggestions.sjs
telemetrySearchSuggestions.xml
[browser_search_telemetry_sources.js]
tags = search-telemetry
support-files =
searchTelemetry.html
searchTelemetryAd.html
[browser_search_telemetry_sources_ads.js]
tags = search-telemetry
support-files =
Expand All @@ -65,24 +72,20 @@ support-files =
searchTelemetryAd_dataAttributes_none.html
[browser_search_telemetry_sources_navigation.js]
tags = search-telemetry
support-files =
searchTelemetry.html
searchTelemetryAd.html
[browser_search_telemetry_sources.js]
tags = search-telemetry
support-files =
searchTelemetry.html
searchTelemetryAd.html
[browser_searchbar_addEngine.js]
[browser_searchbar_context.js]
[browser_searchbar_enter.js]
[browser_searchbar_default.js]
[browser_searchbar_openpopup.js]
[browser_searchbar_enter.js]
[browser_searchbar_keyboard_navigation.js]
skip-if = (os == 'win' && debug) || (os == 'linux' && asan || debug || tsan) # Bug 1792718
[browser_searchbar_openpopup.js]
[browser_searchbar_results.js]
[browser_searchbar_smallpanel_keyboard_navigation.js]
[browser_searchbar_widths.js]
[browser_searchEngine_behaviors.js]
[browser_tooManyEnginesOffered.js]
[browser_search_nimbus_reload.js]
[browser_trending_suggestions.js]
support-files =
searchSuggestionEngine.sjs
150 changes: 150 additions & 0 deletions browser/components/search/test/browser/browser_trending_suggestions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

ChromeUtils.defineESModuleGetters(this, {
SearchTestUtils: "resource://testing-common/SearchTestUtils.sys.mjs",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs",
});

const CONFIG_DEFAULT = [
{
webExtension: { id: "basic@search.mozilla.org" },
urls: {
trending: {
fullPath:
"http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/searchSuggestionEngine.sjs",
query: "",
},
},
appliesTo: [{ included: { everywhere: true } }],
default: "yes",
},
{
webExtension: { id: "private@search.mozilla.org" },
appliesTo: [{ included: { everywhere: true } }],
default: "yes",
},
];

SearchTestUtils.init(this);
UrlbarTestUtils.init(this);

add_setup(async () => {
// Use engines in test directory
let searchExtensions = getChromeDir(getResolvedURI(gTestPath));
searchExtensions.append("search-engines");
await SearchTestUtils.useMochitestEngines(searchExtensions);

await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.suggest.searches", true]],
});

SearchTestUtils.useMockIdleService();
await SearchTestUtils.updateRemoteSettingsConfig(CONFIG_DEFAULT);

registerCleanupFunction(async () => {
let settingsWritten = SearchTestUtils.promiseSearchNotification(
"write-settings-to-disk-complete"
);
await SearchTestUtils.updateRemoteSettingsConfig();
await settingsWritten;
});
});

add_task(async function test_trending_results() {
await check_results({
featureEnabled: true,
searchMode: "@basic ",
expectedResults: 2,
});
await check_results({
featureEnabled: true,
requireSearchModeEnabled: false,
expectedResults: 2,
});
await check_results({
featureEnabled: true,
requireSearchModeEnabled: false,
searchMode: "@basic ",
expectedResults: 2,
});
await check_results({
featureEnabled: false,
searchMode: "@basic ",
expectedResults: 0,
});
await check_results({
featureEnabled: false,
expectedResults: 0,
});
await check_results({
featureEnabled: false,
requireSearchModeEnabled: false,
expectedResults: 0,
});
await check_results({
featureEnabled: false,
requireSearchModeEnabled: false,
searchMode: "@basic ",
expectedResults: 0,
});

// The private engine is not configured with any trending url.
await check_results({
featureEnabled: true,
searchMode: "@private ",
expectedResults: 0,
});
});

async function check_results({
featureEnabled = false,
requireSearchModeEnabled = true,
searchMode = "",
expectedResults = 0,
}) {
await SpecialPowers.pushPrefEnv({
set: [
["browser.urlbar.trending.featureGate", featureEnabled],
["browser.urlbar.trending.requireSearchMode", requireSearchModeEnabled],
],
});

// If we are not in a search mode and there are no results. The urlbar
// will not open.
if (!searchMode && !expectedResults) {
window.gURLBar.inputField.focus();
Assert.ok(!UrlbarTestUtils.isPopupOpen(window));
return;
}

await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: searchMode,
waitForFocus: SimpleTest.waitForFocus,
});

Assert.equal(
UrlbarTestUtils.getResultCount(window),
expectedResults,
"We matched the expected number of results"
);

if (expectedResults) {
for (let i = 0; i < expectedResults; i++) {
let { result } = await UrlbarTestUtils.getDetailsOfResultAt(window, i);
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.SEARCH);
Assert.equal(result.providerName, "SearchSuggestions");
Assert.equal(result.payload.engine, "basic");
}
}

if (searchMode) {
await UrlbarTestUtils.exitSearchMode(window);
}
await UrlbarTestUtils.promisePopupClose(window, () => {
EventUtils.synthesizeKey("KEY_Escape");
});
await SpecialPowers.popPrefEnv();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"chrome_settings_overrides": {
"search_provider": {
"name": "basic",
"keyword": "@basic",
"search_url": "https://mochi.test:8888/browser/browser/components/search/test/browser/?search={searchTerms}&foo=1",
"suggest_url": "https://mochi.test:8888/browser/browser/modules/test/browser/usageTelemetrySearchSuggestions.sjs?{searchTerms}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"chrome_settings_overrides": {
"search_provider": {
"name": "private",
"keyword": "@private",
"search_url": "https://example.com",
"suggest_url": "https://example.com?search={searchTerms}"
}
Expand Down
9 changes: 9 additions & 0 deletions browser/components/urlbar/UrlbarPrefs.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,16 @@ const PREF_URLBAR_DEFAULTS = new Map([
// when the user focuses the urlbar without typing anything. If false, the
// user must type weather-related keywords to show weather suggestions.
["weather.zeroPrefix", true],

// Feature gate pref for trending suggestions in the urlbar.
["trending.featureGate", false],

// Whether to only show trending results when the urlbar is in search
// mode or when the user initially opens the urlbar without selecting
// an engine.
["trending.requireSearchMode", true],
]);

const PREF_OTHER_DEFAULTS = new Map([
["browser.fixup.dns_first_for_single_words", false],
["browser.search.suggest.enabled", true],
Expand Down
Loading

0 comments on commit 3ede9de

Please sign in to comment.