summaryrefslogtreecommitdiffstats
path: root/browser/base/content/abouthealthreport
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-04 13:17:38 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-04 13:17:38 +0200
commita1be17c1cea81ebb1e8b131a662c698d78f3f7f2 (patch)
treea92f7de513be600cc07bac458183e9af40e00c06 /browser/base/content/abouthealthreport
parentbf11fdd304898ac675e39b01b280d39550e419d0 (diff)
downloadUXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar.gz
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar.lz
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.tar.xz
UXP-a1be17c1cea81ebb1e8b131a662c698d78f3f7f2.zip
Issue #303 Part 1: Move basilisk files from /browser to /application/basilisk
Diffstat (limited to 'browser/base/content/abouthealthreport')
-rw-r--r--browser/base/content/abouthealthreport/abouthealth.css15
-rw-r--r--browser/base/content/abouthealthreport/abouthealth.js180
-rw-r--r--browser/base/content/abouthealthreport/abouthealth.xhtml31
3 files changed, 0 insertions, 226 deletions
diff --git a/browser/base/content/abouthealthreport/abouthealth.css b/browser/base/content/abouthealthreport/abouthealth.css
deleted file mode 100644
index 3dd40fc24..000000000
--- a/browser/base/content/abouthealthreport/abouthealth.css
+++ /dev/null
@@ -1,15 +0,0 @@
-* {
- margin: 0;
- padding: 0;
-}
-
-html, body {
- height: 100%;
-}
-
-#remote-report {
- width: 100%;
- height: 100%;
- border: 0;
- display: flex;
-}
diff --git a/browser/base/content/abouthealthreport/abouthealth.js b/browser/base/content/abouthealthreport/abouthealth.js
deleted file mode 100644
index 66cbe16f5..000000000
--- a/browser/base/content/abouthealthreport/abouthealth.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/Preferences.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-const prefs = new Preferences("datareporting.healthreport.");
-
-const PREF_UNIFIED = "toolkit.telemetry.unified";
-const PREF_REPORTING_URL = "datareporting.healthreport.about.reportUrl";
-
-var healthReportWrapper = {
- init: function () {
- let iframe = document.getElementById("remote-report");
- iframe.addEventListener("load", healthReportWrapper.initRemotePage, false);
- iframe.src = this._getReportURI().spec;
- prefs.observe("uploadEnabled", this.updatePrefState, healthReportWrapper);
- },
-
- uninit: function () {
- prefs.ignore("uploadEnabled", this.updatePrefState, healthReportWrapper);
- },
-
- _getReportURI: function () {
- let url = Services.urlFormatter.formatURLPref(PREF_REPORTING_URL);
- return Services.io.newURI(url, null, null);
- },
-
- setDataSubmission: function (enabled) {
- MozSelfSupport.healthReportDataSubmissionEnabled = enabled;
- this.updatePrefState();
- },
-
- updatePrefState: function () {
- try {
- let prefs = {
- enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
- };
- healthReportWrapper.injectData("prefs", prefs);
- }
- catch (ex) {
- healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PREFS_FAILED);
- }
- },
-
- sendTelemetryPingList: function () {
- console.log("AboutHealthReport: Collecting Telemetry ping list.");
- MozSelfSupport.getTelemetryPingList().then((list) => {
- console.log("AboutHealthReport: Sending Telemetry ping list.");
- this.injectData("telemetry-ping-list", list);
- }).catch((ex) => {
- console.log("AboutHealthReport: Collecting ping list failed: " + ex);
- });
- },
-
- sendTelemetryPingData: function (pingId) {
- console.log("AboutHealthReport: Collecting Telemetry ping data.");
- MozSelfSupport.getTelemetryPing(pingId).then((ping) => {
- console.log("AboutHealthReport: Sending Telemetry ping data.");
- this.injectData("telemetry-ping-data", {
- id: pingId,
- pingData: ping,
- });
- }).catch((ex) => {
- console.log("AboutHealthReport: Loading ping data failed: " + ex);
- this.injectData("telemetry-ping-data", {
- id: pingId,
- error: "error-generic",
- });
- });
- },
-
- sendCurrentEnvironment: function () {
- console.log("AboutHealthReport: Sending Telemetry environment data.");
- MozSelfSupport.getCurrentTelemetryEnvironment().then((environment) => {
- this.injectData("telemetry-current-environment-data", environment);
- }).catch((ex) => {
- console.log("AboutHealthReport: Collecting current environment data failed: " + ex);
- });
- },
-
- sendCurrentPingData: function () {
- console.log("AboutHealthReport: Sending current Telemetry ping data.");
- MozSelfSupport.getCurrentTelemetrySubsessionPing().then((ping) => {
- this.injectData("telemetry-current-ping-data", ping);
- }).catch((ex) => {
- console.log("AboutHealthReport: Collecting current ping data failed: " + ex);
- });
- },
-
- injectData: function (type, content) {
- let report = this._getReportURI();
-
- // file URIs can't be used for targetOrigin, so we use "*" for this special case
- // in all other cases, pass in the URL to the report so we properly restrict the message dispatch
- let reportUrl = report.scheme == "file" ? "*" : report.spec;
-
- let data = {
- type: type,
- content: content
- }
-
- let iframe = document.getElementById("remote-report");
- iframe.contentWindow.postMessage(data, reportUrl);
- },
-
- handleRemoteCommand: function (evt) {
- // Do an origin check to harden against the frame content being loaded from unexpected locations.
- let allowedPrincipal = Services.scriptSecurityManager.getCodebasePrincipal(this._getReportURI());
- let targetPrincipal = evt.target.nodePrincipal;
- if (!allowedPrincipal.equals(targetPrincipal)) {
- Cu.reportError(`Origin check failed for message "${evt.detail.command}": ` +
- `target origin is "${targetPrincipal.origin}", expected "${allowedPrincipal.origin}"`);
- return;
- }
-
- switch (evt.detail.command) {
- case "DisableDataSubmission":
- this.setDataSubmission(false);
- break;
- case "EnableDataSubmission":
- this.setDataSubmission(true);
- break;
- case "RequestCurrentPrefs":
- this.updatePrefState();
- break;
- case "RequestTelemetryPingList":
- this.sendTelemetryPingList();
- break;
- case "RequestTelemetryPingData":
- this.sendTelemetryPingData(evt.detail.id);
- break;
- case "RequestCurrentEnvironment":
- this.sendCurrentEnvironment();
- break;
- case "RequestCurrentPingData":
- this.sendCurrentPingData();
- break;
- default:
- Cu.reportError("Unexpected remote command received: " + evt.detail.command + ". Ignoring command.");
- break;
- }
- },
-
- initRemotePage: function () {
- let iframe = document.getElementById("remote-report").contentDocument;
- iframe.addEventListener("RemoteHealthReportCommand",
- function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); },
- false);
- healthReportWrapper.updatePrefState();
- },
-
- // error handling
- ERROR_INIT_FAILED: 1,
- ERROR_PAYLOAD_FAILED: 2,
- ERROR_PREFS_FAILED: 3,
-
- reportFailure: function (error) {
- let details = {
- errorType: error,
- }
- healthReportWrapper.injectData("error", details);
- },
-
- handleInitFailure: function () {
- healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
- },
-
- handlePayloadFailure: function () {
- healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
- },
-}
-
-window.addEventListener("load", function () { healthReportWrapper.init(); });
-window.addEventListener("unload", function () { healthReportWrapper.uninit(); });
diff --git a/browser/base/content/abouthealthreport/abouthealth.xhtml b/browser/base/content/abouthealthreport/abouthealth.xhtml
deleted file mode 100644
index 464635788..000000000
--- a/browser/base/content/abouthealthreport/abouthealth.xhtml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- 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/. -->
-<!DOCTYPE html [
- <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
- %htmlDTD;
- <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
- %brandDTD;
- <!ENTITY % securityPrefsDTD SYSTEM "chrome://browser/locale/preferences/security.dtd">
- %securityPrefsDTD;
- <!ENTITY % aboutHealthReportDTD SYSTEM "chrome://browser/locale/aboutHealthReport.dtd">
- %aboutHealthReportDTD;
-]>
-
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>&abouthealth.pagetitle;</title>
- <link rel="icon" type="image/png" id="favicon"
- href="chrome://branding/content/icon32.png"/>
- <link rel="stylesheet"
- href="chrome://browser/content/abouthealthreport/abouthealth.css"
- type="text/css" />
- <script type="text/javascript;version=1.8"
- src="chrome://browser/content/abouthealthreport/abouthealth.js" />
- </head>
- <body>
- <iframe id="remote-report"/>
- </body>
-</html>
-