mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1109388 - Delay reading data. r=jryans
This commit is contained in:
parent
e7acbba670
commit
cd1aa45c33
@ -4,7 +4,6 @@
|
||||
|
||||
const Cu = Components.utils;
|
||||
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 ConfigView = require("devtools/webide/config-view");
|
||||
@ -74,16 +73,8 @@ function BuildUI() {
|
||||
configView.kind = "Pref";
|
||||
configView.includeTypeName = true;
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
getAllPrefs = AppManager.preferenceFront.getAllPrefs()
|
||||
.then(json => configView.generateDisplay(json));
|
||||
} else {
|
||||
CloseUI();
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
const Cu = Components.utils;
|
||||
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 ConfigView = require("devtools/webide/config-view");
|
||||
@ -75,15 +74,7 @@ function BuildUI() {
|
||||
configView.includeTypeName = false;
|
||||
|
||||
getAllSettings = AppManager.settingsFront.getAllSettings()
|
||||
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);
|
||||
}
|
||||
});
|
||||
.then(json => configView.generateDisplay(json));
|
||||
} else {
|
||||
CloseUI();
|
||||
}
|
||||
|
@ -30,6 +30,35 @@ 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");
|
||||
@ -41,34 +70,8 @@ function BuildUI() {
|
||||
if (AppManager.connection &&
|
||||
AppManager.connection.status == Connection.Status.CONNECTED &&
|
||||
AppManager.deviceFront) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
getRawPermissionsTablePromise = AppManager.deviceFront.getRawPermissionsTable()
|
||||
.then(json => generateFields(json));
|
||||
} else {
|
||||
CloseUI();
|
||||
}
|
||||
|
@ -41,6 +41,20 @@ function OnAppManagerUpdate(event, what) {
|
||||
}
|
||||
}
|
||||
|
||||
function generateFields(json) {
|
||||
let table = document.querySelector("table");
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
let getDescriptionPromise; // Used by tests
|
||||
function BuildUI() {
|
||||
let table = document.querySelector("table");
|
||||
@ -48,19 +62,8 @@ function BuildUI() {
|
||||
if (AppManager.connection &&
|
||||
AppManager.connection.status == Connection.Status.CONNECTED &&
|
||||
AppManager.deviceFront) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
getDescriptionPromise = AppManager.deviceFront.getDescription()
|
||||
.then(json => generateFields(json));
|
||||
} else {
|
||||
CloseUI();
|
||||
}
|
||||
|
@ -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" src="permissionstable.xhtml"/>
|
||||
<iframe id="deck-panel-runtimedetails" flex="1" src="runtimedetails.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-monitor" flex="1" lazysrc="monitor.xhtml"/>
|
||||
<iframe id="deck-panel-devicepreferences" flex="1" src="devicepreferences.xhtml"/>
|
||||
<iframe id="deck-panel-devicesettings" flex="1" src="devicesettings.xhtml"/>
|
||||
<iframe id="deck-panel-devicepreferences" flex="1" lazysrc="devicepreferences.xhtml"/>
|
||||
<iframe id="deck-panel-devicesettings" flex="1" lazysrc="devicesettings.xhtml"/>
|
||||
</deck>
|
||||
<splitter hidden="true" class="devtools-horizontal-splitter" orient="vertical"/>
|
||||
<!-- toolbox iframe will be inserted here -->
|
||||
|
@ -85,6 +85,16 @@ 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");
|
||||
@ -115,6 +125,10 @@ 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");
|
||||
|
@ -44,7 +44,8 @@ support-files =
|
||||
[test_runtime.html]
|
||||
[test_manifestUpdate.html]
|
||||
[test_addons.html]
|
||||
[test_deviceinfo.html]
|
||||
[test_device_runtime.html]
|
||||
[test_device_permissions.html]
|
||||
[test_autoconnect_runtime.html]
|
||||
[test_telemetry.html]
|
||||
[test_device_preferences.html]
|
||||
|
@ -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, false, "Existing boolean value is correct");
|
||||
is(existing.checked, true, "Existing boolean value is correct");
|
||||
resetBtn = doc.getElementById("btn-" + id);
|
||||
resetBtn.click();
|
||||
|
||||
|
@ -137,6 +137,15 @@ function documentIsLoaded(doc) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function lazyIframeIsLoaded(iframe) {
|
||||
let deferred = promise.defer();
|
||||
iframe.addEventListener("load", function onLoad() {
|
||||
iframe.removeEventListener("load", onLoad, true);
|
||||
deferred.resolve();
|
||||
}, true);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function addTab(aUrl, aWindow) {
|
||||
info("Adding tab: " + aUrl);
|
||||
|
||||
|
@ -29,53 +29,26 @@
|
||||
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 permIframe.contentWindow.getRawPermissionsTablePromise;
|
||||
yield nextTick();
|
||||
|
||||
yield lazyIframeIsLoaded(permIframe);
|
||||
|
||||
yield nextTick();
|
||||
|
||||
yield permIframe.contentWindow.getRawPermissionsTablePromise;
|
||||
|
||||
doc = permIframe.contentWindow.document;
|
||||
trs = doc.querySelectorAll(".line");
|
||||
found = false;
|
||||
@ -86,6 +59,7 @@
|
||||
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");
|
||||
@ -99,15 +73,11 @@
|
||||
yield closeWebIDE(win);
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
||||
}).then(null, e => {
|
||||
ok(false, "Exception: " + e);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -30,14 +30,10 @@
|
||||
|
||||
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");
|
||||
@ -47,18 +43,24 @@
|
||||
win.Cmds.showDevicePrefs();
|
||||
is(deck.selectedPanel, prefIframe, "device preferences iframe selected");
|
||||
|
||||
yield prefIframe.contentWindow.getAllPrefs;
|
||||
yield nextTick();
|
||||
|
||||
yield lazyIframeIsLoaded(prefIframe);
|
||||
|
||||
yield nextTick();
|
||||
|
||||
yield prefIframe.contentWindow.getAllPrefs;
|
||||
|
||||
setDocument(prefIframe);
|
||||
|
||||
let fields = doc.querySelectorAll(".editable");
|
||||
let preference = "accessibility.blockautorefresh";
|
||||
|
||||
fieldChange(fields, preference);
|
||||
|
||||
addNewField();
|
||||
|
||||
let preference = "accessibility.accesskeycausesactivation";
|
||||
|
||||
fieldChange(fields, preference);
|
||||
|
||||
addNewFieldWithEnter();
|
||||
|
||||
editExistingField();
|
||||
|
85
browser/devtools/webide/test/test_device_runtime.html
Normal file
85
browser/devtools/webide/test/test_device_runtime.html
Normal file
@ -0,0 +1,85 @@
|
||||
<!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 lazyIframeIsLoaded(detailsIframe);
|
||||
|
||||
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>
|
@ -34,14 +34,10 @@
|
||||
|
||||
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");
|
||||
@ -51,9 +47,14 @@
|
||||
win.Cmds.showSettings();
|
||||
is(deck.selectedPanel, settingIframe, "device settings iframe selected");
|
||||
|
||||
yield settingIframe.contentWindow.getAllSettings;
|
||||
yield nextTick();
|
||||
|
||||
yield lazyIframeIsLoaded(settingIframe);
|
||||
|
||||
yield nextTick();
|
||||
|
||||
yield settingIframe.contentWindow.getAllSettings;
|
||||
|
||||
setDocument(settingIframe);
|
||||
|
||||
let fields = doc.querySelectorAll(".editable");
|
||||
|
Loading…
Reference in New Issue
Block a user