Skip to content

Commit d393385

Browse files
committed
Update heuristic logic for tab search
1 parent 564d2b2 commit d393385

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed
Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
diff --git a/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs b/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs
2-
index dcf1af43d62..17dbaaa66aa 100644
2+
index dcf1af43d62..116865b068a 100644
33
--- a/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs
44
+++ b/browser/components/urlbar/UrlbarMuxerUnifiedComplete.sys.mjs
5-
@@ -117,6 +117,21 @@ class MuxerUnifiedComplete extends UrlbarMuxer {
5+
@@ -117,6 +117,17 @@ class MuxerUnifiedComplete extends UrlbarMuxer {
66
// When you add state, update _copyState() as necessary.
77
};
88

9-
+ const allFromPlaces = unsortedResults.every(
10-
+ result => result.providerName === "Places"
11-
+ );
12-
+
13-
+ // If all results are from "Places", sort by lastOpened
14-
+ if (allFromPlaces) {
9+
+ let window = Services.wm.getMostRecentWindow("navigator:browser");
10+
+ if (window && window.gURLBar && window.gURLBar.searchMode && window.gURLBar.searchMode.source === 4) {
1511
+ unsortedResults.sort((a, b) => {
1612
+ const lastOpenedA = a.payload?.lastOpened || 0;
1713
+ const lastOpenedB = b.payload?.lastOpened|| 0;
@@ -24,11 +20,3 @@ index dcf1af43d62..17dbaaa66aa 100644
2420
// Do the first pass over all results to build some state.
2521
for (let result of unsortedResults) {
2622
// Add each result to the appropriate `resultsByGroup` map.
27-
@@ -794,6 +807,7 @@ class MuxerUnifiedComplete extends UrlbarMuxer {
28-
}
29-
30-
if (result.providerName == lazy.UrlbarProviderTabToSearch.name) {
31-
+ return false;
32-
// Discard the result if a tab-to-search result was added already.
33-
if (!state.canAddTabToSearch) {
34-
return false;

0 commit comments

Comments
 (0)