pinMultiSelectedTabs hands pinTab a bare metrics context, so pinned_tabs.pin records source "unknown"
Categories
(Firefox :: Tabbed Browser, task, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox156 | --- | fixed |
People
(Reporter: dao, Assigned: dao)
Details
Attachments
(1 file)
Tabbrowser.pinMultiSelectedTabs calls pinTab like this:
this.pinTab(tab, this.TabMetrics.decomposedContext(metricsContext));
but pinTab(aTab, { metricsContext = this.TabMetrics.UNKNOWN_CONTEXT } = {}) takes an options object. It looks for a metricsContext property on the context object it was handed, finds none, and falls back to UNKNOWN_CONTEXT.
That context reaches #notifyPinnedStatus, which puts it on the TabPinned event as detail.metricsContext. BrowserUsageTelemetry._onTabPinned records Glean.pinnedTabs.pin with source: event.detail.metricsContext.telemetrySource, so pinning a multi-selection records source: "unknown" for each tab rather than the surface the user pinned from.
Pinning a single tab is unaffected. So is the aggregate tab.interaction event: recordTabMetrics skips both a decomposed context and a non-user-triggered one, so the per-tab call records nothing either way.
unpinMultiSelectedTabs, directly below it, does it correctly:
this.unpinTab(selectedTabs[i], {
metricsContext: this.TabMetrics.decomposedContext(metricsContext),
});
Both are in browser/components/tabbrowser/Tabbrowser.sys.mjs, and browser/components/tabbrowser/test/browser/tabs/browser_multiselect_tabs_pin_unpin.js is where a test for the recorded source would go.
Found while documenting the class's option-bag parameters for bug 2065769. TypeScript does not catch it: the argument is a call result rather than a fresh object literal, so no excess-property check applies.
| Assignee | ||
Comment 1•21 days ago
|
||
Correction to the last paragraph above: TypeScript does catch this. With the class under checkJs, tsc reports
Tabbrowser.sys.mjs(8867,24): error TS2559: Type 'TabMetricsContext' has no properties in common with type '{ metricsContext?: TabMetricsContext; }'.
The weak-type check fires whenever the source type shares no properties with the target, whether or not the argument is a fresh object literal, so the excess-property reasoning I gave does not apply. The rest of the description stands.
| Assignee | ||
Comment 2•21 days ago
|
||
Updated•21 days ago
|
Updated•19 days ago
|
| Assignee | ||
Updated•18 days ago
|
Comment 4•17 days ago
|
||
| bugherder | ||
Updated•9 days ago
|
Description
•