Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #2218, add Telemetry scalars to track shot creation per session
Browse files Browse the repository at this point in the history
For related, Gecko-only changes to the telemetry Scalars.yaml file, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1412411
  • Loading branch information
jaredhirsch committed Nov 1, 2017
1 parent 64e4886 commit 80ecdd0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addon/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ function handleMessage(msg, sender, sendReply) {
} else if (msg.funcName === "getHistoryPref") {
let historyEnabled = getBoolPref(HISTORY_ENABLED_PREF);
sendReply({type: "success", value: historyEnabled});
} else if (msg.funcName === "incrementDownloadCount") {
let telemetryEnabled = getBoolPref(TELEMETRY_ENABLED_PREF);
if (telemetryEnabled) {
Services.telemetry.scalarAdd('screenshots.download', 1);
}
} else if (msg.funcName === "incrementUploadCount") {
let telemetryEnabled = getBoolPref(TELEMETRY_ENABLED_PREF);
if (telemetryEnabled) {
Services.telemetry.scalarAdd('screenshots.upload', 1);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ this.main = (function() {
}
});
browser.downloads.onChanged.addListener(onChangedCallback)
catcher.watchPromise(communication.sendToBootstrap("incrementDownloadCount"));
return browser.windows.getLastFocused().then(windowInfo => {
return windowInfo.incognito;
}).then((incognito) => {
Expand Down
1 change: 1 addition & 0 deletions addon/webextension/background/takeshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ this.takeshot = (function() {
}
);
}).then(() => {
catcher.watchPromise(communication.sendToBootstrap('incrementUploadCount'));
return shot.viewUrl;
}).catch((error) => {
browser.tabs.remove(openedTab.id);
Expand Down

0 comments on commit 80ecdd0

Please sign in to comment.