From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- browser/components/firefoxview/history.mjs | 67 ++++++++++++++---------------- 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'browser/components/firefoxview/history.mjs') diff --git a/browser/components/firefoxview/history.mjs b/browser/components/firefoxview/history.mjs index 478422d49b..4919f94e9c 100644 --- a/browser/components/firefoxview/history.mjs +++ b/browser/components/firefoxview/history.mjs @@ -15,13 +15,13 @@ import { import { ViewPage } from "./viewpage.mjs"; // eslint-disable-next-line import/no-unassigned-import import "chrome://browser/content/migration/migration-wizard.mjs"; -import { HistoryController } from "./HistoryController.mjs"; // eslint-disable-next-line import/no-unassigned-import import "chrome://global/content/elements/moz-button.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + HistoryController: "resource:///modules/HistoryController.sys.mjs", ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs", }); @@ -47,7 +47,7 @@ class HistoryInView extends ViewPage { this.cumulativeSearches = 0; } - controller = new HistoryController(this, { + controller = new lazy.HistoryController(this, { searchResultsLimit: SEARCH_RESULTS_LIMIT, }); @@ -57,7 +57,7 @@ class HistoryInView extends ViewPage { } this._started = true; - this.controller.updateAllHistoryItems(); + this.controller.updateCache(); this.toggleVisibilityInCardContainer(); } @@ -170,8 +170,8 @@ class HistoryInView extends ViewPage { this.recordContextMenuTelemetry("delete-from-history", e); } - async onChangeSortOption(e) { - await this.controller.onChangeSortOption(e); + onChangeSortOption(e) { + this.controller.onChangeSortOption(e); Services.telemetry.recordEvent( "firefoxview_next", "sort_history", @@ -184,8 +184,8 @@ class HistoryInView extends ViewPage { ); } - async onSearchQuery(e) { - await this.controller.onSearchQuery(e); + onSearchQuery(e) { + this.controller.onSearchQuery(e); this.cumulativeSearches = this.controller.searchQuery ? this.cumulativeSearches + 1 : 0; @@ -287,7 +287,7 @@ class HistoryInView extends ViewPage { get cardsTemplate() { if (this.controller.searchResults) { return this.#searchResultsTemplate(); - } else if (this.controller.allHistoryItems.size) { + } else if (!this.controller.isHistoryEmpty) { return this.#historyCardsTemplate(); } return this.#emptyMessageTemplate(); @@ -295,14 +295,11 @@ class HistoryInView extends ViewPage { #historyCardsTemplate() { let cardsTemplate = []; - if ( - this.controller.sortOption === "date" && - this.controller.historyMapByDate.length - ) { - this.controller.historyMapByDate.forEach(historyItem => { - if (historyItem.items.length) { + switch (this.controller.sortOption) { + case "date": + cardsTemplate = this.controller.historyVisits.map(historyItem => { let dateArg = JSON.stringify({ date: historyItem.items[0].time }); - cardsTemplate.push(html` + return html`

${this.panelListTemplate()} - `); - } - }); - } else if (this.controller.historyMapBySite.length) { - this.controller.historyMapBySite.forEach(historyItem => { - if (historyItem.items.length) { - cardsTemplate.push(html` + `; + }); + break; + case "site": + cardsTemplate = this.controller.historyVisits.map(historyItem => { + return html`

${historyItem.domain}

@@ -338,15 +334,15 @@ class HistoryInView extends ViewPage { dateTimeFormat="dateTime" hasPopup="menu" maxTabsLength=${this.maxTabsLength} - .tabItems=${[...historyItem.items]} + .tabItems=${historyItem.items} @fxview-tab-list-primary-action=${this.onPrimaryAction} @fxview-tab-list-secondary-action=${this.onSecondaryAction} > ${this.panelListTemplate()} -
`); - } - }); + `; + }); + break; } return cardsTemplate; } @@ -420,7 +416,6 @@ class HistoryInView extends ViewPage { .tabItems=${this.controller.searchResults} @fxview-tab-list-primary-action=${this.onPrimaryAction} @fxview-tab-list-secondary-action=${this.onSecondaryAction} - .searchInProgress=${this.controller.placesQuery.searchInProgress} > ${this.panelListTemplate()} @@ -491,12 +486,19 @@ class HistoryInView extends ViewPage { class="import-history-banner" hideHeader="true" ?hidden=${!this.shouldShowImportBanner()} + role="group" + aria-labelledby="header" + aria-describedby="description" >
@@ -518,7 +520,7 @@ class HistoryInView extends ViewPage {