summaryrefslogtreecommitdiffstats
path: root/browser/components
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-23 04:29:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-23 04:29:08 +0000
commit0ce6c14b1b17b78e45c0592bd3e404adbc26ed3e (patch)
treec8c48fae9c5a35b94ab93af4fc24cf1d2fb4bdf1 /browser/components
parentAdding upstream version 125.0.1. (diff)
downloadfirefox-0ce6c14b1b17b78e45c0592bd3e404adbc26ed3e.tar.xz
firefox-0ce6c14b1b17b78e45c0592bd3e404adbc26ed3e.zip
Adding upstream version 125.0.2.upstream/125.0.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components')
-rw-r--r--browser/components/downloads/DownloadsCommon.sys.mjs2
-rw-r--r--browser/components/downloads/DownloadsViewUI.sys.mjs2
-rw-r--r--browser/components/downloads/test/browser/browser_download_overwrite.js2
-rw-r--r--browser/components/originattributes/test/browser/browser_firstPartyIsolation_saveAs.js1
-rw-r--r--browser/components/syncedtabs/sidebar.xhtml5
-rw-r--r--browser/components/urlbar/UrlbarPrefs.sys.mjs7
-rw-r--r--browser/components/urlbar/private/YelpSuggestions.sys.mjs18
-rw-r--r--browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js359
8 files changed, 332 insertions, 64 deletions
diff --git a/browser/components/downloads/DownloadsCommon.sys.mjs b/browser/components/downloads/DownloadsCommon.sys.mjs
index 776d219ae7..d88b2c4cd0 100644
--- a/browser/components/downloads/DownloadsCommon.sys.mjs
+++ b/browser/components/downloads/DownloadsCommon.sys.mjs
@@ -696,7 +696,7 @@ export var DownloadsCommon = {
message = s.unblockTypePotentiallyUnwanted2;
break;
case lazy.Downloads.Error.BLOCK_VERDICT_INSECURE:
- message = s.unblockInsecure3;
+ message = s.unblockInsecure2;
break;
default:
// Assume Downloads.Error.BLOCK_VERDICT_MALWARE
diff --git a/browser/components/downloads/DownloadsViewUI.sys.mjs b/browser/components/downloads/DownloadsViewUI.sys.mjs
index ffcd3b61fa..9c6bd17d63 100644
--- a/browser/components/downloads/DownloadsViewUI.sys.mjs
+++ b/browser/components/downloads/DownloadsViewUI.sys.mjs
@@ -888,7 +888,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
case lazy.Downloads.Error.BLOCK_VERDICT_INSECURE:
return [
s.blockedPotentiallyInsecure,
- [s.unblockInsecure3, s.unblockTip2],
+ [s.unblockInsecure2, s.unblockTip2],
];
case lazy.Downloads.Error.BLOCK_VERDICT_POTENTIALLY_UNWANTED:
return [
diff --git a/browser/components/downloads/test/browser/browser_download_overwrite.js b/browser/components/downloads/test/browser/browser_download_overwrite.js
index b1de07b5ed..8246ec9f55 100644
--- a/browser/components/downloads/test/browser/browser_download_overwrite.js
+++ b/browser/components/downloads/test/browser/browser_download_overwrite.js
@@ -5,7 +5,7 @@
const TEST_ROOT = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content",
- "https://example.com"
+ "http://example.com"
);
var MockFilePicker = SpecialPowers.MockFilePicker;
diff --git a/browser/components/originattributes/test/browser/browser_firstPartyIsolation_saveAs.js b/browser/components/originattributes/test/browser/browser_firstPartyIsolation_saveAs.js
index c54bb1aec1..0266765782 100644
--- a/browser/components/originattributes/test/browser/browser_firstPartyIsolation_saveAs.js
+++ b/browser/components/originattributes/test/browser/browser_firstPartyIsolation_saveAs.js
@@ -38,7 +38,6 @@ add_setup(async function () {
set: [
["privacy.firstparty.isolate", true],
["dom.security.https_first", false],
- ["dom.block_download_insecure", false],
],
});
diff --git a/browser/components/syncedtabs/sidebar.xhtml b/browser/components/syncedtabs/sidebar.xhtml
index 8091f61aee..7790620f94 100644
--- a/browser/components/syncedtabs/sidebar.xhtml
+++ b/browser/components/syncedtabs/sidebar.xhtml
@@ -15,7 +15,10 @@
<link
rel="stylesheet"
- media="all"
+ href="chrome://global/skin/design-system/tokens-brand.css"
+ />
+ <link
+ rel="stylesheet"
href="chrome://browser/skin/syncedtabs/sidebar.css"
/>
<link rel="localization" href="browser/syncedTabs.ftl" />
diff --git a/browser/components/urlbar/UrlbarPrefs.sys.mjs b/browser/components/urlbar/UrlbarPrefs.sys.mjs
index c521264fa5..022d0b1c7c 100644
--- a/browser/components/urlbar/UrlbarPrefs.sys.mjs
+++ b/browser/components/urlbar/UrlbarPrefs.sys.mjs
@@ -485,9 +485,9 @@ const PREF_URLBAR_DEFAULTS = new Map([
// Feature gate pref for Yelp suggestions in the urlbar.
["yelp.featureGate", false],
- // The minimum number of characters the user must type to trigger a Yelp
- // suggestion (excluding full keywords that are shorter than this).
- ["yelp.minKeywordLength", 5],
+ // The minimum prefix length of a Yelp keyword the user must type to trigger
+ // the suggestion. 0 means the min length should be taken from Nimbus.
+ ["yelp.minKeywordLength", 0],
// Whether Yelp suggestions should be shown as top picks. This is a fallback
// pref for the `yelpSuggestPriority` Nimbus variable.
@@ -526,6 +526,7 @@ const NIMBUS_DEFAULTS = {
weatherKeywordsMinimumLength: 0,
weatherKeywordsMinimumLengthCap: 0,
weatherSimpleUI: false,
+ yelpMinKeywordLength: 0,
};
// Maps preferences under browser.urlbar.suggest to behavior names, as defined
diff --git a/browser/components/urlbar/private/YelpSuggestions.sys.mjs b/browser/components/urlbar/private/YelpSuggestions.sys.mjs
index a1ac13177b..4cf454c71d 100644
--- a/browser/components/urlbar/private/YelpSuggestions.sys.mjs
+++ b/browser/components/urlbar/private/YelpSuggestions.sys.mjs
@@ -227,19 +227,11 @@ export class YelpSuggestions extends BaseFeature {
}
get #minKeywordLength() {
- // It's unusual to get both a Nimbus variable and its fallback pref at the
- // same time, but we have a good reason. To recap, if a variable doesn't
- // have a value, then the value of its fallback will be returned; otherwise
- // the variable value will be returned. That's usually what we want, but for
- // Yelp, we set the pref each time the user clicks "show less frequently",
- // and we want the variable to act only as an initial min length. In other
- // words, if the pref has a user value (because we set it), use it;
- // otherwise use the initial value defined by the variable.
- return Math.max(
- lazy.UrlbarPrefs.get("yelpMinKeywordLength") || 0,
- lazy.UrlbarPrefs.get("yelp.minKeywordLength") || 0,
- 0
- );
+ let minLength =
+ lazy.UrlbarPrefs.get("yelp.minKeywordLength") ||
+ lazy.UrlbarPrefs.get("yelpMinKeywordLength") ||
+ 0;
+ return Math.max(minLength, 0);
}
async #fetchCity() {
diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js
index aa9c700f1c..3c61e9afea 100644
--- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js
+++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_yelp.js
@@ -26,6 +26,21 @@ const REMOTE_SETTINGS_RECORDS = [
},
];
+const AB_RESULT = {
+ url: "https://www.yelp.com/search?find_desc=ab&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl: "https://www.yelp.com/search?find_desc=ab",
+ displayUrl: "yelp.com/search?find_desc=ab&find_loc=Yokohama,+Kanagawa",
+ title: "ab in Yokohama, Kanagawa",
+};
+
+const ALONGERKEYWORD_RESULT = {
+ url: "https://www.yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl: "https://www.yelp.com/search?find_desc=alongerkeyword",
+ displayUrl:
+ "yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama,+Kanagawa",
+ title: "alongerkeyword in Yokohama, Kanagawa",
+};
+
add_setup(async function () {
Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
@@ -139,12 +154,7 @@ add_task(async function basic() {
{
description: "Subject exact match with length < minKeywordLength",
query: "ab",
- expected: {
- url: "https://www.yelp.com/search?find_desc=ab&find_loc=Yokohama%2C+Kanagawa",
- originalUrl: "https://www.yelp.com/search?find_desc=ab",
- displayUrl: "yelp.com/search?find_desc=ab&find_loc=Yokohama,+Kanagawa",
- title: "ab in Yokohama, Kanagawa",
- },
+ expected: AB_RESULT,
},
{
description:
@@ -174,65 +184,35 @@ add_task(async function basic() {
{
description: "Query length == minKeywordLength, subject not exact match",
query: "along",
- expected: {
- url: "https://www.yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
- originalUrl: "https://www.yelp.com/search?find_desc=alongerkeyword",
- displayUrl:
- "yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama,+Kanagawa",
- title: "alongerkeyword in Yokohama, Kanagawa",
- },
+ expected: ALONGERKEYWORD_RESULT,
},
{
description:
"Query length == minKeywordLength, subject not exact match, showLessFrequentlyCount non-zero",
query: "along",
showLessFrequentlyCount: 1,
- expected: {
- url: "https://www.yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
- originalUrl: "https://www.yelp.com/search?find_desc=alongerkeyword",
- displayUrl:
- "yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama,+Kanagawa",
- title: "alongerkeyword in Yokohama, Kanagawa",
- },
+ expected: ALONGERKEYWORD_RESULT,
},
{
description:
"Query length == minKeywordLength + showLessFrequentlyCount, subject not exact match",
query: "alonge",
showLessFrequentlyCount: 1,
- expected: {
- url: "https://www.yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
- originalUrl: "https://www.yelp.com/search?find_desc=alongerkeyword",
- displayUrl:
- "yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama,+Kanagawa",
- title: "alongerkeyword in Yokohama, Kanagawa",
- },
+ expected: ALONGERKEYWORD_RESULT,
},
{
description:
"Query length < minKeywordLength + showLessFrequentlyCount, subject not exact match",
query: "alonge",
showLessFrequentlyCount: 2,
- expected: {
- url: "https://www.yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
- originalUrl: "https://www.yelp.com/search?find_desc=alongerkeyword",
- displayUrl:
- "yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama,+Kanagawa",
- title: "alongerkeyword in Yokohama, Kanagawa",
- },
+ expected: ALONGERKEYWORD_RESULT,
},
{
description:
"Query length == minKeywordLength + showLessFrequentlyCount, subject not exact match",
query: "alonger",
showLessFrequentlyCount: 2,
- expected: {
- url: "https://www.yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
- originalUrl: "https://www.yelp.com/search?find_desc=alongerkeyword",
- displayUrl:
- "yelp.com/search?find_desc=alongerkeyword&find_loc=Yokohama,+Kanagawa",
- title: "alongerkeyword in Yokohama, Kanagawa",
- },
+ expected: ALONGERKEYWORD_RESULT,
},
];
@@ -632,8 +612,9 @@ add_task(async function notInterested() {
// Tests the "show less frequently" behavior.
add_task(async function showLessFrequently() {
- UrlbarPrefs.set("yelp.showLessFrequentlyCount", 0);
- UrlbarPrefs.set("yelp.minKeywordLength", 0);
+ UrlbarPrefs.clear("yelp.showLessFrequentlyCount");
+ UrlbarPrefs.clear("yelp.minKeywordLength");
+
let cleanUpNimbus = await UrlbarTestUtils.initNimbusFeature({
yelpMinKeywordLength: 0,
yelpShowLessFrequentlyCap: 3,
@@ -790,6 +771,298 @@ add_task(async function rustProviders() {
await QuickSuggestTestUtils.forceSync();
});
+add_task(async function minKeywordLength_noPrefValue() {
+ await doMinKeywordLengthTest({
+ // expected min length: 5 (Nimbus value)
+ prefValue: null,
+ nimbusValue: 5,
+ tests: [
+ {
+ query: "al",
+ expected: null,
+ },
+ {
+ query: "alo",
+ expected: null,
+ },
+ {
+ query: "alon",
+ expected: null,
+ },
+ {
+ query: "along",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alongerkeyword",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "best a",
+ expected: null,
+ },
+ {
+ query: "best al",
+ expected: {
+ url: "https://www.yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl:
+ "https://www.yelp.com/search?find_desc=best+alongerkeyword",
+ displayUrl:
+ "yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama,+Kanagawa",
+ title: "best alongerkeyword in Yokohama, Kanagawa",
+ },
+ },
+ {
+ query: "ab",
+ expected: AB_RESULT,
+ },
+ ],
+ });
+});
+
+add_task(async function minKeywordLength_smallerPrefValue() {
+ await doMinKeywordLengthTest({
+ // expected min length: 4 (pref value)
+ prefValue: 4,
+ nimbusValue: 5,
+ tests: [
+ {
+ query: "al",
+ expected: null,
+ },
+ {
+ query: "alo",
+ expected: null,
+ },
+ {
+ query: "alon",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "along",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alongerkeyword",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "best a",
+ expected: null,
+ },
+ {
+ query: "best al",
+ expected: {
+ url: "https://www.yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl:
+ "https://www.yelp.com/search?find_desc=best+alongerkeyword",
+ displayUrl:
+ "yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama,+Kanagawa",
+ title: "best alongerkeyword in Yokohama, Kanagawa",
+ },
+ },
+ {
+ query: "ab",
+ expected: AB_RESULT,
+ },
+ ],
+ });
+});
+
+add_task(async function minKeywordLength_largerPrefValue() {
+ await doMinKeywordLengthTest({
+ // expected min length: 6 (pref value)
+ prefValue: 6,
+ nimbusValue: 5,
+ tests: [
+ {
+ query: "al",
+ expected: null,
+ },
+ {
+ query: "alo",
+ expected: null,
+ },
+ {
+ query: "alon",
+ expected: null,
+ },
+ {
+ query: "along",
+ expected: null,
+ },
+ {
+ query: "alonge",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alongerkeyword",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "best a",
+ expected: null,
+ },
+ {
+ query: "best al",
+ expected: {
+ url: "https://www.yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl:
+ "https://www.yelp.com/search?find_desc=best+alongerkeyword",
+ displayUrl:
+ "yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama,+Kanagawa",
+ title: "best alongerkeyword in Yokohama, Kanagawa",
+ },
+ },
+ {
+ query: "ab",
+ expected: AB_RESULT,
+ },
+ ],
+ });
+});
+
+add_task(async function minKeywordLength_onlyPrefValue() {
+ await doMinKeywordLengthTest({
+ // expected min length: 5 (pref value)
+ prefValue: 5,
+ nimbusValue: null,
+ tests: [
+ {
+ query: "al",
+ expected: null,
+ },
+ {
+ query: "alo",
+ expected: null,
+ },
+ {
+ query: "alon",
+ expected: null,
+ },
+ {
+ query: "along",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alongerkeyword",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "best a",
+ expected: null,
+ },
+ {
+ query: "best al",
+ expected: {
+ url: "https://www.yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl:
+ "https://www.yelp.com/search?find_desc=best+alongerkeyword",
+ displayUrl:
+ "yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama,+Kanagawa",
+ title: "best alongerkeyword in Yokohama, Kanagawa",
+ },
+ },
+ {
+ query: "ab",
+ expected: AB_RESULT,
+ },
+ ],
+ });
+});
+
+// When no min length is defined in Nimbus or the pref, we should fall back to
+// the hardcoded value of 2 in the Rust component.
+add_task(async function minKeywordLength_noNimbusOrPrefValue() {
+ await doMinKeywordLengthTest({
+ // expected min length: 2 (hardcoded)
+ prefValue: null,
+ nimbusValue: null,
+ tests: [
+ {
+ query: "al",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alo",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alon",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "along",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "alongerkeyword",
+ expected: ALONGERKEYWORD_RESULT,
+ },
+ {
+ query: "best a",
+ expected: null,
+ },
+ {
+ query: "best al",
+ expected: {
+ url: "https://www.yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama%2C+Kanagawa",
+ originalUrl:
+ "https://www.yelp.com/search?find_desc=best+alongerkeyword",
+ displayUrl:
+ "yelp.com/search?find_desc=best+alongerkeyword&find_loc=Yokohama,+Kanagawa",
+ title: "best alongerkeyword in Yokohama, Kanagawa",
+ },
+ },
+ {
+ query: "ab",
+ expected: AB_RESULT,
+ },
+ ],
+ });
+});
+
+async function doMinKeywordLengthTest({ prefValue, nimbusValue, tests }) {
+ // Set or clear the pref.
+ let originalPrefValue = Services.prefs.prefHasUserValue(
+ "browser.urlbar.yelp.minKeywordLength"
+ )
+ ? UrlbarPrefs.get("yelp.minKeywordLength")
+ : null;
+ if (typeof prefValue == "number") {
+ UrlbarPrefs.set("yelp.minKeywordLength", prefValue);
+ } else {
+ UrlbarPrefs.clear("yelp.minKeywordLength");
+ }
+
+ // Set up Nimbus.
+ let cleanUpNimbus;
+ if (typeof nimbusValue == "number") {
+ cleanUpNimbus = await UrlbarTestUtils.initNimbusFeature({
+ yelpMinKeywordLength: nimbusValue,
+ });
+ }
+
+ for (let { query, expected } of tests) {
+ info("Running min keyword length test with query: " + query);
+ await check_results({
+ context: createContext(query, {
+ providers: [UrlbarProviderQuickSuggest.name],
+ isPrivate: false,
+ }),
+ matches: expected ? [makeExpectedResult(expected)] : [],
+ });
+ }
+
+ await cleanUpNimbus?.();
+
+ if (originalPrefValue === null) {
+ UrlbarPrefs.clear("yelp.minKeywordLength");
+ } else {
+ UrlbarPrefs.set("yelp.minKeywordLength", originalPrefValue);
+ }
+}
+
function makeExpectedResult({
url,
title,