Bug 1918702 - Migrate telemetry events to use Glean APIs for screenshots, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D222607
This commit is contained in:
@@ -115,7 +115,7 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
|
||||
|
||||
switch (event.type) {
|
||||
case "beforeunload":
|
||||
this.requestCancelScreenshot("navigation");
|
||||
this.requestCancelScreenshot("Navigation");
|
||||
break;
|
||||
case "resize":
|
||||
if (!this.#resizeTask && this.overlay?.initialized) {
|
||||
@@ -148,8 +148,8 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
|
||||
break;
|
||||
}
|
||||
case "Screenshots:RecordEvent": {
|
||||
let { eventName, reason, args } = event.detail;
|
||||
this.recordTelemetryEvent(eventName, reason, args);
|
||||
let { eventName, args } = event.detail;
|
||||
Glean.screenshots[eventName].record(args);
|
||||
break;
|
||||
}
|
||||
case "Screenshots:ShowPanel":
|
||||
@@ -424,8 +424,4 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
|
||||
};
|
||||
return rect;
|
||||
}
|
||||
|
||||
recordTelemetryEvent(type, object, args = {}) {
|
||||
Services.telemetry.recordEvent("screenshots", type, object, null, args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ document.addEventListener(
|
||||
OpenBrowserWindow({ private: true });
|
||||
break;
|
||||
case "Browser:Screenshot":
|
||||
ScreenshotsUtils.notify(window, "shortcut");
|
||||
ScreenshotsUtils.notify(window, "Shortcut");
|
||||
break;
|
||||
// TODO: <observes>
|
||||
// "History:UndoCloseTab": function () {
|
||||
|
||||
@@ -1572,7 +1572,7 @@ export class nsContextMenu {
|
||||
Services.obs.notifyObservers(
|
||||
this.window,
|
||||
"menuitem-screenshot",
|
||||
"context_menu"
|
||||
"ContextMenu"
|
||||
);
|
||||
} else {
|
||||
Services.obs.notifyObservers(
|
||||
|
||||
@@ -559,7 +559,7 @@ if (!lazy.screenshotsDisabled) {
|
||||
Services.obs.notifyObservers(
|
||||
aEvent.currentTarget.ownerGlobal,
|
||||
"menuitem-screenshot",
|
||||
"toolbar_button"
|
||||
"ToolbarButton"
|
||||
);
|
||||
} else {
|
||||
Services.obs.notifyObservers(
|
||||
|
||||
@@ -409,7 +409,7 @@ export class ScreenshotsOverlay {
|
||||
maybeCancelScreenshots() {
|
||||
if (this.#state === STATES.CROSSHAIRS) {
|
||||
this.#dispatchEvent("Screenshots:Close", {
|
||||
reason: "overlay_cancel",
|
||||
reason: "OverlayCancel",
|
||||
});
|
||||
} else {
|
||||
this.#setState(STATES.CROSSHAIRS);
|
||||
@@ -1167,8 +1167,7 @@ export class ScreenshotsOverlay {
|
||||
#setState(newState, options = {}) {
|
||||
if (this.#state === STATES.SELECTED && newState === STATES.CROSSHAIRS) {
|
||||
this.#dispatchEvent("Screenshots:RecordEvent", {
|
||||
eventName: "started",
|
||||
reason: "overlay_retry",
|
||||
eventName: "startedOverlayRetry",
|
||||
});
|
||||
}
|
||||
if (newState !== this.#state) {
|
||||
@@ -1500,8 +1499,7 @@ export class ScreenshotsOverlay {
|
||||
this.selectionRegion.dimensions = this.hoverElementRegion.dimensions;
|
||||
this.#setState(STATES.SELECTED, options);
|
||||
this.#dispatchEvent("Screenshots:RecordEvent", {
|
||||
eventName: "selected",
|
||||
reason: "element",
|
||||
eventName: "selectedElement",
|
||||
});
|
||||
this.#methodsUsed.element += 1;
|
||||
} else {
|
||||
@@ -1552,8 +1550,7 @@ export class ScreenshotsOverlay {
|
||||
REGION_CHANGE_THRESHOLD)
|
||||
) {
|
||||
this.#dispatchEvent("Screenshots:RecordEvent", {
|
||||
eventName: "selected",
|
||||
reason: "region_selection",
|
||||
eventName: "selectedRegionSelection",
|
||||
});
|
||||
}
|
||||
this.#previousDimensions = { width, height };
|
||||
|
||||
@@ -221,7 +221,7 @@ export var ScreenshotsUtils = {
|
||||
// The chromeEventHandler in the child actor will handle events that
|
||||
// don't match this
|
||||
if (event.target.parentElement === this.panelForBrowser(browser)) {
|
||||
this.cancel(browser, "escape");
|
||||
this.cancel(browser, "Escape");
|
||||
}
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
@@ -263,7 +263,7 @@ export var ScreenshotsUtils = {
|
||||
"Screenshots:RemoveEventListeners"
|
||||
);
|
||||
} else {
|
||||
this.cancel(oldBrowser, "navigation");
|
||||
this.cancel(oldBrowser, "Navigation");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -296,7 +296,7 @@ export var ScreenshotsUtils = {
|
||||
handleTabSelect(event) {
|
||||
let previousTab = event.detail.previousTab;
|
||||
if (this.getUIPhase(previousTab.linkedBrowser) === UIPhases.INITIAL) {
|
||||
this.cancel(previousTab.linkedBrowser, "navigation");
|
||||
this.cancel(previousTab.linkedBrowser, "Navigation");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -430,7 +430,11 @@ export var ScreenshotsUtils = {
|
||||
type
|
||||
);
|
||||
} else {
|
||||
Services.obs.notifyObservers(null, "menuitem-screenshot-extension", type);
|
||||
Services.obs.notifyObservers(
|
||||
null,
|
||||
"menuitem-screenshot-extension",
|
||||
type.toLowerCase()
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -505,7 +509,7 @@ export var ScreenshotsUtils = {
|
||||
* @param browser The current browser.
|
||||
*/
|
||||
cancel(browser, reason) {
|
||||
this.recordTelemetryEvent("canceled", reason, {});
|
||||
this.recordTelemetryEvent("canceled" + reason);
|
||||
this.exit(browser);
|
||||
},
|
||||
|
||||
@@ -799,7 +803,7 @@ export var ScreenshotsUtils = {
|
||||
async showPanelAndOverlay(browser, data) {
|
||||
let actor = this.getActor(browser);
|
||||
actor.sendAsyncMessage("Screenshots:ShowOverlay");
|
||||
this.recordTelemetryEvent("started", data, {});
|
||||
this.recordTelemetryEvent("started" + data);
|
||||
this.openPanel(browser);
|
||||
},
|
||||
|
||||
@@ -982,7 +986,7 @@ export var ScreenshotsUtils = {
|
||||
{ id: "screenshots-too-large-error-details" },
|
||||
]);
|
||||
this.showAlertMessage(errorTitle.value, errorMessage.value);
|
||||
this.recordTelemetryEvent("failed", "screenshot_too_large", null);
|
||||
this.recordTelemetryEvent("failedScreenshotTooLarge");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1003,7 +1007,7 @@ export var ScreenshotsUtils = {
|
||||
|
||||
let rect;
|
||||
let lastUsedMethod;
|
||||
if (type === "full_page") {
|
||||
if (type === "FullPage") {
|
||||
rect = await this.fetchFullPageBounds(browser);
|
||||
lastUsedMethod = "fullpage";
|
||||
} else {
|
||||
@@ -1028,7 +1032,7 @@ export var ScreenshotsUtils = {
|
||||
lastUsedMethod
|
||||
);
|
||||
this.methodsUsed[lastUsedMethod] += 1;
|
||||
this.recordTelemetryEvent("selected", type, {});
|
||||
this.recordTelemetryEvent("selected" + type);
|
||||
|
||||
if (Cu.isInAutomation) {
|
||||
Services.obs.notifyObservers(null, "screenshots-preview-ready");
|
||||
@@ -1124,9 +1128,7 @@ export var ScreenshotsUtils = {
|
||||
let canvas = await this.createCanvas(region, browser);
|
||||
let url = canvas.toDataURL();
|
||||
|
||||
await this.copyScreenshot(url, browser, {
|
||||
object: "overlay_copy",
|
||||
});
|
||||
await this.copyScreenshot(url, browser, "OverlayCopy");
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1134,9 +1136,9 @@ export var ScreenshotsUtils = {
|
||||
* This is called from the preview dialog
|
||||
* @param dataUrl The image data
|
||||
* @param browser The current browser
|
||||
* @param data Telemetry data
|
||||
* @param eventName For telemetry
|
||||
*/
|
||||
async copyScreenshot(dataUrl, browser, data) {
|
||||
async copyScreenshot(dataUrl, browser, eventName) {
|
||||
// Guard against missing image data.
|
||||
if (!dataUrl) {
|
||||
return;
|
||||
@@ -1188,7 +1190,7 @@ export var ScreenshotsUtils = {
|
||||
let extra = await this.getActor(browser).sendQuery(
|
||||
"Screenshots:GetMethodsUsed"
|
||||
);
|
||||
this.recordTelemetryEvent("copy", data.object, {
|
||||
this.recordTelemetryEvent("copy" + eventName, {
|
||||
...extra,
|
||||
...this.methodsUsed,
|
||||
});
|
||||
@@ -1207,9 +1209,7 @@ export var ScreenshotsUtils = {
|
||||
let canvas = await this.createCanvas(region, browser);
|
||||
let dataUrl = canvas.toDataURL();
|
||||
|
||||
await this.downloadScreenshot(title, dataUrl, browser, {
|
||||
object: "overlay_download",
|
||||
});
|
||||
await this.downloadScreenshot(title, dataUrl, browser, "OverlayDownload");
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1218,10 +1218,10 @@ export var ScreenshotsUtils = {
|
||||
* @param title The title of the current page or null and getFilename will get the title
|
||||
* @param dataUrl The image data
|
||||
* @param browser The current browser
|
||||
* @param data Telemetry data
|
||||
* @param eventName For telemetry
|
||||
* @returns true if the download succeeds, otherwise false
|
||||
*/
|
||||
async downloadScreenshot(title, dataUrl, browser, data) {
|
||||
async downloadScreenshot(title, dataUrl, browser, eventName) {
|
||||
// Guard against missing image data.
|
||||
if (!dataUrl) {
|
||||
return false;
|
||||
@@ -1266,7 +1266,7 @@ export var ScreenshotsUtils = {
|
||||
let extra = await this.getActor(browser).sendQuery(
|
||||
"Screenshots:GetMethodsUsed"
|
||||
);
|
||||
this.recordTelemetryEvent("download", data.object, {
|
||||
this.recordTelemetryEvent("download" + eventName, {
|
||||
...extra,
|
||||
...this.methodsUsed,
|
||||
});
|
||||
@@ -1280,12 +1280,7 @@ export var ScreenshotsUtils = {
|
||||
return true;
|
||||
},
|
||||
|
||||
recordTelemetryEvent(type, object, args) {
|
||||
if (args) {
|
||||
for (let key of Object.keys(args)) {
|
||||
args[key] = args[key].toString();
|
||||
}
|
||||
}
|
||||
Services.telemetry.recordEvent("screenshots", type, object, null, args);
|
||||
recordTelemetryEvent(name, args) {
|
||||
Glean.screenshots[name].record(args);
|
||||
},
|
||||
};
|
||||
|
||||
387
browser/components/screenshots/metrics.yaml
Normal file
387
browser/components/screenshots/metrics.yaml
Normal file
@@ -0,0 +1,387 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Adding a new metric? We have docs for that!
|
||||
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html
|
||||
|
||||
---
|
||||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
||||
$tags:
|
||||
- 'Firefox :: Screenshots'
|
||||
|
||||
screenshots:
|
||||
download_overlay_download:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user downloads a screenshot from the overlay or the
|
||||
preview.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.download#overlay_download.
|
||||
bugs: &screenshots_download_bugs
|
||||
- https://bugzil.la/1801019
|
||||
data_reviews: &screenshots_download_data_reviews
|
||||
- https://bugzil.la/1801019
|
||||
notification_emails: &screenshots_download_emails
|
||||
- screenshots-dev@mozilla.org
|
||||
expires: never
|
||||
extra_keys: &screenshots_download_extra
|
||||
fullpage:
|
||||
description: >
|
||||
Number of times a full page was selected
|
||||
type: string
|
||||
visible:
|
||||
description: >
|
||||
Number of times a visible page was selected
|
||||
type: string
|
||||
element:
|
||||
description: >
|
||||
Number of times an element was selected
|
||||
type: string
|
||||
region:
|
||||
description: >
|
||||
Number of times a region was selected
|
||||
type: string
|
||||
move:
|
||||
description: >
|
||||
Number of times a region was moved
|
||||
type: string
|
||||
resize:
|
||||
description: >
|
||||
Number of times a region was resized
|
||||
type: string
|
||||
telemetry_mirror: Screenshots_Download_OverlayDownload
|
||||
|
||||
download_preview_download:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user downloads a screenshot from the overlay or the
|
||||
preview.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.download#preview_download.
|
||||
bugs: *screenshots_download_bugs
|
||||
data_reviews: *screenshots_download_data_reviews
|
||||
notification_emails: *screenshots_download_emails
|
||||
expires: never
|
||||
extra_keys: *screenshots_download_extra
|
||||
telemetry_mirror: Screenshots_Download_PreviewDownload
|
||||
|
||||
copy_overlay_copy:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user copies a screenshot from the overlay or the
|
||||
preview.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.copy#overlay_copy.
|
||||
bugs: &screenshots_copy_bugs
|
||||
- https://bugzil.la/1801019
|
||||
data_reviews: &screenshots_copy_data_reviews
|
||||
- https://bugzil.la/1801019
|
||||
notification_emails: &screenshots_copy_emails
|
||||
- screenshots-dev@mozilla.org
|
||||
expires: never
|
||||
extra_keys: &screenshots_copy_extra
|
||||
fullpage:
|
||||
description: >
|
||||
Number of times a full page was selected
|
||||
type: string
|
||||
visible:
|
||||
description: >
|
||||
Number of times a visible page was selected
|
||||
type: string
|
||||
element:
|
||||
description: >
|
||||
Number of times an element was selected
|
||||
type: string
|
||||
region:
|
||||
description: >
|
||||
Number of times a region was selected
|
||||
type: string
|
||||
move:
|
||||
description: >
|
||||
Number of times a region was moved
|
||||
type: string
|
||||
resize:
|
||||
description: >
|
||||
Number of times a region was resized
|
||||
type: string
|
||||
telemetry_mirror: Screenshots_Copy_OverlayCopy
|
||||
|
||||
copy_preview_copy:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user copies a screenshot from the overlay or the
|
||||
preview.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.copy#preview_copy.
|
||||
bugs: *screenshots_copy_bugs
|
||||
data_reviews: *screenshots_copy_data_reviews
|
||||
notification_emails: *screenshots_copy_emails
|
||||
expires: never
|
||||
extra_keys: *screenshots_copy_extra
|
||||
telemetry_mirror: Screenshots_Copy_PreviewCopy
|
||||
|
||||
selected_element:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user selects a region by hand, selects an element,
|
||||
selects the save visible, or selects save full page. Note that this
|
||||
is recorded independent of whether or not the screenshot is saved.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.selected#element.
|
||||
bugs: &screenshots_selected_bugs
|
||||
- https://bugzil.la/1801019
|
||||
data_reviews: &screenshots_selected_data_reviews
|
||||
- https://bugzil.la/1801019
|
||||
notification_emails: &screenshots_selected_emails
|
||||
- screenshots-dev@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Selected_Element
|
||||
|
||||
selected_region_selection:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user selects a region by hand, selects an element,
|
||||
selects the save visible, or selects save full page. Note that this
|
||||
is recorded independent of whether or not the screenshot is saved.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.selected#region_selection.
|
||||
bugs: *screenshots_selected_bugs
|
||||
data_reviews: *screenshots_selected_data_reviews
|
||||
notification_emails: *screenshots_selected_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Selected_RegionSelection
|
||||
|
||||
selected_visible:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user selects a region by hand, selects an element,
|
||||
selects the save visible, or selects save full page. Note that this
|
||||
is recorded independent of whether or not the screenshot is saved.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.selected#visible.
|
||||
bugs: *screenshots_selected_bugs
|
||||
data_reviews: *screenshots_selected_data_reviews
|
||||
notification_emails: *screenshots_selected_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Selected_Visible
|
||||
|
||||
selected_full_page:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user selects a region by hand, selects an element,
|
||||
selects the save visible, or selects save full page. Note that this
|
||||
is recorded independent of whether or not the screenshot is saved.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.selected#full_page.
|
||||
bugs: *screenshots_selected_bugs
|
||||
data_reviews: *screenshots_selected_data_reviews
|
||||
notification_emails: *screenshots_selected_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Selected_FullPage
|
||||
|
||||
started_toolbar_button:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user opens the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.started#toolbar_button.
|
||||
bugs: &screenshots_started_bugs
|
||||
- https://bugzil.la/1801019
|
||||
data_reviews: &screenshots_started_data_reviews
|
||||
- https://bugzil.la/1801019
|
||||
notification_emails: &screenshots_started_emails
|
||||
- screenshots-dev@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Started_ToolbarButton
|
||||
|
||||
started_shortcut:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user opens the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.started#shortcut.
|
||||
bugs: *screenshots_started_bugs
|
||||
data_reviews: *screenshots_started_data_reviews
|
||||
notification_emails: *screenshots_started_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Started_Shortcut
|
||||
|
||||
started_context_menu:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user opens the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.started#context_menu.
|
||||
bugs: *screenshots_started_bugs
|
||||
data_reviews: *screenshots_started_data_reviews
|
||||
notification_emails: *screenshots_started_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Started_ContextMenu
|
||||
|
||||
started_quick_actions:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user opens the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.started#quick_actions.
|
||||
bugs: *screenshots_started_bugs
|
||||
data_reviews: *screenshots_started_data_reviews
|
||||
notification_emails: *screenshots_started_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Started_QuickActions
|
||||
|
||||
started_preview_retry:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user opens the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.started#preview_retry.
|
||||
bugs: *screenshots_started_bugs
|
||||
data_reviews: *screenshots_started_data_reviews
|
||||
notification_emails: *screenshots_started_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Started_PreviewRetry
|
||||
|
||||
started_overlay_retry:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user opens the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.started#overlay_retry.
|
||||
bugs: *screenshots_started_bugs
|
||||
data_reviews: *screenshots_started_data_reviews
|
||||
notification_emails: *screenshots_started_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Started_OverlayRetry
|
||||
|
||||
canceled_toolbar_button:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#toolbar_button.
|
||||
bugs: &screenshots_canceled_bugs
|
||||
- https://bugzil.la/1801019
|
||||
data_reviews: &screenshots_canceled_data_reviews
|
||||
- https://bugzil.la/1801019
|
||||
notification_emails: &screenshots_canceled_emails
|
||||
- screenshots-dev@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_ToolbarButton
|
||||
|
||||
canceled_shortcut:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#shortcut.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_Shortcut
|
||||
|
||||
canceled_context_menu:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#context_menu.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_ContextMenu
|
||||
|
||||
canceled_quick_actions:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#quick_actions.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_QuickActions
|
||||
|
||||
canceled_preview_cancel:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#preview_cancel.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_PreviewCancel
|
||||
|
||||
canceled_overlay_cancel:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#overlay_cancel.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_OverlayCancel
|
||||
|
||||
canceled_escape:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#escape.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_Escape
|
||||
|
||||
canceled_navigation:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a user closes the screenshots ui. The screenshots ui
|
||||
is closed after copying/downloading but we do not record that as
|
||||
canceling the screenshots ui.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.canceled#navigation.
|
||||
bugs: *screenshots_canceled_bugs
|
||||
data_reviews: *screenshots_canceled_data_reviews
|
||||
notification_emails: *screenshots_canceled_emails
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Canceled_Navigation
|
||||
|
||||
failed_screenshot_too_large:
|
||||
type: event
|
||||
description: >
|
||||
Recorded when a screenshot is too big to capture and we have to crop
|
||||
the screenshot.
|
||||
This event was generated to correspond to the Legacy Telemetry event
|
||||
screenshots.failed#screenshot_too_large.
|
||||
bugs:
|
||||
- https://bugzil.la/1801019
|
||||
data_reviews:
|
||||
- https://bugzil.la/1801019
|
||||
notification_emails:
|
||||
- screenshots-dev@mozilla.org
|
||||
expires: never
|
||||
telemetry_mirror: Screenshots_Failed_ScreenshotTooLarge
|
||||
@@ -44,12 +44,12 @@
|
||||
|
||||
let visibleButton = shadowRoot.getElementById("visible-page");
|
||||
visibleButton.onclick = function () {
|
||||
ScreenshotsUtils.takeScreenshot(gBrowser.selectedBrowser, "visible");
|
||||
ScreenshotsUtils.takeScreenshot(gBrowser.selectedBrowser, "Visible");
|
||||
};
|
||||
|
||||
let fullpageButton = shadowRoot.getElementById("full-page");
|
||||
fullpageButton.onclick = function () {
|
||||
ScreenshotsUtils.takeScreenshot(gBrowser.selectedBrowser, "full_page");
|
||||
ScreenshotsUtils.takeScreenshot(gBrowser.selectedBrowser, "FullPage");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -92,19 +92,12 @@ class ScreenshotsPreview extends MozLitElement {
|
||||
handleClick(event) {
|
||||
switch (event.target.id) {
|
||||
case "retry":
|
||||
lazy.ScreenshotsUtils.scheduleRetry(
|
||||
this.openerBrowser,
|
||||
"preview_retry"
|
||||
);
|
||||
lazy.ScreenshotsUtils.scheduleRetry(this.openerBrowser, "PreviewRetry");
|
||||
this.close();
|
||||
break;
|
||||
case "cancel":
|
||||
this.close();
|
||||
lazy.ScreenshotsUtils.recordTelemetryEvent(
|
||||
"canceled",
|
||||
"preview_cancel",
|
||||
{}
|
||||
);
|
||||
lazy.ScreenshotsUtils.recordTelemetryEvent("canceledPreviewCancel");
|
||||
break;
|
||||
case "copy":
|
||||
this.saveToClipboard();
|
||||
@@ -188,7 +181,7 @@ class ScreenshotsPreview extends MozLitElement {
|
||||
null,
|
||||
imageSrc,
|
||||
this.openerBrowser,
|
||||
{ object: "preview_download" }
|
||||
"PreviewDownload"
|
||||
);
|
||||
|
||||
if (downloadSucceeded) {
|
||||
@@ -205,9 +198,11 @@ class ScreenshotsPreview extends MozLitElement {
|
||||
|
||||
// Wait for the image to be loaded before we copy it
|
||||
let imageSrc = await this.imageLoadedPromise();
|
||||
await lazy.ScreenshotsUtils.copyScreenshot(imageSrc, this.openerBrowser, {
|
||||
object: "preview_copy",
|
||||
});
|
||||
await lazy.ScreenshotsUtils.copyScreenshot(
|
||||
imageSrc,
|
||||
this.openerBrowser,
|
||||
"PreviewCopy"
|
||||
);
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ const DEFAULT_ACTIONS = {
|
||||
Services.obs.notifyObservers(
|
||||
lazy.BrowserWindowTracker.getTopWindow(),
|
||||
"menuitem-screenshot",
|
||||
"quick_actions"
|
||||
"QuickActions"
|
||||
);
|
||||
} else {
|
||||
Services.obs.notifyObservers(
|
||||
|
||||
@@ -69,6 +69,7 @@ firefox_desktop_metrics = [
|
||||
"browser/components/preferences/metrics.yaml",
|
||||
"browser/components/privatebrowsing/metrics.yaml",
|
||||
"browser/components/protocolhandler/metrics.yaml",
|
||||
"browser/components/screenshots/metrics.yaml",
|
||||
"browser/components/search/metrics.yaml",
|
||||
"browser/components/sessionstore/metrics.yaml",
|
||||
"browser/components/shopping/metrics.yaml",
|
||||
|
||||
Reference in New Issue
Block a user