Skip to content

Commit

Permalink
Bug 1866616 - Save the current date when starting a search from the s…
Browse files Browse the repository at this point in the history
…earch bar. r=dao,search-reviewers,daleharvey

Differential Revision: https://phabricator.services.mozilla.com/D194754
  • Loading branch information
klubana-m committed Nov 28, 2023
1 parent 781ad0b commit da80378
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions browser/components/search/content/searchbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
FormHistory: "resource://gre/modules/FormHistory.sys.mjs",
SearchSuggestionController:
"resource://gre/modules/SearchSuggestionController.sys.mjs",
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
});

/**
Expand Down Expand Up @@ -425,6 +426,13 @@
"searchbar",
details
);

// Record when the user uses the search bar
lazy.UrlbarPrefs.set(
"browser.search.widget.lastUsed",
new Date().toISOString()
);

// null parameter below specifies HTML response for search
let params = {
postData: submission.postData,
Expand Down
3 changes: 3 additions & 0 deletions browser/components/urlbar/UrlbarPrefs.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ const PREF_URLBAR_DEFAULTS = new Map([

// We only show recent searches within the past 31 days by default.
["recentsearches.expirationDays", 31],

// The last time (as ISO string) the user used the search bar.
["browser.search.widget.lastUsed", ""],
]);

const PREF_OTHER_DEFAULTS = new Map([
Expand Down

0 comments on commit da80378

Please sign in to comment.