Bug 1076735 - Improve display of super DevTools mode request. r=jryans
authorGene Vityugov <gene.vityugov@gmail.com>
Tue, 27 Jan 2015 10:59:00 -0500
changeset 239728 9529933bb51c1acd91b8158efdedae7131a9088a
parent 239727 1028a620d6072545ed7b44a5c259f8da5b65a317
child 239729 ac214aa8889259a408287394f437bebc18bb990b
push id506
push usermleibovic@mozilla.com
push dateThu, 29 Jan 2015 12:40:10 +0000
reviewersjryans
bugs1076735
milestone38.0a1
Bug 1076735 - Improve display of super DevTools mode request. r=jryans
browser/devtools/webide/content/runtimedetails.js
browser/devtools/webide/content/runtimedetails.xhtml
browser/devtools/webide/themes/runtimedetails.css
browser/locales/en-US/chrome/browser/devtools/webide.dtd
--- a/browser/devtools/webide/content/runtimedetails.js
+++ b/browser/devtools/webide/content/runtimedetails.js
@@ -5,21 +5,26 @@
 const Cu = Components.utils;
 const {Services} = Cu.import("resource://gre/modules/Services.jsm");
 const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
 const {AppManager} = require("devtools/webide/app-manager");
 const {Connection} = require("devtools/client/connection-manager");
 const {RuntimeTypes} = require("devtools/webide/runtimes");
 const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties");
 
+const UNRESTRICTED_HELP_URL = "https://developer.mozilla.org/docs/Tools/WebIDE#Unrestricted_app_debugging_%28including_certified_apps.2C_main_process.2C_etc.%29";
+
 window.addEventListener("load", function onLoad() {
   window.removeEventListener("load", onLoad);
   document.querySelector("#close").onclick = CloseUI;
-  document.querySelector("#certified-check button").onclick = EnableCertApps;
+  document.querySelector("#devtools-check button").onclick = EnableCertApps;
   document.querySelector("#adb-check button").onclick = RootADB;
+  document.querySelector("#unrestricted-privileges").onclick = function() {
+    window.parent.UI.openInBrowser(UNRESTRICTED_HELP_URL);
+  };
   AppManager.on("app-manager-update", OnAppManagerUpdate);
   BuildUI();
   CheckLockState();
 }, true);
 
 window.addEventListener("unload", function onUnload() {
   window.removeEventListener("unload", onUnload);
   AppManager.off("app-manager-update", OnAppManagerUpdate);
@@ -58,33 +63,33 @@ function BuildUI() {
     });
   } else {
     CloseUI();
   }
 }
 
 function CheckLockState() {
   let adbCheckResult = document.querySelector("#adb-check > .yesno");
-  let certCheckResult = document.querySelector("#certified-check > .yesno");
-  let flipCertPerfButton = document.querySelector("#certified-check button");
+  let devtoolsCheckResult = document.querySelector("#devtools-check > .yesno");
+  let flipCertPerfButton = document.querySelector("#devtools-check button");
   let adbRootButton = document.querySelector("#adb-check button");
-  let flipCertPerfAction = document.querySelector("#certified-check > .action");
+  let flipCertPerfAction = document.querySelector("#devtools-check > .action");
   let adbRootAction = document.querySelector("#adb-check > .action");
 
   let sYes = Strings.GetStringFromName("runtimedetails_checkyes");
   let sNo = Strings.GetStringFromName("runtimedetails_checkno");
   let sUnknown = Strings.GetStringFromName("runtimedetails_checkunknown");
   let sNotUSB = Strings.GetStringFromName("runtimedetails_notUSBDevice");
 
   flipCertPerfButton.setAttribute("disabled", "true");
   flipCertPerfAction.setAttribute("hidden", "true");
   adbRootAction.setAttribute("hidden", "true");
 
   adbCheckResult.textContent = sUnknown;
-  certCheckResult.textContent = sUnknown;
+  devtoolsCheckResult.textContent = sUnknown;
 
   if (AppManager.connection &&
       AppManager.connection.status == Connection.Status.CONNECTED) {
 
     // ADB check
     if (AppManager.selectedRuntime.type === RuntimeTypes.USB) {
       let device = AppManager.selectedRuntime.device;
       if (device && device.summonRoot) {
@@ -104,25 +109,25 @@ function CheckLockState() {
       adbCheckResult.textContent = sNotUSB;
     }
 
     // forbid-certified-apps check
     try {
       let prefFront = AppManager.preferenceFront;
       prefFront.getBoolPref("devtools.debugger.forbid-certified-apps").then(isForbidden => {
         if (isForbidden) {
-          certCheckResult.textContent = sYes;
+          devtoolsCheckResult.textContent = sNo;
           flipCertPerfAction.removeAttribute("hidden");
         } else {
-          certCheckResult.textContent = sNo;
+          devtoolsCheckResult.textContent = sYes;
         }
       }, e => console.error(e));
     } catch(e) {
       // Exception. pref actor is only accessible if forbird-certified-apps is false
-      certCheckResult.textContent = sYes;
+      devtoolsCheckResult.textContent = sYes;
       flipCertPerfAction.removeAttribute("hidden");
     }
 
   }
 
 }
 
 function EnableCertApps() {
--- a/browser/devtools/webide/content/runtimedetails.xhtml
+++ b/browser/devtools/webide/content/runtimedetails.xhtml
@@ -27,18 +27,18 @@
     <div id="devicePrivileges">
       <p id="adb-check">
         &runtimedetails_adbIsRoot;<span class="yesno"></span>
         <div class="action">
           <button>&runtimedetails_summonADBRoot;</button>
           <em>&runtimedetails_ADBRootWarning;</em>
         </div>
       </p>
-      <p id="certified-check">
-        &runtimedetails_restrictedPrivileges;<span class="yesno"></span>
+      <p id="devtools-check">
+        <a id="unrestricted-privileges">&runtimedetails_unrestrictedPrivileges;</a><span class="yesno"></span>
         <div class="action">
           <button>&runtimedetails_requestPrivileges;</button>
           <em>&runtimedetails_privilegesWarning;</em>
         </div>
       </p>
     </div>
 
     <table></table>
--- a/browser/devtools/webide/themes/runtimedetails.css
+++ b/browser/devtools/webide/themes/runtimedetails.css
@@ -6,15 +6,20 @@ html, body {
   background: white;
 }
 
 #devicePrivileges {
   font-family: monospace;
   padding-left: 6px;
 }
 
+#devtools-check > a {
+  color: #4C9ED9;
+  cursor: pointer;
+}
+
 .action {
   display: inline;
 }
 
 .action[hidden] {
   display: none;
 }
--- a/browser/locales/en-US/chrome/browser/devtools/webide.dtd
+++ b/browser/locales/en-US/chrome/browser/devtools/webide.dtd
@@ -140,17 +140,17 @@
 <!ENTITY permissionstable_title "Permissions Table">
 <!ENTITY permissionstable_name_header "Name">
 
 <!-- Runtime Details -->
 <!ENTITY runtimedetails_title "Runtime Info">
 <!ENTITY runtimedetails_adbIsRoot "ADB is root: ">
 <!ENTITY runtimedetails_summonADBRoot "root device">
 <!ENTITY runtimedetails_ADBRootWarning "(requires unlocked bootloader)">
-<!ENTITY runtimedetails_restrictedPrivileges "DevTools restricted privileges: ">
+<!ENTITY runtimedetails_unrestrictedPrivileges "Unrestricted DevTools privileges: ">
 <!ENTITY runtimedetails_requestPrivileges "request higher privileges">
 <!ENTITY runtimedetails_privilegesWarning "(Will reboot device. Requires root access.)">
 
 <!-- Device Preferences and Settings -->
 <!ENTITY device_typeboolean "Boolean">
 <!ENTITY device_typenumber "Integer">
 <!ENTITY device_typestring "String">
 <!ENTITY device_typeobject "Object">