Bug 1076735 - Improve display of super DevTools mode request. r=jryans

This commit is contained in:
Gene Vityugov 2015-01-27 10:59:00 -05:00
parent 13824b3d7b
commit a4413d06d8
4 changed files with 21 additions and 11 deletions

View File

@ -10,11 +10,16 @@ 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();
@ -63,10 +68,10 @@ function BuildUI() {
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");
@ -79,7 +84,7 @@ function CheckLockState() {
adbRootAction.setAttribute("hidden", "true");
adbCheckResult.textContent = sUnknown;
certCheckResult.textContent = sUnknown;
devtoolsCheckResult.textContent = sUnknown;
if (AppManager.connection &&
AppManager.connection.status == Connection.Status.CONNECTED) {
@ -109,15 +114,15 @@ function CheckLockState() {
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");
}

View File

@ -32,8 +32,8 @@
<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>

View File

@ -11,6 +11,11 @@ html, body {
padding-left: 6px;
}
#devtools-check > a {
color: #4C9ED9;
cursor: pointer;
}
.action {
display: inline;
}

View File

@ -145,7 +145,7 @@
<!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.)">