Context.isPrivate) { // Tab groups can't be saved or reopened in private windows. return results; } for (let savedGroup of lazy.SessionStore.getSavedTabGroups()) { if (!this.#matches(savedGroup.name, queryContext)) { continue; } results.push( this.#makeResult({ key: `tabgroup-${i++}`, l10nId: "urlbar-result-action-open-saved-tabgroup", l10nArgs: { group: savedGroup.name }, onPick: (_queryContext, _controller) => { let group = lazy.SessionStore.openSavedTabGroup( savedGroup.id, window, { source: lazy.TabMetrics.METRIC_SOURCE.SUGGEST, } ); this.#switchToGroup(group); }, color: savedGroup.color, }) ); } return results; } #matches(groupName, queryContext) { groupName = groupName.toLowerCase(); if (queryContext.trimmedLowerCaseSearchString.length == 1) { return groupName.startsWith(queryContext.trimmedLowerCaseSearchString); } return queryContext.tokens.every(token => groupName.includes(token.lowerCaseValue) ); } #makeResult({ key, l10nId, l10nArgs, onPick, color }) { return new ActionsResult({ key, l10nId, l10nArgs, onPick, icon: "chrome://browser/skin/tabbrowser/tab-groups.svg", dataset: { style: { "--tab-group-color": `var(--tab-group-color-${color})`, "--tab-group-color-invert": `var(--tab-group-color-${color}-invert)`, "--tab-group-color-pale": `var(--tab-group-color-${color}-pale)`, }, }, }); } #switchToGroup(group) { group.select(); group.ownerGlobal.focus(); } } export var ActionsProviderTabGroups = new ProviderTabGroups(); PK