Backed out changeset 6a701bd8f339 (bug 1109388)

This commit is contained in:
Ryan VanderMeulen 2015-02-10 11:43:45 -05:00
parent 3c054f380c
commit 5bd25b92d7
12 changed files with 116 additions and 184 deletions

View File

@ -74,8 +74,16 @@ function BuildUI() {
configView.kind = "Pref";
configView.includeTypeName = true;
getAllPrefs = AppManager.preferenceFront.getAllPrefs()
.then(json => configView.generateDisplay(json));
getAllPrefs = AppManager.preferenceFront.getAllPrefs();
getAllPrefs.then(json => {
let deviceItems = Object.keys(json);
deviceItems.sort();
configView.keys = deviceItems;
for (let i = 0; i < configView.keys.length; i++) {
let key = configView.keys[i];
configView.generateField(key, json[key].value, json[key].hasUserValue);
}
});
} else {
CloseUI();
}

View File

@ -75,7 +75,15 @@ function BuildUI() {
configView.includeTypeName = false;
getAllSettings = AppManager.settingsFront.getAllSettings()
.then(json => configView.generateDisplay(json));
getAllSettings.then(json => {
let deviceItems = Object.keys(json);
deviceItems.sort();
configView.keys = deviceItems;
for (let i = 0; i < configView.keys.length; i++) {
let key = configView.keys[i];
configView.generateField(key, json[key].value, json[key].hasUserValue);
}
});
} else {
CloseUI();
}

View File

@ -5,7 +5,6 @@
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 {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const {AppManager} = require("devtools/webide/app-manager");
const {Connection} = require("devtools/client/connection-manager");
@ -31,35 +30,6 @@ function OnAppManagerUpdate(event, what) {
}
}
function generateFields(json) {
let table = document.querySelector("table");
let permissionsTable = json.rawPermissionsTable;
for (let name in permissionsTable) {
let tr = document.createElement("tr");
tr.className = "line";
let td = document.createElement("td");
td.textContent = name;
tr.appendChild(td);
for (let type of ["app","privileged","certified"]) {
let td = document.createElement("td");
if (permissionsTable[name][type] == json.ALLOW_ACTION) {
td.textContent = "✓";
td.className = "permallow";
}
if (permissionsTable[name][type] == json.PROMPT_ACTION) {
td.textContent = "!";
td.className = "permprompt";
}
if (permissionsTable[name][type] == json.DENY_ACTION) {
td.textContent = "✕";
td.className = "permdeny"
}
tr.appendChild(td);
}
table.appendChild(tr);
}
}
let getRawPermissionsTablePromise; // Used by tests
function BuildUI() {
let table = document.querySelector("table");
@ -71,8 +41,34 @@ function BuildUI() {
if (AppManager.connection &&
AppManager.connection.status == Connection.Status.CONNECTED &&
AppManager.deviceFront) {
getRawPermissionsTablePromise = AppManager.deviceFront.getRawPermissionsTable()
.then(json => generateFields(json));
getRawPermissionsTablePromise = AppManager.deviceFront.getRawPermissionsTable();
getRawPermissionsTablePromise.then(json => {
let permissionsTable = json.rawPermissionsTable;
for (let name in permissionsTable) {
let tr = document.createElement("tr");
tr.className = "line";
let td = document.createElement("td");
td.textContent = name;
tr.appendChild(td);
for (let type of ["app","privileged","certified"]) {
let td = document.createElement("td");
if (permissionsTable[name][type] == json.ALLOW_ACTION) {
td.textContent = "✓";
td.className = "permallow";
}
if (permissionsTable[name][type] == json.PROMPT_ACTION) {
td.textContent = "!";
td.className = "permprompt";
}
if (permissionsTable[name][type] == json.DENY_ACTION) {
td.textContent = "✕";
td.className = "permdeny"
}
tr.appendChild(td);
}
table.appendChild(tr);
}
});
} else {
CloseUI();
}

View File

@ -5,7 +5,6 @@
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 {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
const {AppManager} = require("devtools/webide/app-manager");
const {Connection} = require("devtools/client/connection-manager");
const {RuntimeTypes} = require("devtools/webide/runtimes");
@ -42,23 +41,6 @@ function OnAppManagerUpdate(event, what) {
}
}
function generateFields(json) {
let table = document.querySelector("table");
let deferred = promise.defer();
for (let name in json) {
let tr = document.createElement("tr");
let td = document.createElement("td");
td.textContent = name;
tr.appendChild(td);
td = document.createElement("td");
td.textContent = json[name];
tr.appendChild(td);
table.appendChild(tr);
};
deferred.resolve();
return deferred.promise;
}
let getDescriptionPromise; // Used by tests
function BuildUI() {
let table = document.querySelector("table");
@ -66,8 +48,19 @@ function BuildUI() {
if (AppManager.connection &&
AppManager.connection.status == Connection.Status.CONNECTED &&
AppManager.deviceFront) {
getDescriptionPromise = AppManager.deviceFront.getDescription().then(json =>
generateFields(json));
getDescriptionPromise = AppManager.deviceFront.getDescription();
getDescriptionPromise.then(json => {
for (let name in json) {
let tr = document.createElement("tr");
let td = document.createElement("td");
td.textContent = name;
tr.appendChild(td);
td = document.createElement("td");
td.textContent = json[name];
tr.appendChild(td);
table.appendChild(tr);
}
});
} else {
CloseUI();
}

View File

@ -196,11 +196,11 @@
<iframe id="deck-panel-projecteditor" flex="1"/>
<iframe id="deck-panel-addons" flex="1" src="addons.xhtml"/>
<iframe id="deck-panel-prefs" flex="1" src="prefs.xhtml"/>
<iframe id="deck-panel-permissionstable" flex="1" lazysrc="permissionstable.xhtml"/>
<iframe id="deck-panel-runtimedetails" flex="1" lazysrc="runtimedetails.xhtml"/>
<iframe id="deck-panel-permissionstable" flex="1" src="permissionstable.xhtml"/>
<iframe id="deck-panel-runtimedetails" flex="1" src="runtimedetails.xhtml"/>
<iframe id="deck-panel-monitor" flex="1" lazysrc="monitor.xhtml"/>
<iframe id="deck-panel-devicepreferences" flex="1" lazysrc="devicepreferences.xhtml"/>
<iframe id="deck-panel-devicesettings" flex="1" lazysrc="devicesettings.xhtml"/>
<iframe id="deck-panel-devicepreferences" flex="1" src="devicepreferences.xhtml"/>
<iframe id="deck-panel-devicesettings" flex="1" src="devicesettings.xhtml"/>
</deck>
<splitter hidden="true" class="devtools-horizontal-splitter" orient="vertical"/>
<!-- toolbox iframe will be inserted here -->

View File

@ -85,16 +85,6 @@ ConfigView.prototype = {
}
},
generateDisplay: function(json) {
let deviceItems = Object.keys(json);
deviceItems.sort();
this.keys = deviceItems;
for (let i = 0; i < this.keys.length; i++) {
let key = this.keys[i];
this.generateField(key, json[key].value, json[key].hasUserValue);
}
},
generateField: function(name, value, hasUserValue, customType, newRow) {
let table = this._doc.querySelector("table");
let sResetDefault = Strings.GetStringFromName("device_reset_default");
@ -125,10 +115,6 @@ ConfigView.prototype = {
input.value = value;
}
if (!(this._includeTypeName || isNaN(parseInt(value, 10)))) {
input.type = "number";
}
td.appendChild(input);
tr.appendChild(td);
td = this._doc.createElement("td");

View File

@ -44,8 +44,7 @@ support-files =
[test_runtime.html]
[test_manifestUpdate.html]
[test_addons.html]
[test_device_runtime.html]
[test_device_permissions.html]
[test_deviceinfo.html]
[test_autoconnect_runtime.html]
[test_telemetry.html]
[test_device_preferences.html]

View File

@ -133,7 +133,7 @@ let editFieldInteger = Task.async(function*() {
let resetExistingField = Task.async(function*(id) {
let existing = doc.getElementById(id);
existing.click();
is(existing.checked, true, "Existing boolean value is correct");
is(existing.checked, false, "Existing boolean value is correct");
resetBtn = doc.getElementById("btn-" + id);
resetBtn.click();

View File

@ -30,10 +30,14 @@
let prefIframe = win.document.querySelector("#deck-panel-devicepreferences");
yield documentIsLoaded(prefIframe.contentWindow.document);
win.AppManager.update("runtimelist");
yield connectToLocalRuntime(win);
yield nextTick();
let prefs = win.document.querySelector("#cmd_showDevicePrefs");
ok(!prefs.hasAttribute("disabled"), "device prefs cmd enabled");
@ -43,24 +47,18 @@
win.Cmds.showDevicePrefs();
is(deck.selectedPanel, prefIframe, "device preferences iframe selected");
yield nextTick();
yield documentIsLoaded(prefIframe.contentWindow.document);
yield nextTick();
yield prefIframe.contentWindow.getAllPrefs;
yield nextTick();
setDocument(prefIframe);
let fields = doc.querySelectorAll(".editable");
addNewField();
let preference = "accessibility.accesskeycausesactivation";
let preference = "accessibility.blockautorefresh";
fieldChange(fields, preference);
addNewField();
addNewFieldWithEnter();
editExistingField();

View File

@ -1,85 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title></title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
<script type="application/javascript;version=1.8" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<script type="application/javascript;version=1.8">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
Task.spawn(function* () {
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
let win = yield openWebIDE();
let detailsIframe = win.document.querySelector("#deck-panel-runtimedetails");
yield connectToLocalRuntime(win);
let details = win.document.querySelector("#cmd_showRuntimeDetails");
ok(!details.hasAttribute("disabled"), "info cmd enabled");
let deck = win.document.querySelector("#deck");
win.Cmds.showRuntimeDetails();
is(deck.selectedPanel, detailsIframe, "info iframe selected");
yield nextTick();
yield documentIsLoaded(detailsIframe.contentWindow.document);
yield nextTick();
yield detailsIframe.contentWindow.getDescriptionPromise;
// device info and permissions content is checked in other tests
// We just test one value to make sure we get something
let doc = detailsIframe.contentWindow.document;
let trs = doc.querySelectorAll("tr");
let found = false;
for (let tr of trs) {
let [name,val] = tr.querySelectorAll("td");
if (name.textContent == "appid") {
found = true;
is(val.textContent, Services.appinfo.ID, "appid has the right value");
break;
}
}
ok(found, "Found appid line");
doc.querySelector("#close").click();
ok(!deck.selectedPanel, "No panel selected");
DebuggerServer.destroy();
yield closeWebIDE(win);
SimpleTest.finish();
}).then(null, e => {
ok(false, "Exception: " + e);
SimpleTest.finish();
});
}
</script>
</body>
</html>

View File

@ -34,10 +34,14 @@
let settingIframe = win.document.querySelector("#deck-panel-devicesettings");
yield documentIsLoaded(settingIframe.contentWindow.document);
win.AppManager.update("runtimelist");
yield connectToLocalRuntime(win);
yield nextTick();
let settings = win.document.querySelector("#cmd_showSettings");
ok(!settings.hasAttribute("disabled"), "device settings cmd enabled");
@ -47,13 +51,8 @@
win.Cmds.showSettings();
is(deck.selectedPanel, settingIframe, "device settings iframe selected");
yield nextTick();
yield documentIsLoaded(settingIframe.contentWindow.document);
yield nextTick();
yield settingIframe.contentWindow.getAllSettings;
yield nextTick();
setDocument(settingIframe);

View File

@ -29,26 +29,53 @@
let win = yield openWebIDE();
let permIframe = win.document.querySelector("#deck-panel-permissionstable");
let infoIframe = win.document.querySelector("#deck-panel-runtimedetails");
yield documentIsLoaded(permIframe.contentWindow.document);
yield documentIsLoaded(infoIframe.contentWindow.document);
yield connectToLocalRuntime(win);
yield nextTick();
let perm = win.document.querySelector("#cmd_showPermissionsTable");
let info = win.document.querySelector("#cmd_showRuntimeDetails");
ok(!perm.hasAttribute("disabled"), "perm cmd enabled");
ok(!info.hasAttribute("disabled"), "info cmd enabled");
let deck = win.document.querySelector("#deck");
win.Cmds.showRuntimeDetails();
is(deck.selectedPanel, infoIframe, "info iframe selected");
yield infoIframe.contentWindow.getDescriptionPromise;
yield nextTick();
// device info and permissions content is checked in other tests
// We just test one value to make sure we get something
let doc = infoIframe.contentWindow.document;
let trs = doc.querySelectorAll("tr");
let found = false;
for (let tr of trs) {
let [name,val] = tr.querySelectorAll("td");
if (name.textContent == "appid") {
found = true;
is(val.textContent, Services.appinfo.ID, "appid has the right value");
}
}
ok(found, "Found appid line");
win.Cmds.showPermissionsTable();
is(deck.selectedPanel, permIframe, "permission iframe selected");
yield nextTick();
yield documentIsLoaded(permIframe.contentWindow.document);
yield nextTick();
yield permIframe.contentWindow.getRawPermissionsTablePromise;
yield nextTick();
doc = permIframe.contentWindow.document;
trs = doc.querySelectorAll(".line");
found = false;
@ -59,7 +86,6 @@
is(v1.className, "permprompt", "geolocation perm is valid");
is(v2.className, "permprompt", "geolocation perm is valid");
is(v3.className, "permprompt", "geolocation perm is valid");
break;
}
}
ok(found, "Found geolocation line");
@ -73,11 +99,15 @@
yield closeWebIDE(win);
SimpleTest.finish();
}).then(null, e => {
ok(false, "Exception: " + e);
SimpleTest.finish();
});
}
</script>
</body>
</html>