Bug 1254729 - remove about:devices from Fennec (r=nalexander) draft
authorGrigory Kruglov <gkruglov@mozilla.com>
Wed, 09 Mar 2016 15:37:04 -0800
changeset 339392 c3060b1d5e1560c33b5a532845428b3373f3b76b
parent 339390 af1e95751534576a804b4dd5e9f39950a2684b69
child 515976 33753a9bb7a16b62230cb0e9fec43d1f7abfb6d2
push id12715
push usergkruglov@mozilla.com
push dateFri, 11 Mar 2016 03:33:37 +0000
reviewersnalexander
bugs1254729
milestone48.0a1
Bug 1254729 - remove about:devices from Fennec (r=nalexander) MozReview-Commit-ID: 2RC82OrrsnA
mobile/android/chrome/content/aboutDevices.js
mobile/android/chrome/content/aboutDevices.xhtml
mobile/android/chrome/jar.mn
mobile/android/components/AboutRedirector.js
mobile/android/components/MobileComponents.manifest
mobile/android/confvars.sh
mobile/android/locales/jar.mn
mobile/android/themes/core/aboutDevices.css
mobile/android/themes/core/jar.mn
old-configure.in
toolkit/modules/AppConstants.jsm
deleted file mode 100644
--- a/mobile/android/chrome/content/aboutDevices.js
+++ /dev/null
@@ -1,138 +0,0 @@
-// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
-/* 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/Services.jsm"); /*global Services */
-Cu.import("resource://gre/modules/Messaging.jsm");
-Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm"); /*global SimpleServiceDiscovery */
-
-const EVENT_SERVICE_FOUND = SimpleServiceDiscovery.EVENT_SERVICE_FOUND;
-const EVENT_SERVICE_LOST = SimpleServiceDiscovery.EVENT_SERVICE_LOST;
-
-// We want to keep this page fresh while it is open, so we decrease
-// our time between searches when it is opened, and revert to the
-// former time between searches when it is closed.
-const SEARCH_INTERVAL_IN_MILLISECONDS = 5 * 1000;
-
-function dump(s) {
-  Services.console.logStringMessage("aboutDevices :: " + s);
-}
-
-var Devices = {
-  _savedSearchInterval: -1,
-
-  init: function() {
-    dump("Initializing.");
-    Services.obs.addObserver(this, EVENT_SERVICE_FOUND, false);
-    Services.obs.addObserver(this, EVENT_SERVICE_LOST, false);
-
-    let button = document.getElementById("refresh");
-    button.addEventListener("click", () => {
-      this.updateDeviceList();
-    }, false);
-
-    let manual = document.getElementById("connect");
-    manual.addEventListener("click", (evt) => {
-      this.connectManually(evt);
-    }, false);
-
-    this._savedSearchInterval = SimpleServiceDiscovery.search(SEARCH_INTERVAL_IN_MILLISECONDS);
-
-    this.updateDeviceList();
-  },
-
-  uninit: function() {
-    dump("Uninitializing.");
-    Services.obs.removeObserver(this, EVENT_SERVICE_FOUND);
-    Services.obs.removeObserver(this, EVENT_SERVICE_LOST);
-
-    if (this._savedSearchInterval > 0) {
-      SimpleServiceDiscovery.search(this._savedSearchInterval);
-    }
-  },
-
-  _createItemForDevice: function(device) {
-    let item = document.createElement("div");
-
-    let friendlyName = document.createElement("div");
-    friendlyName.classList.add("name");
-    friendlyName.textContent = device.friendlyName;
-    item.appendChild(friendlyName);
-
-    let location = document.createElement("div");
-    location.classList.add("location");
-    location.textContent = device.location;
-    item.appendChild(location);
-
-    return item;
-  },
-
-  updateDeviceList: function() {
-    let services = SimpleServiceDiscovery.services;
-    dump("Updating device list with " + services.length + " services.");
-
-    let list = document.getElementById("devices-list");
-    while (list.firstChild) {
-      list.removeChild(list.firstChild);
-    }
-
-    for (let service of services) {
-      let item = this._createItemForDevice(service);
-      list.appendChild(item);
-    }
-  },
-
-  observe: function(subject, topic, data) {
-    if (topic == EVENT_SERVICE_FOUND || topic == EVENT_SERVICE_LOST) {
-      this.updateDeviceList();
-    }
-  },
-
-  _fixedDeviceForType: function(type, ip) {
-    let fixedDevice = {};
-    if (type == "roku") {
-      fixedDevice.target = "roku:ecp";
-      fixedDevice.location = "http://" + ip + ":8060";
-    } else if (type == "chromecast") {
-      fixedDevice.target = "urn:dial-multiscreen-org:service:dial:1";
-      fixedDevice.location = "http://" + ip + ":8008";
-    }
-    return fixedDevice;
-  },
-
-  connectManually: function(evt) {
-    // Since there is no form submit event, this is not validated. However,
-    // after we process this event, the element's validation state is updated.
-    let ip = document.getElementById("ip");
-    if (!ip.checkValidity()) {
-      dump("Manually entered IP address is not valid!");
-      return;
-    }
-
-    let fixedDevices = [];
-    try {
-      fixedDevices = JSON.parse(Services.prefs.getCharPref("browser.casting.fixedDevices"));
-    } catch (e) {}
-
-    let type = document.getElementById("type").value;
-    let fixedDevice = this._fixedDeviceForType(type, ip.value);
-
-    // Early abort if we're already looking for this target.
-    if (fixedDevices.indexOf(fixedDevice) > -1)
-      return;
-
-    fixedDevices.push(fixedDevice);
-    Services.prefs.setCharPref("browser.casting.fixedDevices", JSON.stringify(fixedDevices));
-
-    // The backend does not yet listen for pref changes, so we trigger a scan.
-    this.updateDeviceList();
-  },
-};
-
-window.addEventListener("load", Devices.init.bind(Devices), false);
-window.addEventListener("unload", Devices.uninit.bind(Devices), false);
deleted file mode 100644
--- a/mobile/android/chrome/content/aboutDevices.xhtml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
-  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
-%globalDTD;
-<!ENTITY % aboutDTD SYSTEM "chrome://browser/locale/aboutDevices.dtd" >
-%aboutDTD;
-]>
-
-<!-- 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/. -->
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <title>&aboutDevices.title;</title>
-  <meta name="viewport" content="width=device-width; user-scalable=0" />
-  <link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
-  <link rel="stylesheet" href="chrome://browser/skin/aboutBase.css" type="text/css"/>
-  <link rel="stylesheet" href="chrome://browser/skin/aboutDevices.css" type="text/css"/>
-</head>
-
-<body>
-  <h1>&aboutDevices.header;</h1>
-
-  <ul id="devices-list"></ul>
-
-  <button id="refresh">&aboutDevices.refresh;</button>
-
-  <h1>&aboutDevices.addDeviceHeader;</h1>
-
-  <div id="manual">
-    <select id="type">
-      <option value="roku">&aboutDevices.roku;</option>
-      <option value="chromecast">&aboutDevices.chromecast;</option>
-    </select>
-
-    <input id="ip" type="text" required="required"
-           pattern="((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$"
-           placeholder="&aboutDevices.placeholder;" />
-    <button id="connect">&aboutDevices.connectManually;</button>
-  </div>
-
-  <script type="text/javascript;version=1.8" src="chrome://browser/content/aboutDevices.js"></script>
-</body>
-</html>
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -48,20 +48,16 @@ chrome.jar:
   content/Linkify.js                   (content/Linkify.js)
   content/ZoomHelper.js                (content/ZoomHelper.js)
   content/CastingApps.js               (content/CastingApps.js)
   content/RemoteDebugger.js            (content/RemoteDebugger.js)
 #ifdef MOZ_SERVICES_HEALTHREPORT
   content/aboutHealthReport.xhtml      (content/aboutHealthReport.xhtml)
   content/aboutHealthReport.js         (content/aboutHealthReport.js)
 #endif
-#ifdef MOZ_DEVICES
-  content/aboutDevices.xhtml           (content/aboutDevices.xhtml)
-  content/aboutDevices.js              (content/aboutDevices.js)
-#endif
   content/aboutAccounts.xhtml          (content/aboutAccounts.xhtml)
   content/aboutAccounts.js             (content/aboutAccounts.js)
   content/aboutLogins.xhtml            (content/aboutLogins.xhtml)
   content/aboutLogins.js               (content/aboutLogins.js)
 #ifdef NIGHTLY_BUILD
   content/WebcompatReporter.js         (content/WebcompatReporter.js)
 #endif
 
--- a/mobile/android/components/AboutRedirector.js
+++ b/mobile/android/components/AboutRedirector.js
@@ -80,22 +80,16 @@ var modules = {
 };
 
 if (AppConstants.MOZ_SERVICES_HEALTHREPORT) {
   modules['healthreport'] = {
     uri: "chrome://browser/content/aboutHealthReport.xhtml",
     privileged: true
   };
 }
-if (AppConstants.MOZ_DEVICES) {
-  modules['devices'] = {
-    uri: "chrome://browser/content/aboutDevices.xhtml",
-    privileged: true
-  };
-}
 
 function AboutRedirector() {}
 AboutRedirector.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
   classID: Components.ID("{322ba47e-7047-4f71-aebf-cb7d69325cd9}"),
 
   _getModuleInfo: function (aURI) {
     let moduleName = aURI.path.replace(/[?#].*/, "").toLowerCase();
--- a/mobile/android/components/MobileComponents.manifest
+++ b/mobile/android/components/MobileComponents.manifest
@@ -12,19 +12,16 @@ contract @mozilla.org/network/protocol/a
 contract @mozilla.org/network/protocol/about;1?what=feedback {322ba47e-7047-4f71-aebf-cb7d69325cd9}
 contract @mozilla.org/network/protocol/about;1?what=privatebrowsing {322ba47e-7047-4f71-aebf-cb7d69325cd9}
 #ifdef MOZ_SERVICES_HEALTHREPORT
 contract @mozilla.org/network/protocol/about;1?what=healthreport {322ba47e-7047-4f71-aebf-cb7d69325cd9}
 #endif
 #ifdef MOZ_SAFE_BROWSING
 contract @mozilla.org/network/protocol/about;1?what=blocked {322ba47e-7047-4f71-aebf-cb7d69325cd9}
 #endif
-#ifdef MOZ_DEVICES
-contract @mozilla.org/network/protocol/about;1?what=devices {322ba47e-7047-4f71-aebf-cb7d69325cd9}
-#endif
 contract @mozilla.org/network/protocol/about;1?what=accounts {322ba47e-7047-4f71-aebf-cb7d69325cd9}
 contract @mozilla.org/network/protocol/about;1?what=logins {322ba47e-7047-4f71-aebf-cb7d69325cd9}
 
 # DirectoryProvider.js
 component {ef0f7a87-c1ee-45a8-8d67-26f586e46a4b} DirectoryProvider.js
 contract @mozilla.org/browser/directory-provider;1 {ef0f7a87-c1ee-45a8-8d67-26f586e46a4b}
 category xpcom-directory-providers browser-directory-provider @mozilla.org/browser/directory-provider;1
 
--- a/mobile/android/confvars.sh
+++ b/mobile/android/confvars.sh
@@ -56,19 +56,16 @@ MOZ_ENABLE_SZIP=1
 fi
 
 # Enable UI for healthreporter
 MOZ_SERVICES_HEALTHREPORT=1
 
 # Enable runtime locale switching.
 MOZ_LOCALE_SWITCHER=1
 
-# Enable second screen and casting support for external devices.
-MOZ_DEVICES=1
-
 # Enable second screen using native Android libraries, provided we're
 # not resource constrained.
 if test -z "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
   MOZ_NATIVE_DEVICES=1
 fi
 
 # Enable install tracking SDK if we have Google Play support; MOZ_NATIVE_DEVICES
 # is a proxy flag for that support.
--- a/mobile/android/locales/jar.mn
+++ b/mobile/android/locales/jar.mn
@@ -6,19 +6,16 @@
 
 @AB_CD@.jar:
 % locale browser @AB_CD@ %locale/@AB_CD@/browser/
   locale/@AB_CD@/browser/about.dtd                (%chrome/about.dtd)
   locale/@AB_CD@/browser/aboutAccounts.dtd        (%chrome/aboutAccounts.dtd)
   locale/@AB_CD@/browser/aboutAccounts.properties (%chrome/aboutAccounts.properties)
   locale/@AB_CD@/browser/aboutAddons.dtd          (%chrome/aboutAddons.dtd)
   locale/@AB_CD@/browser/aboutAddons.properties   (%chrome/aboutAddons.properties)
-#ifdef MOZ_DEVICES
-  locale/@AB_CD@/browser/aboutDevices.dtd         (%chrome/aboutDevices.dtd)
-#endif
   locale/@AB_CD@/browser/aboutCertError.dtd       (%chrome/aboutCertError.dtd)
   locale/@AB_CD@/browser/aboutDownloads.dtd       (%chrome/aboutDownloads.dtd)
   locale/@AB_CD@/browser/aboutDownloads.properties (%chrome/aboutDownloads.properties)
   locale/@AB_CD@/browser/aboutHome.dtd            (%chrome/aboutHome.dtd)
   locale/@AB_CD@/browser/aboutHome.properties     (%chrome/aboutHome.properties)
   locale/@AB_CD@/browser/aboutPrivateBrowsing.dtd (%chrome/aboutPrivateBrowsing.dtd)
 #ifdef MOZ_SERVICES_HEALTHREPORT
   locale/@AB_CD@/browser/aboutHealthReport.dtd    (%chrome/aboutHealthReport.dtd)
deleted file mode 100644
--- a/mobile/android/themes/core/aboutDevices.css
+++ /dev/null
@@ -1,8 +0,0 @@
-* {
-  margin: 0;
-  padding: 0;
-}
-
-html, body {
-  height: 100%;
-}
--- a/mobile/android/themes/core/jar.mn
+++ b/mobile/android/themes/core/jar.mn
@@ -6,19 +6,16 @@
 
 chrome.jar:
 % skin browser classic/1.0 %skin/
   skin/aboutPage.css                        (aboutPage.css)
   skin/about.css                            (about.css)
   skin/aboutAccounts.css                    (aboutAccounts.css)
   skin/aboutAddons.css                      (aboutAddons.css)
   skin/aboutBase.css                        (aboutBase.css)
-#ifdef MOZ_DEVICES
-  skin/aboutDevices.css                     (aboutDevices.css)
-#endif
   skin/aboutDownloads.css                   (aboutDownloads.css)
 #ifdef MOZ_SERVICES_HEALTHREPORT
   skin/aboutHealthReport.css                (aboutHealthReport.css)
 #endif
   skin/aboutMemory.css                      (aboutMemory.css)
   skin/aboutPrivateBrowsing.css             (aboutPrivateBrowsing.css)
   skin/aboutReader.css                      (aboutReader.css)
   skin/aboutReaderContent.css               (aboutReaderContent.css)
--- a/old-configure.in
+++ b/old-configure.in
@@ -8252,22 +8252,16 @@ if test -n "$MOZ_SERVICES_SYNC"; then
 fi
 
 dnl Build Services/CloudSync if required
 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
   AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
 fi
 
-dnl Build second screen and casting features for external devices if required
-AC_SUBST(MOZ_DEVICES)
-if test -n "$MOZ_DEVICES"; then
-  AC_DEFINE(MOZ_DEVICES)
-fi
-
 dnl ========================================================
 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
 fi
 
 dnl ========================================================
 dnl =
 dnl = Maintainer debug option (no --enable equivalent)
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -69,23 +69,16 @@ this.AppConstants = Object.freeze({
 
   MOZ_DATA_REPORTING:
 #ifdef MOZ_DATA_REPORTING
   true,
 #else
   false,
 #endif
 
-  MOZ_DEVICES:
-#ifdef MOZ_DEVICES
-  true,
-#else
-  false,
-#endif
-
   MOZ_SAFE_BROWSING:
 #ifdef MOZ_SAFE_BROWSING
   true,
 #else
   false,
 #endif
 
   MOZ_SANDBOX: