Created
January 31, 2017 19:00
-
-
Save rhelmer/bbbbd6a61a531ec12a596a472a7519f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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/. */ | |
| // This is an update-only system add-on to diagnose why the uptake rate | |
| // has been lower than expected. It sends a single Telemetry ping on install, | |
| // a single ping on first startup. | |
| // | |
| // It will automatically be removed from Firefox on the next application update, | |
| // and will remove any preferences set. | |
| "use strict"; | |
| const {classes: Cc, interfaces: Ci, utils: Cu} = Components; | |
| Cu.import("resource://gre/modules/Preferences.jsm"); | |
| Cu.import("resource://gre/modules/TelemetryController.jsm"); | |
| const diagnosticsPref = "extensions.diagnostics.v1.hasRun"; | |
| let basePayload = { | |
| version: 1 | |
| } | |
| function install() { | |
| let payload = Object.assign(basePayload); | |
| payload.phase = "install"; | |
| TelemetryController.submitExternalPing("system-addon-deployment-diagnostics-install", payload, { | |
| addClientId: true, | |
| addEnvironment: true, | |
| }); | |
| } | |
| function startup() { | |
| let hasRun = Preferences.get(diagnosticsPref, false); | |
| if (!hasRun) { | |
| let payload = Object.assign(basePayload); | |
| payload.phase = "startup"; | |
| TelemetryController.submitExternalPing("system-addon-deployment-diagnostics-startup", payload, { | |
| addClientId: true, | |
| addEnvironment: true, | |
| }); | |
| Preferences.set(diagnosticsPref, true); | |
| } | |
| } | |
| function shutdown() {} | |
| function uninstall() { | |
| Preferences.reset(diagnosticsPref); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment