--- a/devtools/client/webaudioeditor/controller.js
+++ b/devtools/client/webaudioeditor/controller.js
@@ -78,44 +78,44 @@ var WebAudioEditorController = {
// early request to ensure the CallWatcherActor is running and watching for new window
// globals.
gFront.setup({ reload: false });
},
/**
* Remove events emitted by the current tab target.
*/
- destroy: function () {
+ destroy: function() {
gTarget.off("will-navigate", this._onTabWillNavigate);
gFront.off("start-context", this._onStartContext);
gFront.off("create-node", this._onCreateNode);
gFront.off("connect-node", this._onConnectNode);
gFront.off("connect-param", this._onConnectParam);
gFront.off("disconnect-node", this._onDisconnectNode);
gFront.off("change-param", this._onChangeParam);
gFront.off("destroy-node", this._onDestroyNode);
this._prefObserver.off("devtools.theme", this._onThemeChange);
this._prefObserver.destroy();
},
/**
* Called when page is reloaded to show the reload notice and waiting
* for an audio context notice.
*/
- reset: function () {
+ reset: function() {
$("#content").hidden = true;
ContextView.resetUI();
InspectorView.resetUI();
PropertiesView.resetUI();
},
// Since node events (create, disconnect, connect) are all async,
// we have to make sure to wait that the node has finished creating
// before performing an operation on it.
- getNode: async function (nodeActor) {
+ getNode: async function(nodeActor) {
let id = nodeActor.actorID;
let node = gAudioNodes.get(id);
if (!node) {
let { resolve, promise } = defer();
gAudioNodes.on("add", function createNodeListener(createdNode) {
if (createdNode.id === id) {
gAudioNodes.off("add", createNodeListener);
@@ -127,17 +127,17 @@ var WebAudioEditorController = {
return node;
},
/**
* Fired when the devtools theme changes (light, dark, etc.)
* so that the graph can update marker styling, as that
* cannot currently be done with CSS.
*/
- _onThemeChange: function () {
+ _onThemeChange: function() {
let newValue = Services.prefs.getCharPref("devtools.theme");
window.emit(EVENTS.THEME_CHANGE, newValue);
},
/**
* Called for each location change in the debugged tab.
*/
_onTabWillNavigate: function({isFrameSwitching}) {
@@ -162,36 +162,36 @@ var WebAudioEditorController = {
window.emit(EVENTS.UI_RESET);
},
/**
* Called after the first audio node is created in an audio context,
* signaling that the audio context is being used.
*/
- _onStartContext: function () {
+ _onStartContext: function() {
$("#reload-notice").hidden = true;
$("#waiting-notice").hidden = true;
$("#content").hidden = false;
window.emit(EVENTS.START_CONTEXT);
},
/**
* Called when a new node is created. Creates an `AudioNodeView` instance
* for tracking throughout the editor.
*/
- _onCreateNode: function (nodeActor) {
+ _onCreateNode: function(nodeActor) {
gAudioNodes.add(nodeActor);
},
/**
* Called on `destroy-node` when an AudioNode is GC'd. Removes
* from the AudioNode array and fires an event indicating the removal.
*/
- _onDestroyNode: function (nodeActor) {
+ _onDestroyNode: function(nodeActor) {
gAudioNodes.remove(gAudioNodes.get(nodeActor.actorID));
},
/**
* Called when a node is connected to another node.
*/
async _onConnectNode({ source: sourceActor, dest: destActor }) {
let source = await WebAudioEditorController.getNode(sourceActor);
--- a/devtools/client/webaudioeditor/includes.js
+++ b/devtools/client/webaudioeditor/includes.js
@@ -79,18 +79,22 @@ var gToolbox, gTarget, gFront;
/**
* Convenient way of emitting events from the panel window.
*/
EventEmitter.decorate(this);
/**
* DOM query helper.
*/
-function $(selector, target = document) { return target.querySelector(selector); }
-function $$(selector, target = document) { return target.querySelectorAll(selector); }
+function $(selector, target = document) {
+ return target.querySelector(selector);
+}
+function $$(selector, target = document) {
+ return target.querySelectorAll(selector);
+}
/**
* Takes an iterable collection, and a hash. Return the first
* object in the collection that matches the values in the hash.
* From Backbone.Collection#findWhere
* http://backbonejs.org/#Collection-findWhere
*/
function findWhere(collection, attrs) {
--- a/devtools/client/webaudioeditor/models.js
+++ b/devtools/client/webaudioeditor/models.js
@@ -136,17 +136,16 @@ class AudioNodeModel extends EventEmitte
}
}
toString() {
return "[object AudioNodeModel]";
}
}
-
/**
* Constructor for a Collection of `AudioNodeModel` models.
*
* Events:
* - `add`: node
* - `remove`: node
* - `connect`: node, destinationNode, parameter
* - `disconnect`: node
--- a/devtools/client/webaudioeditor/panel.js
+++ b/devtools/client/webaudioeditor/panel.js
@@ -15,17 +15,17 @@ function WebAudioEditorPanel(iframeWindo
this._destroyer = null;
EventEmitter.decorate(this);
}
exports.WebAudioEditorPanel = WebAudioEditorPanel;
WebAudioEditorPanel.prototype = {
- open: function () {
+ open: function() {
let targetPromise;
// Local debugging needs to make the target remote.
if (!this.target.isRemote) {
targetPromise = this.target.makeRemote();
} else {
targetPromise = Promise.resolve(this.target);
}
@@ -50,17 +50,17 @@ WebAudioEditorPanel.prototype = {
},
// DevToolPanel API
get target() {
return this._toolbox.target;
},
- destroy: function () {
+ destroy: function() {
// Make sure this panel is not already destroyed.
if (this._destroyer) {
return this._destroyer;
}
return this._destroyer = this.panelWin.shutdownWebAudioEditor().then(() => {
// Destroy front to ensure packet handler is removed from client
this.panelWin.gFront.destroy();
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-add-automation-event.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-add-automation-event.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#addAutomationEvent();
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
let count = 0;
let counter = () => count++;
front.on("automation-event", counter);
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-bypass.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-bypass.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#bypass(), AudioNode#isBypassed()
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
is((await gainNode.isBypassed()), false, "Nodes start off unbypassed.");
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-bypassable.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-bypassable.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#bypassable
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
getN(front, "create-node", 14)
]);
let actualBypassability = nodes.map(node => node.bypassable);
let expectedBypassability = [
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-connectnode-disconnect.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-connectnode-disconnect.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that AudioNodeActor#connectNode() and AudioNodeActor#disconnect() work.
* Uses the editor front as the actors do not retain connect state.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
let events = Promise.all([
get3(gFront, "create-node"),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-connectparam.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-connectparam.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that AudioNodeActor#connectParam() work.
* Uses the editor front as the actors do not retain connect state.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
let events = Promise.all([
get3(gFront, "create-node"),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-01.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-01.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#addAutomationEvent() checking automation values, also using
* a curve as the last event to check duration spread.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
let t0 = 0, t1 = 0.1, t2 = 0.2, t3 = 0.3, t4 = 0.4, t5 = 0.6, t6 = 0.7, t7 = 1;
let curve = [-1, 0, 1];
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-02.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-02.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#addAutomationEvent() when automation series ends with
* `setTargetAtTime`, which approaches its target to infinity.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
await oscNode.addAutomationEvent("frequency", "setValueAtTime", [300, 0.1]);
await oscNode.addAutomationEvent("frequency", "linearRampToValueAtTime", [500, 0.4]);
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-03.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-automation-data-03.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that `cancelScheduledEvents` clears out events on and after
* its argument.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
await oscNode.addAutomationEvent("frequency", "setValueAtTime", [300, 0]);
await oscNode.addAutomationEvent("frequency", "linearRampToValueAtTime", [500, 0.9]);
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-param-flags.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-param-flags.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#getParamFlags()
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
getN(front, "create-node", 15)
]);
let allNodeParams = await Promise.all(nodes.map(node => node.getParams()));
let nodeTypes = [
@@ -28,20 +28,18 @@ add_task(async function () {
let params = allNodeParams[i];
for (let {param, value, flags} of params) {
let testFlags = await nodes[i].getParamFlags(param);
ok(typeof testFlags === "object", type + " has flags from #getParamFlags(" + param + ")");
if (param === "buffer") {
is(flags.Buffer, true, "`buffer` params have Buffer flag");
- }
- else if (param === "bufferSize" || param === "frequencyBinCount") {
+ } else if (param === "bufferSize" || param === "frequencyBinCount") {
is(flags.readonly, true, param + " is readonly");
- }
- else if (param === "curve") {
- is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
+ } else if (param === "curve") {
+ is(flags.Float32Array, true, "`curve` param has Float32Array flag");
}
}
}
await removeTab(target.tab);
});
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-params-01.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-params-01.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#getParams()
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
getN(front, "create-node", 15)
]);
await loadFrameScriptUtils();
@@ -30,20 +30,18 @@ add_task(async function () {
params.forEach(({param, value, flags}) => {
ok(param in defaults[i], "expected parameter for " + type);
ok(typeof flags === "object", type + " has a flags object");
if (param === "buffer") {
is(flags.Buffer, true, "`buffer` params have Buffer flag");
- }
- else if (param === "bufferSize" || param === "frequencyBinCount") {
+ } else if (param === "bufferSize" || param === "frequencyBinCount") {
is(flags.readonly, true, param + " is readonly");
- }
- else if (param === "curve") {
- is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
+ } else if (param === "curve") {
+ is(flags.Float32Array, true, "`curve` param has Float32Array flag");
}
});
});
await removeTab(target.tab);
});
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-params-02.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-params-02.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that default properties are returned with the correct type
* from the AudioNode actors.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
getN(front, "create-node", 15)
]);
await loadFrameScriptUtils();
@@ -34,18 +34,17 @@ add_task(async function () {
await removeTab(target.tab);
});
function compare(actual, expected, type) {
actual.forEach(({ value, param }) => {
value = getGripValue(value);
if (typeof expected[param] === "function") {
ok(expected[param](value), type + " has a passing value for " + param);
- }
- else {
+ } else {
is(value, expected[param], type + " has correct default value and type for " + param);
}
});
info(Object.keys(expected).join(",") + " - " + JSON.stringify(expected));
is(actual.length, Object.keys(expected).length,
type + " has correct amount of properties.");
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-get-set-param.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-get-set-param.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#getParam() / AudioNode#setParam()
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, [destNode, oscNode, gainNode]] = await Promise.all([
front.setup({ reload: true }),
get3(front, "create-node")
]);
let freq = await oscNode.getParam("frequency");
info(typeof freq);
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-source.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-source.js
@@ -1,27 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#source
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
getN(front, "create-node", 14)
]);
let actualTypes = nodes.map(node => node.type);
let isSourceResult = nodes.map(node => node.source);
actualTypes.forEach((type, i) => {
let shouldBeSource = type === "AudioBufferSourceNode" || type === "OscillatorNode";
- if (shouldBeSource)
+ if (shouldBeSource) {
is(isSourceResult[i], true, type + "'s `source` is `true`");
- else
+ } else {
is(isSourceResult[i], false, type + "'s `source` is `false`");
+ }
});
await removeTab(target.tab);
});
--- a/devtools/client/webaudioeditor/test/browser_audionode-actor-type.js
+++ b/devtools/client/webaudioeditor/test/browser_audionode-actor-type.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test AudioNode#type
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_NODES_URL);
let [_, nodes] = await Promise.all([
front.setup({ reload: true }),
getN(front, "create-node", 14)
]);
let actualTypes = nodes.map(node => node.type);
let expectedTypes = [
--- a/devtools/client/webaudioeditor/test/browser_callwatcher-01.js
+++ b/devtools/client/webaudioeditor/test/browser_callwatcher-01.js
@@ -5,17 +5,17 @@
* Bug 1130901
* Tests to ensure that calling call/apply on methods wrapped
* via CallWatcher do not throw a security permissions error:
* "Error: Permission denied to access property 'call'"
*/
const BUG_1130901_URL = EXAMPLE_URL + "doc_bug_1130901.html";
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1130901_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
let rendered = waitForGraphRendered(panelWin, 3, 0);
reload(target);
await rendered;
--- a/devtools/client/webaudioeditor/test/browser_callwatcher-02.js
+++ b/devtools/client/webaudioeditor/test/browser_callwatcher-02.js
@@ -4,17 +4,17 @@
/**
* Bug 1112378
* Tests to ensure that errors called on wrapped functions via call-watcher
* correctly looks like the error comes from the content, not from within the devtools.
*/
const BUG_1112378_URL = EXAMPLE_URL + "doc_bug_1112378.html";
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1112378_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
loadFrameScriptUtils();
let rendered = waitForGraphRendered(panelWin, 2, 0);
reload(target);
--- a/devtools/client/webaudioeditor/test/browser_wa_automation-view-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_automation-view-01.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that automation view shows the correct view depending on if events
* or params exist.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(AUTOMATION_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
get3(gFront, "create-node"),
--- a/devtools/client/webaudioeditor/test/browser_wa_automation-view-02.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_automation-view-02.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that automation view selects the first parameter by default and
* switching between AudioParam rerenders the graph.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(AUTOMATION_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, AutomationView } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
get3(gFront, "create-node"),
--- a/devtools/client/webaudioeditor/test/browser_wa_controller-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_controller-01.js
@@ -4,17 +4,17 @@
/**
* Bug 1125817
* Tests to ensure that disconnecting a node immediately
* after creating it does not fail.
*/
const BUG_1125817_URL = EXAMPLE_URL + "doc_bug_1125817.html";
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1125817_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
let events = Promise.all([
once(gAudioNodes, "add", 2),
once(gAudioNodes, "disconnect"),
waitForGraphRendered(panelWin, 2, 0)
--- a/devtools/client/webaudioeditor/test/browser_wa_destroy-node-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_destroy-node-01.js
@@ -4,17 +4,17 @@
/**
* Tests that the destruction node event is fired and that the nodes are no
* longer stored internally in the tool, that the graph is updated properly, and
* that selecting a soon-to-be dead node clears the inspector.
*
* All done in one test since this test takes a few seconds to clear GC.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(DESTROY_NODES_URL);
let { panelWin } = panel;
let { gFront, $, $$, gAudioNodes } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
getNSpread(gAudioNodes, "add", 13),
--- a/devtools/client/webaudioeditor/test/browser_wa_first-run.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_first-run.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the reloading/onContentLoaded hooks work.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { gFront, $ } = panel.panelWin;
is($("#reload-notice").hidden, false,
"The 'reload this page' notice should initially be visible.");
is($("#waiting-notice").hidden, true,
"The 'waiting for an audio context' notice should initially be hidden.");
is($("#content").hidden, true,
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-click.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-click.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the clicking on a node in the GraphView opens and sets
* the correct node in the InspectorView
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(COMPLEX_CONTEXT_URL);
let panelWin = panel.panelWin;
let { gFront, $, $$, InspectorView } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
getN(gFront, "create-node", 8),
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-markers.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-markers.js
@@ -2,17 +2,17 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the SVG marker styling is updated when devtools theme changes.
*/
const { setTheme } = require("devtools/client/shared/theme");
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, MARKER_STYLING } = panelWin;
let currentTheme = Services.prefs.getCharPref("devtools.theme");
ok(MARKER_STYLING.light, "Marker styling exists for light theme.");
ok(MARKER_STYLING.dark, "Marker styling exists for dark theme.");
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-render-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-render-01.js
@@ -2,17 +2,17 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that SVG nodes and edges were created for the Graph View.
*/
var connectCount = 0;
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
let started = once(gFront, "start-context");
gAudioNodes.on("connect", onConnectNode);
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-render-02.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-render-02.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests more edge rendering for complex graphs.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(COMPLEX_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$ } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
getN(gFront, "create-node", 8),
@@ -18,17 +18,16 @@ add_task(async function () {
]);
reload(target);
let [actors] = await events;
let nodeIDs = actors.map(actor => actor.actorID);
let types = ["AudioDestinationNode", "OscillatorNode", "GainNode", "ScriptProcessorNode",
"OscillatorNode", "GainNode", "AudioBufferSourceNode", "BiquadFilterNode"];
-
types.forEach((type, i) => {
ok(findGraphNode(panelWin, nodeIDs[i]).classList.contains("type-" + type), "found " + type + " with class");
});
let edges = [
[1, 2, "osc1 -> gain1"],
[1, 3, "osc1 -> proc"],
[2, 0, "gain1 -> dest"],
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-render-03.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-render-03.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests to ensure that selected nodes stay selected on graph redraw.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;
let events = Promise.all([
getN(gFront, "create-node", 3),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-render-04.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-render-04.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests audio param connection rendering.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(CONNECT_MULTI_PARAM_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
getN(gFront, "create-node", 5),
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-render-05.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-render-05.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests to ensure that param connections trigger graph redraws
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;
let events = Promise.all([
getN(gFront, "create-node", 3),
waitForGraphRendered(panelWin, 3, 2, 0)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-render-06.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-render-06.js
@@ -2,17 +2,17 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests to ensure that param connections trigger graph redraws
*/
const BUG_1141261_URL = EXAMPLE_URL + "doc_bug_1141261.html";
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUG_1141261_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;
let events = Promise.all([
getN(gFront, "create-node", 3),
waitForGraphRendered(panelWin, 3, 1, 0)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-selected.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-selected.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that SVG nodes and edges were created for the Graph View.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS } = panelWin;
let started = once(gFront, "start-context");
let events = Promise.all([
get3(gFront, "create-node"),
--- a/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_graph-zoom.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the graph's scale and position is reset on a page reload.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, ContextView } = panelWin;
let started = once(gFront, "start-context");
await Promise.all([
waitForGraphRendered(panelWin, 3, 2),
--- a/devtools/client/webaudioeditor/test/browser_wa_inspector-bypass-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_inspector-bypass-01.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that nodes are correctly bypassed when bypassing.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
let events = Promise.all([
get3(gFront, "create-node"),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_inspector-toggle.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_inspector-toggle.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the inspector toggle button shows and hides
* the inspector panel as intended.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, InspectorView } = panelWin;
let gVars = InspectorView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
--- a/devtools/client/webaudioeditor/test/browser_wa_inspector-width.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_inspector-width.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that the WebAudioInspector's Width is saved as
* a preference
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, InspectorView } = panelWin;
let gVars = InspectorView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
--- a/devtools/client/webaudioeditor/test/browser_wa_inspector.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_inspector.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that inspector view opens on graph node click, and
* loads the correct node inside the inspector.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, InspectorView } = panelWin;
let gVars = InspectorView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
--- a/devtools/client/webaudioeditor/test/browser_wa_navigate.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_navigate.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests naviating from a page to another will repopulate
* the audio graph if both pages have an AudioContext.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $ } = panelWin;
let events = Promise.all([
get3(gFront, "create-node"),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view-edit-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view-edit-01.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that properties are updated when modifying the VariablesView.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
let gVars = PropertiesView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
@@ -51,15 +51,15 @@ add_task(async function () {
await setAndCheck(0, "gain", "0.005", 0.005, "sets number as number");
await setAndCheck(0, "gain", "0.1", 0.1, "sets float as float");
await setAndCheck(0, "gain", ".2", 0.2, "sets float without leading zero as float");
await teardown(target);
});
function setAndCheckVariable(panelWin, gVars) {
- return async function (varNum, prop, value, expected, desc) {
+ return async function(varNum, prop, value, expected, desc) {
await modifyVariableView(panelWin, gVars, varNum, prop, value);
var props = {};
props[prop] = expected;
checkVariableView(gVars, varNum, props, desc);
};
}
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view-edit-02.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view-edit-02.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that properties are not updated when modifying the VariablesView.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(COMPLEX_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
let gVars = PropertiesView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view-media-nodes.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view-media-nodes.js
@@ -10,32 +10,33 @@ var MEDIA_PERMISSION = "media.navigator.
function waitForDeviceClosed() {
info("Checking that getUserMedia streams are no longer in use.");
let temp = {};
ChromeUtils.import("resource:///modules/webrtcUI.jsm", temp);
let webrtcUI = temp.webrtcUI;
- if (!webrtcUI.showGlobalIndicator)
+ if (!webrtcUI.showGlobalIndicator) {
return Promise.resolve();
+ }
return new Promise((resolve, reject) => {
const message = "webrtc:UpdateGlobalIndicators";
Services.ppmm.addMessageListener(message, function listener(aMessage) {
info("Received " + message + " message");
if (!aMessage.data.showGlobalIndicator) {
Services.ppmm.removeMessageListener(message, listener);
resolve();
}
});
});
}
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(MEDIA_NODES_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
let gVars = PropertiesView._propsView;
// Auto enable getUserMedia
let mediaPermissionPref = Services.prefs.getBoolPref(MEDIA_PERMISSION);
Services.prefs.setBoolPref(MEDIA_PERMISSION, true);
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view-params-objects.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view-params-objects.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that params view correctly displays non-primitive properties
* like AudioBuffer and Float32Array in properties of AudioNodes.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(BUFFER_AND_ARRAY_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
let gVars = PropertiesView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view-params.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view-params.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that params view correctly displays all properties for nodes
* correctly, with default values and correct types.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_NODES_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
let gVars = PropertiesView._propsView;
let started = once(gFront, "start-context");
await loadFrameScriptUtils();
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that params view shows params when they exist, and are hidden otherwise.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, PropertiesView } = panelWin;
let gVars = PropertiesView._propsView;
let started = once(gFront, "start-context");
let events = Promise.all([
--- a/devtools/client/webaudioeditor/test/browser_wa_reset-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_reset-01.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that reloading a tab will properly listen for the `start-context`
* event and reshow the tools after reloading.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { gFront, $ } = panel.panelWin;
is($("#reload-notice").hidden, false,
"The 'reload this page' notice should initially be visible.");
is($("#waiting-notice").hidden, true,
"The 'waiting for an audio context' notice should initially be hidden.");
is($("#content").hidden, true,
--- a/devtools/client/webaudioeditor/test/browser_wa_reset-02.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_reset-02.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests reloading a tab with the tools open properly cleans up
* the graph.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $ } = panelWin;
let events = Promise.all([
get3(gFront, "create-node"),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_reset-03.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_reset-03.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests reloading a tab with the tools open properly cleans up
* the inspector and selected node.
*/
-add_task(async function () {
+add_task(async function() {
let { target, panel } = await initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, InspectorView } = panelWin;
let events = Promise.all([
get3(gFront, "create-node"),
waitForGraphRendered(panelWin, 3, 2)
]);
--- a/devtools/client/webaudioeditor/test/browser_wa_reset-04.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_reset-04.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that switching to an iframe works fine.
*/
-add_task(async function () {
+add_task(async function() {
Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true);
let { target, panel, toolbox } = await initWebAudioEditor(IFRAME_CONTEXT_URL);
let { gFront, $ } = panel.panelWin;
is($("#reload-notice").hidden, false,
"The 'reload this page' notice should initially be visible.");
is($("#waiting-notice").hidden, true,
--- a/devtools/client/webaudioeditor/test/browser_webaudio-actor-automation-event.js
+++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-automation-event.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that the WebAudioActor receives and emits the `automation-event` events
* with correct arguments from the content.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(AUTOMATION_URL);
let events = [];
let expected = [
["setValueAtTime", 0.2, 0],
["linearRampToValueAtTime", 1, 0.3],
["exponentialRampToValueAtTime", 0.75, 0.6],
["setValueCurveAtTime", [-1, 0, 1], 0.7, 0.3],
--- a/devtools/client/webaudioeditor/test/browser_webaudio-actor-connect-param.js
+++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-connect-param.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test the `connect-param` event on the web audio actor.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(CONNECT_PARAM_URL);
let [, , [destNode, carrierNode, modNode, gainNode], , connectParam] = await Promise.all([
front.setup({ reload: true }),
once(front, "start-context"),
getN(front, "create-node", 4),
get2(front, "connect-node"),
once(front, "connect-param")
]);
--- a/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
+++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test `destroy-node` event on WebAudioActor.
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(DESTROY_NODES_URL);
let [, , created] = await Promise.all([
front.setup({ reload: true }),
once(front, "start-context"),
// Should create dest, gain, and oscillator node and 10
// disposable buffer nodes
getN(front, "create-node", 13)
@@ -29,13 +29,14 @@ add_task(async function () {
"`destroy-node` called only on AudioNodes in current document.");
});
await removeTab(target.tab);
});
function actorIsInList(list, actor) {
for (let i = 0; i < list.length; i++) {
- if (list[i].actorID === actor.actorID)
+ if (list[i].actorID === actor.actorID) {
return list[i];
+ }
}
return null;
}
--- a/devtools/client/webaudioeditor/test/browser_webaudio-actor-simple.js
+++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-simple.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test basic communication of Web Audio actor
*/
-add_task(async function () {
+add_task(async function() {
let { target, front } = await initBackend(SIMPLE_CONTEXT_URL);
let [_, __, [destNode, oscNode, gainNode], [connect1, connect2]] = await Promise.all([
front.setup({ reload: true }),
once(front, "start-context"),
get3(front, "create-node"),
get2(front, "connect-node")
]);
--- a/devtools/client/webaudioeditor/test/doc_buffer-and-array.html
+++ b/devtools/client/webaudioeditor/test/doc_buffer-and-array.html
@@ -37,17 +37,17 @@
for (let i = 0; i < n; ++i) {
let x = (i - n2) / n2;
let y = Math.atan(5 * x) / (0.5 * Math.PI);
}
return curve;
}
- function getBuffer (url, callback) {
+ function getBuffer(url, callback) {
let xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer";
xhr.onload = callback;
xhr.send();
return xhr;
}
</script>
--- a/devtools/client/webaudioeditor/test/doc_bug_1112378.html
+++ b/devtools/client/webaudioeditor/test/doc_bug_1112378.html
@@ -11,47 +11,46 @@
<body>
<script type="text/javascript">
"use strict";
let ctx = new AudioContext();
let osc = ctx.createOscillator();
- function throwError () {
+ function throwError() {
try {
osc.connect({});
} catch (e) {
return {
lineNumber: e.lineNumber,
fileName: e.fileName,
columnNumber: e.columnNumber,
message: e.message,
instanceof: e instanceof TypeError,
stringified: e.toString(),
name: e.name
- }
+ };
}
}
- function throwDOMException () {
+ function throwDOMException() {
try {
osc.frequency.setValueAtTime(0, -1);
} catch (e) {
return {
lineNumber: e.lineNumber,
columnNumber: e.columnNumber,
filename: e.filename,
message: e.message,
code: e.code,
result: e.result,
instanceof: e instanceof DOMException,
stringified: e.toString(),
name: e.name
- }
+ };
}
}
-
</script>
</body>
</html>
--- a/devtools/client/webaudioeditor/test/doc_destroy-nodes.html
+++ b/devtools/client/webaudioeditor/test/doc_destroy-nodes.html
@@ -11,17 +11,17 @@
<body>
<script type="text/javascript">
"use strict";
// Keep the nodes we want to GC alive until we are ready for them to
// be collected. We will zero this reference by force from the devtools
// side.
var keepAlive = [];
- (function () {
+ (function() {
let ctx = new AudioContext();
let osc = ctx.createOscillator();
let gain = ctx.createGain();
for (let i = 0; i < 10; i++) {
keepAlive.push(ctx.createBufferSource());
}
--- a/devtools/client/webaudioeditor/test/head.js
+++ b/devtools/client/webaudioeditor/test/head.js
@@ -57,17 +57,17 @@ function navigate(aTarget, aUrl, aWaitFo
* This requires calling removeTab before the test ends.
*/
function initBackend(aUrl) {
info("Initializing a web audio editor front.");
DebuggerServer.init();
DebuggerServer.registerAllActors();
- return (async function () {
+ return (async function() {
let tab = await addTab(aUrl);
let target = TargetFactory.forTab(tab);
await target.makeRemote();
let front = new WebAudioFront(target.client, target.form);
return { target, front };
})();
@@ -76,17 +76,17 @@ function initBackend(aUrl) {
/**
* Adds a new tab, and open the toolbox for that tab, selecting the audio editor
* panel.
* This requires calling teardown before the test ends.
*/
function initWebAudioEditor(aUrl) {
info("Initializing a web audio editor pane.");
- return (async function () {
+ return (async function() {
let tab = await addTab(aUrl);
let target = TargetFactory.forTab(tab);
await target.makeRemote();
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", true);
let toolbox = await gDevTools.showToolbox(target, "webaudioeditor");
let panel = toolbox.getCurrentPanel();
@@ -128,23 +128,37 @@ function getN(front, eventName, count, s
if (actors.length === count) {
front.off(eventName, onEvent);
resolve(actors);
}
});
});
}
-function get(front, eventName) { return getN(front, eventName, 1); }
-function get2(front, eventName) { return getN(front, eventName, 2); }
-function get3(front, eventName) { return getN(front, eventName, 3); }
-function getSpread(front, eventName) { return getN(front, eventName, 1, true); }
-function get2Spread(front, eventName) { return getN(front, eventName, 2, true); }
-function get3Spread(front, eventName) { return getN(front, eventName, 3, true); }
-function getNSpread(front, eventName, count) { return getN(front, eventName, count, true); }
+function get(front, eventName) {
+ return getN(front, eventName, 1);
+}
+function get2(front, eventName) {
+ return getN(front, eventName, 2);
+}
+function get3(front, eventName) {
+ return getN(front, eventName, 3);
+}
+function getSpread(front, eventName) {
+ return getN(front, eventName, 1, true);
+}
+function get2Spread(front, eventName) {
+ return getN(front, eventName, 2, true);
+}
+function get3Spread(front, eventName) {
+ return getN(front, eventName, 3, true);
+}
+function getNSpread(front, eventName, count) {
+ return getN(front, eventName, count, true);
+}
/**
* Waits for the UI_GRAPH_RENDERED event to fire, but only
* resolves when the graph was rendered with the correct count of
* nodes and edges.
*/
function waitForGraphRendered(front, nodeCount, edgeCount, paramEdgeCount) {
let eventName = front.EVENTS.UI_GRAPH_RENDERED;
@@ -183,44 +197,42 @@ function checkVariableView(view, index,
"Correct property name for " + variable);
let value = aVar.target.querySelector(".value").getAttribute("value");
// Cast value with JSON.parse if possible;
// will fail when displaying Object types like "ArrayBuffer"
// and "Float32Array", but will match the original value.
try {
value = JSON.parse(value);
- }
- catch (e) {}
+ } catch (e) {}
if (typeof hash[variable] === "function") {
ok(hash[variable](value),
"Passing property value of " + value + " for " + variable + " " + description);
- }
- else {
+ } else {
is(value, hash[variable],
"Correct property value of " + hash[variable] + " for " + variable + " " + description);
}
});
}
function modifyVariableView(win, view, index, prop, value) {
let scope = view.getScopeAtIndex(index);
let aVar = scope.get(prop);
scope.expand();
return new Promise((resolve, reject) => {
const onParamSetSuccess = () => {
win.off(win.EVENTS.UI_SET_PARAM_ERROR, onParamSetError);
resolve();
- }
+ };
const onParamSetError = () => {
win.off(win.EVENTS.UI_SET_PARAM, onParamSetSuccess);
reject();
- }
+ };
win.once(win.EVENTS.UI_SET_PARAM, onParamSetSuccess);
win.once(win.EVENTS.UI_SET_PARAM_ERROR, onParamSetError);
// Focus and select the variable to begin editing
win.focus();
aVar.focus();
EventUtils.sendKey("RETURN", win);
@@ -320,17 +332,17 @@ function countGraphObjects(win) {
edges: win.document.querySelectorAll(".edgePaths > .edgePath").length
};
}
/**
* Forces cycle collection and GC, used in AudioNode destruction tests.
*/
function forceNodeCollection() {
- ContentTask.spawn(gBrowser.selectedBrowser, {}, async function () {
+ ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
// Kill the reference keeping stuff alive.
content.wrappedJSObject.keepAlive = null;
// Collect the now-deceased nodes.
Cu.forceGC();
Cu.forceCC();
Cu.forceGC();
Cu.forceCC();
@@ -379,17 +391,19 @@ function waitForInspectorRender(panelWin
/**
* Takes an AudioNode type and returns it's properties (from audionode.json)
* as keys and their default values as keys
*/
function nodeDefaultValues(nodeName) {
let fn = NODE_CONSTRUCTORS[nodeName];
- if (typeof fn === "undefined") return {};
+ if (typeof fn === "undefined") {
+ return {};
+ }
let init = nodeName === "AudioDestinationNode" ? "destination" : `create${fn}()`;
let definition = JSON.stringify(audioNodes[nodeName].properties);
let evalNode = evalInDebuggee(`
let ins = (new AudioContext()).${init};
let props = ${definition};
--- a/devtools/client/webaudioeditor/views/automation.js
+++ b/devtools/client/webaudioeditor/views/automation.js
@@ -7,43 +7,43 @@
* Functions handling the audio node inspector UI.
*/
var AutomationView = {
/**
* Initialization function called when the tool starts up.
*/
- initialize: function () {
+ initialize: function() {
this._buttons = $("#automation-param-toolbar-buttons");
this.graph = new LineGraphWidget($("#automation-graph"), { avg: false });
this.graph.selectionEnabled = false;
this._onButtonClick = this._onButtonClick.bind(this);
this._onNodeSet = this._onNodeSet.bind(this);
this._onResize = this._onResize.bind(this);
this._buttons.addEventListener("click", this._onButtonClick);
window.on(EVENTS.UI_INSPECTOR_RESIZE, this._onResize);
window.on(EVENTS.UI_INSPECTOR_NODE_SET, this._onNodeSet);
},
/**
* Destruction function called when the tool cleans up.
*/
- destroy: function () {
+ destroy: function() {
this._buttons.removeEventListener("click", this._onButtonClick);
window.off(EVENTS.UI_INSPECTOR_RESIZE, this._onResize);
window.off(EVENTS.UI_INSPECTOR_NODE_SET, this._onNodeSet);
},
/**
* Empties out the props view.
*/
- resetUI: function () {
+ resetUI: function() {
this._currentNode = null;
},
/**
* On a new node selection, create the Automation panel for
* that specific node.
*/
async build() {
@@ -78,17 +78,17 @@ var AutomationView = {
await this.graph.setDataWhenReady(values);
window.emit(EVENTS.UI_AUTOMATION_TAB_RENDERED, node.id);
},
/**
* Create the buttons for each AudioParam, that when clicked,
* render the graph for that AudioParam.
*/
- _createParamButtons: function (params) {
+ _createParamButtons: function(params) {
this._buttons.innerHTML = "";
params.forEach((param, i) => {
let button = document.createElement("toolbarbutton");
button.setAttribute("class", "devtools-toolbarbutton automation-param-button");
button.setAttribute("data-param", param.param);
// Set label to the parameter name, should not be L10N'd
button.setAttribute("label", param.param);
@@ -100,29 +100,29 @@ var AutomationView = {
this._buttons.appendChild(button);
});
},
/**
* Internally sets the current audio node and rebuilds appropriate
* views.
*/
- _setAudioNode: function (node) {
+ _setAudioNode: function(node) {
this._currentNode = node;
if (this._currentNode) {
this.build();
}
},
/**
* Toggles the subviews to display messages whether or not
* the audio node has no AudioParams, no automation events, or
* shows the graph.
*/
- _setState: function (state) {
+ _setState: function(state) {
let contentView = $("#automation-content");
let emptyView = $("#automation-empty");
let graphView = $("#automation-graph-container");
let noEventsView = $("#automation-no-events");
contentView.hidden = state === "no-params";
emptyView.hidden = state !== "no-params";
@@ -130,30 +130,30 @@ var AutomationView = {
graphView.hidden = state !== "show";
noEventsView.hidden = state !== "no-events";
},
/**
* Event handlers
*/
- _onButtonClick: function (e) {
+ _onButtonClick: function(e) {
Array.forEach($$(".automation-param-button"), $btn => $btn.removeAttribute("selected"));
let paramName = e.target.getAttribute("data-param");
e.target.setAttribute("selected", true);
this._selectedParamName = paramName;
this.render();
},
/**
* Called when the inspector is resized.
*/
- _onResize: function () {
+ _onResize: function() {
this.graph.refresh();
},
/**
* Called when the inspector view determines a node is selected.
*/
- _onNodeSet: function (id) {
+ _onNodeSet: function(id) {
this._setAudioNode(id != null ? gAudioNodes.get(id) : null);
}
};
--- a/devtools/client/webaudioeditor/views/context.js
+++ b/devtools/client/webaudioeditor/views/context.js
@@ -38,151 +38,151 @@ const GRAPH_REDRAW_EVENTS = ["add", "con
/**
* Functions handling the graph UI.
*/
var ContextView = {
/**
* Initialization function, called when the tool is started.
*/
- initialize: function () {
+ initialize: function() {
this._onGraphClick = this._onGraphClick.bind(this);
this._onThemeChange = this._onThemeChange.bind(this);
this._onStartContext = this._onStartContext.bind(this);
this._onEvent = this._onEvent.bind(this);
this.draw = debounce(this.draw.bind(this), GRAPH_DEBOUNCE_TIMER);
$("#graph-target").addEventListener("click", this._onGraphClick);
window.on(EVENTS.THEME_CHANGE, this._onThemeChange);
window.on(EVENTS.START_CONTEXT, this._onStartContext);
gAudioNodes.on("*", this._onEvent);
},
/**
* Destruction function, called when the tool is closed.
*/
- destroy: function () {
+ destroy: function() {
// If the graph was rendered at all, then the handler
// for zooming in will be set. We must remove it to prevent leaks.
if (this._zoomBinding) {
this._zoomBinding.on("zoom", null);
}
$("#graph-target").removeEventListener("click", this._onGraphClick);
window.off(EVENTS.THEME_CHANGE, this._onThemeChange);
window.off(EVENTS.START_CONTEXT, this._onStartContext);
gAudioNodes.off("*", this._onEvent);
},
/**
* Called when a page is reloaded and waiting for a "start-context" event
* and clears out old content
*/
- resetUI: function () {
+ resetUI: function() {
this.clearGraph();
this.resetGraphTransform();
},
/**
* Clears out the rendered graph, called when resetting the SVG elements to draw again,
* or when resetting the entire UI tool
*/
- clearGraph: function () {
+ clearGraph: function() {
$("#graph-target").innerHTML = "";
},
/**
* Moves the graph back to its original scale and translation.
*/
- resetGraphTransform: function () {
+ resetGraphTransform: function() {
// Only reset if the graph was ever drawn.
if (this._zoomBinding) {
let { translate, scale } = GRAPH_DEFAULTS;
// Must set the `zoomBinding` so the next `zoom` event is in sync with
// where the graph is visually (set by the `transform` attribute).
this._zoomBinding.scale(scale);
this._zoomBinding.translate(translate);
d3.select("#graph-target")
.attr("transform", "translate(" + translate + ") scale(" + scale + ")");
}
},
- getCurrentScale: function () {
+ getCurrentScale: function() {
return this._zoomBinding ? this._zoomBinding.scale() : null;
},
- getCurrentTranslation: function () {
+ getCurrentTranslation: function() {
return this._zoomBinding ? this._zoomBinding.translate() : null;
},
/**
* Makes the corresponding graph node appear "focused", removing
* focused styles from all other nodes. If no `actorID` specified,
* make all nodes appear unselected.
*/
- focusNode: function (actorID) {
+ focusNode: function(actorID) {
// Remove class "selected" from all nodes
Array.forEach($$(".nodes > g"), $node => $node.classList.remove("selected"));
// Add to "selected"
if (actorID) {
this._getNodeByID(actorID).classList.add("selected");
}
},
/**
* Takes an actorID and returns the corresponding DOM SVG element in the graph
*/
- _getNodeByID: function (actorID) {
+ _getNodeByID: function(actorID) {
return $(".nodes > g[data-id='" + actorID + "']");
},
/**
* Sets the appropriate class on an SVG node when its bypass
* status is toggled.
*/
- _bypassNode: function (node, enabled) {
+ _bypassNode: function(node, enabled) {
let el = this._getNodeByID(node.id);
el.classList[enabled ? "add" : "remove"]("bypassed");
},
/**
* This method renders the nodes currently available in `gAudioNodes` and is
* throttled to be called at most every `GRAPH_DEBOUNCE_TIMER` milliseconds.
* It's called whenever the audio context routing changes, after being debounced.
*/
- draw: function () {
+ draw: function() {
// Clear out previous SVG information
this.clearGraph();
let graph = new dagreD3.Digraph();
let renderer = new dagreD3.Renderer();
gAudioNodes.populateGraph(graph);
// Post-render manipulation of the nodes
let oldDrawNodes = renderer.drawNodes();
- renderer.drawNodes(function (graph, root) {
+ renderer.drawNodes(function(graph, root) {
let svgNodes = oldDrawNodes(graph, root);
- svgNodes.each(function (n) {
+ svgNodes.each(function(n) {
let node = graph.node(n);
let classString = "audionode type-" + node.type + (node.bypassed ? " bypassed" : "");
this.setAttribute("class", classString);
this.setAttribute("data-id", node.id);
this.setAttribute("data-type", node.type);
});
return svgNodes;
});
// Post-render manipulation of edges
let oldDrawEdgePaths = renderer.drawEdgePaths();
let defaultClasses = "edgePath enter";
- renderer.drawEdgePaths(function (graph, root) {
+ renderer.drawEdgePaths(function(graph, root) {
let svgEdges = oldDrawEdgePaths(graph, root);
- svgEdges.each(function (e) {
+ svgEdges.each(function(e) {
let edge = graph.edge(e);
// We have to manually specify the default classes on the edges
// as to not overwrite them
let edgeClass = defaultClasses + (edge.param ? (" param-connection " + edge.param) : "");
this.setAttribute("data-source", edge.source);
this.setAttribute("data-target", edge.target);
@@ -237,17 +237,17 @@ var ContextView = {
});
let layout = dagreD3.layout().rankDir("LR");
renderer.layout(layout).run(graph, d3.select("#graph-target"));
// Handle the sliding and zooming of the graph,
// store as `this._zoomBinding` so we can unbind during destruction
if (!this._zoomBinding) {
- this._zoomBinding = d3.behavior.zoom().on("zoom", function () {
+ this._zoomBinding = d3.behavior.zoom().on("zoom", function() {
var ev = d3.event;
d3.select("#graph-target")
.attr("transform", "translate(" + ev.translate + ") scale(" + ev.scale + ")");
});
d3.select("svg").call(this._zoomBinding);
// Set initial translation and scale -- this puts D3's awareness of
// the graph in sync with what the user sees originally.
@@ -258,57 +258,58 @@ var ContextView = {
/**
* Event handlers
*/
/**
* Called once "start-context" is fired, indicating that there is an audio
* context being created to view so render the graph.
*/
- _onStartContext: function () {
+ _onStartContext: function() {
this.draw();
},
/**
* Called when `gAudioNodes` fires an event -- most events (listed
* in GRAPH_REDRAW_EVENTS) qualify as a redraw event.
*/
- _onEvent: function (eventName, ...args) {
+ _onEvent: function(eventName, ...args) {
// If bypassing, just toggle the class on the SVG node
// rather than rerendering everything
if (eventName === "bypass") {
this._bypassNode.apply(this, args);
}
if (~GRAPH_REDRAW_EVENTS.indexOf(eventName)) {
this.draw();
}
},
/**
* Fired when the devtools theme changes.
*/
- _onThemeChange: function (theme) {
+ _onThemeChange: function(theme) {
let markerColor = MARKER_STYLING[theme];
let marker = $("#arrowhead");
if (marker) {
marker.setAttribute("style", "fill: " + markerColor);
}
},
/**
* Fired when a click occurs in the graph.
*
* @param Event e
* Click event.
*/
- _onGraphClick: function (e) {
+ _onGraphClick: function(e) {
let node = findGraphNodeParent(e.target);
// If node not found (clicking outside of an audio node in the graph),
// then ignore this event
- if (!node)
+ if (!node) {
return;
+ }
let id = node.getAttribute("data-id");
this.focusNode(id);
window.emit(EVENTS.UI_SELECT_NODE, id);
}
};
--- a/devtools/client/webaudioeditor/views/inspector.js
+++ b/devtools/client/webaudioeditor/views/inspector.js
@@ -23,17 +23,17 @@ var InspectorView = {
_expandString: EXPAND_INSPECTOR_STRING,
_toggleEvent: EVENTS.UI_INSPECTOR_TOGGLED,
_animated: true,
_delayed: true,
/**
* Initialization function called when the tool starts up.
*/
- initialize: function () {
+ initialize: function() {
// Set up view controller
this.el = $("#web-audio-inspector");
this.splitter = $("#inspector-splitter");
this.el.setAttribute("width", Services.prefs.getIntPref("devtools.webaudioeditor.inspectorWidth"));
this.button = $("#inspector-pane-toggle");
mixin(this, ToggleMixin);
this.bindToggle();
@@ -51,17 +51,17 @@ var InspectorView = {
}
window.on(EVENTS.UI_SELECT_NODE, this._onNodeSelect);
gAudioNodes.on("remove", this._onDestroyNode);
},
/**
* Destruction function called when the tool cleans up.
*/
- destroy: function () {
+ destroy: function() {
this.unbindToggle();
this.splitter.removeEventListener("mouseup", this._onResize);
$("#audio-node-toolbar toolbarbutton").removeEventListener("command", this._onCommandClick);
for (let $el of $$("#audio-node-toolbar toolbarbutton")) {
$el.removeEventListener("command", this._onCommandClick);
}
window.off(EVENTS.UI_SELECT_NODE, this._onNodeSelect);
@@ -93,32 +93,32 @@ var InspectorView = {
this._buildToolbar();
window.emit(EVENTS.UI_INSPECTOR_NODE_SET, this._currentNode.id);
}
},
/**
* Returns the current AudioNodeView.
*/
- getCurrentAudioNode: function () {
+ getCurrentAudioNode: function() {
return this._currentNode;
},
/**
* Empties out the props view.
*/
- resetUI: function () {
+ resetUI: function() {
// Set current node to empty to load empty view
this.setCurrentAudioNode();
// Reset AudioNode inspector and hide
this.hideImmediately();
},
- _buildToolbar: function () {
+ _buildToolbar: function() {
let node = this.getCurrentAudioNode();
let bypassable = node.bypassable;
let bypassed = node.isBypassed();
let button = $("#audio-node-toolbar .bypass");
if (!bypassable) {
button.setAttribute("disabled", true);
@@ -136,42 +136,42 @@ var InspectorView = {
/**
* Event handlers
*/
/**
* Called on EVENTS.UI_SELECT_NODE, and takes an actorID `id`
* and calls `setCurrentAudioNode` to scaffold the inspector view.
*/
- _onNodeSelect: function (id) {
+ _onNodeSelect: function(id) {
this.setCurrentAudioNode(gAudioNodes.get(id));
// Ensure inspector is visible when selecting a new node
this.show();
},
- _onResize: function () {
+ _onResize: function() {
if (this.el.getAttribute("width") < MIN_INSPECTOR_WIDTH) {
this.el.setAttribute("width", MIN_INSPECTOR_WIDTH);
}
Services.prefs.setIntPref("devtools.webaudioeditor.inspectorWidth", this.el.getAttribute("width"));
window.emit(EVENTS.UI_INSPECTOR_RESIZE);
},
/**
* Called when `DESTROY_NODE` is fired to remove the node from props view if
* it's currently selected.
*/
- _onDestroyNode: function (node) {
+ _onDestroyNode: function(node) {
if (this._currentNode && this._currentNode.id === node.id) {
this.setCurrentAudioNode(null);
}
},
- _onCommandClick: function (e) {
+ _onCommandClick: function(e) {
let node = this.getCurrentAudioNode();
let button = e.target;
let command = button.getAttribute("data-command");
let checked = button.getAttribute("checked");
if (button.getAttribute("disabled")) {
return;
}
--- a/devtools/client/webaudioeditor/views/properties.js
+++ b/devtools/client/webaudioeditor/views/properties.js
@@ -18,46 +18,46 @@ const GENERIC_VARIABLES_VIEW_SETTINGS =
* Functions handling the audio node inspector UI.
*/
var PropertiesView = {
/**
* Initialization function called when the tool starts up.
*/
- initialize: function () {
+ initialize: function() {
this._onEval = this._onEval.bind(this);
this._onNodeSet = this._onNodeSet.bind(this);
window.on(EVENTS.UI_INSPECTOR_NODE_SET, this._onNodeSet);
this._propsView = new VariablesView($("#properties-content"), GENERIC_VARIABLES_VIEW_SETTINGS);
this._propsView.eval = this._onEval;
},
/**
* Destruction function called when the tool cleans up.
*/
- destroy: function () {
+ destroy: function() {
window.off(EVENTS.UI_INSPECTOR_NODE_SET, this._onNodeSet);
this._propsView = null;
},
/**
* Empties out the props view.
*/
- resetUI: function () {
+ resetUI: function() {
this._propsView.empty();
this._currentNode = null;
},
/**
* Internally sets the current audio node and rebuilds appropriate
* views.
*/
- _setAudioNode: function (node) {
+ _setAudioNode: function(node) {
this._currentNode = node;
if (this._currentNode) {
this._buildPropertiesView();
}
},
/**
* Reconstructs the `Properties` tab in the inspector
@@ -90,41 +90,41 @@ var PropertiesView = {
window.emit(EVENTS.UI_PROPERTIES_TAB_RENDERED, node.id);
},
/**
* Toggles the display of the "empty" properties view when
* node has no properties to display.
*/
- _togglePropertiesView: function (show) {
+ _togglePropertiesView: function(show) {
let propsView = $("#properties-content");
let emptyView = $("#properties-empty");
(show ? propsView : emptyView).removeAttribute("hidden");
(show ? emptyView : propsView).setAttribute("hidden", "true");
},
/**
* Returns the scope for AudioParams in the
* VariablesView.
*
* @return Scope
*/
- _getAudioPropertiesScope: function () {
+ _getAudioPropertiesScope: function() {
return this._propsView.getScopeAtIndex(0);
},
/**
* Event handlers
*/
/**
* Called when the inspector view determines a node is selected.
*/
- _onNodeSet: function (id) {
+ _onNodeSet: function(id) {
this._setAudioNode(gAudioNodes.get(id));
},
/**
* Executed when an audio prop is changed in the UI.
*/
async _onEval(variable, value) {
let ownerScope = variable.ownerView;
@@ -139,18 +139,17 @@ var PropertiesView = {
try {
let number = parseFloat(value);
if (!isNaN(number)) {
value = number;
} else {
value = JSON.parse(value);
}
error = await node.actor.setParam(propName, value);
- }
- catch (e) {
+ } catch (e) {
error = e;
}
}
// TODO figure out how to handle and display set prop errors
// and enable `test/brorwser_wa_properties-view-edit.js`
// Bug 994258
if (!error) {
--- a/devtools/client/webaudioeditor/views/utils.js
+++ b/devtools/client/webaudioeditor/views/utils.js
@@ -6,24 +6,25 @@
/**
* Takes an element in an SVG graph and iterates over
* ancestors until it finds the graph node container. If not found,
* returns null.
*/
function findGraphNodeParent(el) {
// Some targets may not contain `classList` property
- if (!el.classList)
+ if (!el.classList) {
return null;
+ }
while (!el.classList.contains("nodes")) {
- if (el.classList.contains("audionode"))
+ if (el.classList.contains("audionode")) {
return el;
- else
- el = el.parentNode;
+ }
+ el = el.parentNode;
}
return null;
}
/**
* Object for use with `mix` into a view.
* Must have the following properties defined on the view:
* - `el`
@@ -34,70 +35,69 @@ function findGraphNodeParent(el) {
*
* Optional properties on the view can be defined to specify default
* visibility options.
* - `_animated`
* - `_delayed`
*/
var ToggleMixin = {
- bindToggle: function () {
+ bindToggle: function() {
this._onToggle = this._onToggle.bind(this);
this.button.addEventListener("mousedown", this._onToggle);
},
- unbindToggle: function () {
+ unbindToggle: function() {
this.button.removeEventListener("mousedown", this._onToggle);
},
- show: function () {
+ show: function() {
this._viewController({ visible: true });
},
- hide: function () {
+ hide: function() {
this._viewController({ visible: false });
},
- hideImmediately: function () {
+ hideImmediately: function() {
this._viewController({ visible: false, delayed: false, animated: false });
},
/**
* Returns a boolean indicating whether or not the view.
* is currently being shown.
*/
- isVisible: function () {
+ isVisible: function() {
return !this.el.classList.contains("pane-collapsed");
},
/**
* Toggles the visibility of the view.
*
* @param object visible
* - visible: boolean indicating whether the panel should be shown or not
* - animated: boolean indiciating whether the pane should be animated
* - delayed: boolean indicating whether the pane's opening should wait
* a few cycles or not
*/
- _viewController: function ({ visible, animated, delayed }) {
+ _viewController: function({ visible, animated, delayed }) {
let flags = {
visible: visible,
animated: animated != null ? animated : !!this._animated,
delayed: delayed != null ? delayed : !!this._delayed,
callback: () => window.emit(this._toggleEvent, visible)
};
ViewHelpers.togglePane(flags, this.el);
if (flags.visible) {
this.button.classList.remove("pane-collapsed");
this.button.setAttribute("tooltiptext", this._collapseString);
- }
- else {
+ } else {
this.button.classList.add("pane-collapsed");
this.button.setAttribute("tooltiptext", this._expandString);
}
},
- _onToggle: function () {
+ _onToggle: function() {
this._viewController({ visible: !this.isVisible() });
}
};
--- a/devtools/client/webide/content/addons.js
+++ b/devtools/client/webide/content/addons.js
@@ -3,41 +3,40 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const Services = require("Services");
const {gDevTools} = require("devtools/client/framework/devtools");
const {GetAvailableAddons, ForgetAddonsList} = require("devtools/client/webide/modules/addons");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
-window.addEventListener("load", function () {
- document.querySelector("#aboutaddons").onclick = function () {
+window.addEventListener("load", function() {
+ document.querySelector("#aboutaddons").onclick = function() {
let browserWin = Services.wm.getMostRecentWindow(gDevTools.chromeWindowType);
if (browserWin && browserWin.BrowserOpenAddonsMgr) {
browserWin.BrowserOpenAddonsMgr("addons://list/extension");
}
};
document.querySelector("#close").onclick = CloseUI;
BuildUI(GetAvailableAddons());
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
ForgetAddonsList();
}, {capture: true, once: true});
function CloseUI() {
window.parent.UI.openProject();
}
function BuildUI(addons) {
BuildItem(addons.adb, "adb");
}
function BuildItem(addon, type) {
-
function onAddonUpdate(arg) {
progress.removeAttribute("value");
li.setAttribute("status", addon.status);
status.textContent = Strings.GetStringFromName("addons_status_" + addon.status);
}
function onAddonFailure(arg) {
window.parent.UI.reportError("error_operationFail", arg);
@@ -50,17 +49,17 @@ function BuildItem(addon, type) {
progress.value = arg;
}
}
addon.on("update", onAddonUpdate);
addon.on("failure", onAddonFailure);
addon.on("progress", onAddonProgress);
- window.addEventListener("unload", function () {
+ window.addEventListener("unload", function() {
addon.off("update", onAddonUpdate);
addon.off("failure", onAddonFailure);
addon.off("progress", onAddonProgress);
}, {once: true});
let li = document.createElement("li");
li.setAttribute("status", addon.status);
--- a/devtools/client/webide/content/details.js
+++ b/devtools/client/webide/content/details.js
@@ -1,23 +1,23 @@
/* 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/. */
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const Services = require("Services");
const {AppManager} = require("devtools/client/webide/modules/app-manager");
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
document.addEventListener("visibilitychange", updateUI, true);
AppManager.on("app-manager-update", onAppManagerUpdate);
updateUI();
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
AppManager.off("app-manager-update", onAppManagerUpdate);
}, {capture: true, once: true});
function onAppManagerUpdate(what, details) {
if (what == "project" ||
what == "project-validated") {
updateUI();
}
@@ -35,17 +35,16 @@ function resetUI() {
document.querySelector("h1").textContent = "";
document.querySelector("#description").textContent = "";
document.querySelector("#type").textContent = "";
document.querySelector("#manifestURL").textContent = "";
document.querySelector("#location").textContent = "";
document.querySelector("#errorslist").innerHTML = "";
document.querySelector("#warningslist").innerHTML = "";
-
}
function updateUI() {
resetUI();
let project = AppManager.selectedProject;
if (!project) {
return;
--- a/devtools/client/webide/content/devicepreferences.js
+++ b/devtools/client/webide/content/devicepreferences.js
@@ -4,29 +4,29 @@
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const {AppManager} = require("devtools/client/webide/modules/app-manager");
const {Connection} = require("devtools/shared/client/connection-manager");
const ConfigView = require("devtools/client/webide/modules/config-view");
var configView = new ConfigView(window);
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
AppManager.on("app-manager-update", OnAppManagerUpdate);
document.getElementById("close").onclick = CloseUI;
document.getElementById("device-fields").onchange = UpdateField;
document.getElementById("device-fields").onclick = CheckReset;
document.getElementById("search-bar").onkeyup = document.getElementById("search-bar").onclick = SearchField;
document.getElementById("custom-value").onclick = UpdateNewField;
document.getElementById("custom-value-type").onchange = ClearNewFields;
document.getElementById("add-custom-field").onkeyup = CheckNewFieldSubmit;
BuildUI();
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
AppManager.off("app-manager-update", OnAppManagerUpdate);
}, {once: true});
function CloseUI() {
window.parent.UI.openProject();
}
function OnAppManagerUpdate(what) {
--- a/devtools/client/webide/content/newapp.js
+++ b/devtools/client/webide/content/newapp.js
@@ -14,17 +14,17 @@ const {getJSON} = require("devtools/clie
ChromeUtils.defineModuleGetter(this, "ZipUtils", "resource://gre/modules/ZipUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Downloads", "resource://gre/modules/Downloads.jsm");
const TEMPLATES_URL = "devtools.webide.templatesURL";
var gTemplateList = null;
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
let projectNameNode = document.querySelector("#project-name");
projectNameNode.addEventListener("input", canValidate, true);
getTemplatesJSON();
}, {capture: true, once: true});
function getTemplatesJSON() {
getJSON(TEMPLATES_URL).then(list => {
if (!Array.isArray(list)) {
@@ -149,17 +149,19 @@ function doOK() {
target.remove(false);
AppProjects.addPackaged(folder).then((project) => {
window.arguments[0].location = project.location;
AppManager.validateAndUpdateProject(project).then(() => {
if (project.manifest) {
project.manifest.name = projectName;
AppManager.writeManifest(project).then(() => {
AppManager.validateAndUpdateProject(project).then(
- () => {window.close();}, bail);
+ () => {
+ window.close();
+ }, bail);
}, bail);
} else {
bail("Manifest not found");
}
}, bail);
}, bail);
}, bail);
}, bail);
--- a/devtools/client/webide/content/prefs.js
+++ b/devtools/client/webide/content/prefs.js
@@ -1,36 +1,35 @@
/* 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";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
// Listen to preference changes
let inputs = document.querySelectorAll("[data-pref]");
for (let i of inputs) {
let pref = i.dataset.pref;
Services.prefs.addObserver(pref, FillForm);
i.addEventListener("change", SaveForm);
}
// Buttons
document.querySelector("#close").onclick = CloseUI;
document.querySelector("#restore").onclick = RestoreDefaults;
document.querySelector("#manageComponents").onclick = ShowAddons;
// Initialize the controls
FillForm();
-
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
let inputs = document.querySelectorAll("[data-pref]");
for (let i of inputs) {
let pref = i.dataset.pref;
i.removeEventListener("change", SaveForm);
Services.prefs.removeObserver(pref, FillForm);
}
}, {capture: true, once: true});
--- a/devtools/client/webide/content/project-listing.js
+++ b/devtools/client/webide/content/project-listing.js
@@ -4,26 +4,26 @@
/* eslint-env browser */
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const ProjectList = require("devtools/client/webide/modules/project-list");
var projectList = new ProjectList(window, window.parent);
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
document.getElementById("new-app").onclick = CreateNewApp;
document.getElementById("hosted-app").onclick = ImportHostedApp;
document.getElementById("packaged-app").onclick = ImportPackagedApp;
document.getElementById("refresh-tabs").onclick = RefreshTabs;
projectList.update();
projectList.updateCommands();
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
projectList.destroy();
}, {once: true});
function RefreshTabs() {
projectList.refreshTabs();
}
function CreateNewApp() {
--- a/devtools/client/webide/content/project-panel.js
+++ b/devtools/client/webide/content/project-panel.js
@@ -1,11 +1,11 @@
/* 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/. */
var ProjectPanel = {
// TODO: Expand function to save toggle state.
- toggleSidebar: function () {
+ toggleSidebar: function() {
document.querySelector("#project-listing-panel").setAttribute("sidebar-displayed", true);
document.querySelector("#project-listing-splitter").setAttribute("sidebar-displayed", true);
}
};
--- a/devtools/client/webide/content/runtime-listing.js
+++ b/devtools/client/webide/content/runtime-listing.js
@@ -2,30 +2,30 @@
* 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/. */
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const RuntimeList = require("devtools/client/webide/modules/runtime-list");
var runtimeList = new RuntimeList(window, window.parent);
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
document.getElementById("runtime-screenshot").onclick = TakeScreenshot;
document.getElementById("runtime-details").onclick = ShowRuntimeDetails;
document.getElementById("runtime-disconnect").onclick = DisconnectRuntime;
document.getElementById("runtime-preferences").onclick = ShowDevicePreferences;
document.getElementById("runtime-settings").onclick = ShowSettings;
document.getElementById("runtime-panel-noadbhelper").onclick = ShowAddons;
document.getElementById("runtime-panel-nousbdevice").onclick = ShowTroubleShooting;
document.getElementById("refresh-devices").onclick = RefreshScanners;
runtimeList.update();
runtimeList.updateCommands();
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
runtimeList.destroy();
}, {once: true});
function TakeScreenshot() {
runtimeList.takeScreenshot();
}
function ShowRuntimeDetails() {
--- a/devtools/client/webide/content/runtime-panel.js
+++ b/devtools/client/webide/content/runtime-panel.js
@@ -1,11 +1,11 @@
/* 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/. */
var RuntimePanel = {
// TODO: Expand function to save toggle state.
- toggleSidebar: function () {
+ toggleSidebar: function() {
document.querySelector("#runtime-listing-panel").setAttribute("sidebar-displayed", true);
document.querySelector("#runtime-listing-splitter").setAttribute("sidebar-displayed", true);
}
};
--- a/devtools/client/webide/content/runtimedetails.js
+++ b/devtools/client/webide/content/runtimedetails.js
@@ -6,29 +6,29 @@ const {require} = ChromeUtils.import("re
const Services = require("Services");
const {AppManager} = require("devtools/client/webide/modules/app-manager");
const {Connection} = require("devtools/shared/client/connection-manager");
const {RuntimeTypes} = require("devtools/client/webide/modules/runtimes");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
const UNRESTRICTED_HELP_URL = "https://developer.mozilla.org/docs/Tools/WebIDE/Running_and_debugging_apps#Unrestricted_app_debugging_%28including_certified_apps_main_process_etc.%29";
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
document.querySelector("#close").onclick = CloseUI;
document.querySelector("#devtools-check button").onclick = EnableCertApps;
document.querySelector("#adb-check button").onclick = RootADB;
- document.querySelector("#unrestricted-privileges").onclick = function () {
+ document.querySelector("#unrestricted-privileges").onclick = function() {
window.parent.UI.openInBrowser(UNRESTRICTED_HELP_URL);
};
AppManager.on("app-manager-update", OnAppManagerUpdate);
BuildUI();
CheckLockState();
}, {capture: true, once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
AppManager.off("app-manager-update", OnAppManagerUpdate);
}, {once: true});
function CloseUI() {
window.parent.UI.openProject();
}
function OnAppManagerUpdate(what) {
@@ -83,17 +83,16 @@ function CheckLockState() {
flipCertPerfAction.setAttribute("hidden", "true");
adbRootAction.setAttribute("hidden", "true");
adbCheckResult.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) {
device.isRoot().then(isRoot => {
if (isRoot) {
adbCheckResult.textContent = sYes;
flipCertPerfButton.removeAttribute("disabled");
@@ -120,19 +119,17 @@ function CheckLockState() {
devtoolsCheckResult.textContent = sYes;
}
}, console.error);
} catch (e) {
// Exception. pref actor is only accessible if forbird-certified-apps is false
devtoolsCheckResult.textContent = sNo;
flipCertPerfAction.removeAttribute("hidden");
}
-
}
-
}
function EnableCertApps() {
let device = AppManager.selectedRuntime.device;
// TODO: Remove `network.disable.ipc.security` once bug 1125916 is fixed.
device.shell(
"stop b2g && " +
"cd /data/b2g/mozilla/*.default/ && " +
--- a/devtools/client/webide/content/webide.js
+++ b/devtools/client/webide/content/webide.js
@@ -36,26 +36,26 @@ const MIN_ZOOM = 0.6;
writable: false
});
});
// Download remote resources early
getJSON("devtools.webide.templatesURL");
getJSON("devtools.devices.url");
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
UI.init();
}, {once: true});
-window.addEventListener("unload", function () {
+window.addEventListener("unload", function() {
UI.destroy();
}, {once: true});
var UI = {
- init: function () {
+ init: function() {
this._telemetry = new Telemetry();
this._telemetry.toolOpened("webide");
AppManager.init();
this.appManagerUpdate = this.appManagerUpdate.bind(this);
AppManager.on("app-manager-update", this.appManagerUpdate);
@@ -90,26 +90,26 @@ var UI = {
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.contentViewer;
this.contentViewer.fullZoom = Services.prefs.getCharPref("devtools.webide.zoom");
gDevToolsBrowser.isWebIDEInitialized.resolve();
},
- destroy: function () {
+ destroy: function() {
window.removeEventListener("focus", this.onfocus, true);
AppManager.off("app-manager-update", this.appManagerUpdate);
AppManager.destroy();
this.updateConnectionTelemetry();
this._telemetry.toolClosed("webide");
this._telemetry.destroy();
},
- onfocus: function () {
+ onfocus: function() {
// Because we can't track the activity in the folder project,
// we need to validate the project regularly. Let's assume that
// if a modification happened, it happened when the window was
// not focused.
if (AppManager.selectedProject &&
AppManager.selectedProject.type != "mainProcess" &&
AppManager.selectedProject.type != "runtimeApp" &&
AppManager.selectedProject.type != "tab") {
@@ -117,30 +117,30 @@ var UI = {
}
// Hook to display promotional Developer Edition doorhanger. Only displayed once.
// Hooked into the `onfocus` event because sometimes does not work
// when run at the end of `init`. ¯\(°_o)/¯
showDoorhanger({ window, type: "deveditionpromo", anchor: document.querySelector("#deck") });
},
- appManagerUpdate: function (what, details) {
+ appManagerUpdate: function(what, details) {
// Got a message from app-manager.js
// See AppManager.update() for descriptions of what these events mean.
switch (what) {
case "runtime-list":
this.autoConnectRuntime();
break;
case "connection":
this.updateRuntimeButton();
this.updateCommands();
this.updateConnectionTelemetry();
break;
case "project":
- this._updatePromise = (async function () {
+ this._updatePromise = (async function() {
UI.updateTitle();
await UI.destroyToolbox();
UI.updateCommands();
UI.openProject();
await UI.autoStartProject();
UI.autoOpenToolbox();
UI.saveLastSelectedProject();
UI.updateRemoveProjectButton();
@@ -173,83 +173,83 @@ var UI = {
break;
case "runtime-targets":
this.autoSelectProject();
break;
}
this._updatePromise = promise.resolve();
},
- openInBrowser: function (url) {
+ openInBrowser: function(url) {
// Open a URL in a Firefox window
let mainWindow = Services.wm.getMostRecentWindow(gDevTools.chromeWindowType);
if (mainWindow) {
mainWindow.openWebLinkIn(url, "tab");
- mainWindow.focus()
+ mainWindow.focus();
} else {
window.open(url);
}
},
- updateTitle: function () {
+ updateTitle: function() {
let project = AppManager.selectedProject;
if (project) {
window.document.title = Strings.formatStringFromName("title_app", [project.name], 1);
} else {
window.document.title = Strings.GetStringFromName("title_noApp");
}
},
/** ******** BUSY UI **********/
_busyTimeout: null,
_busyOperationDescription: null,
_busyPromise: null,
- busy: function () {
+ busy: function() {
let win = document.querySelector("window");
win.classList.add("busy");
win.classList.add("busy-undetermined");
this.updateCommands();
this.update("busy");
},
- unbusy: function () {
+ unbusy: function() {
let win = document.querySelector("window");
win.classList.remove("busy");
win.classList.remove("busy-determined");
win.classList.remove("busy-undetermined");
this.updateCommands();
this.update("unbusy");
this._busyPromise = null;
},
- setupBusyTimeout: function () {
+ setupBusyTimeout: function() {
this.cancelBusyTimeout();
this._busyTimeout = setTimeout(() => {
this.unbusy();
UI.reportError("error_operationTimeout", this._busyOperationDescription);
}, Services.prefs.getIntPref("devtools.webide.busyTimeout"));
},
- cancelBusyTimeout: function () {
+ cancelBusyTimeout: function() {
clearTimeout(this._busyTimeout);
},
- busyWithProgressUntil: function (promise, operationDescription) {
+ busyWithProgressUntil: function(promise, operationDescription) {
let busy = this.busyUntil(promise, operationDescription);
let win = document.querySelector("window");
let progress = document.querySelector("#action-busy-determined");
progress.mode = "undetermined";
win.classList.add("busy-determined");
win.classList.remove("busy-undetermined");
return busy;
},
- busyUntil: function (promise, operationDescription) {
+ busyUntil: function(promise, operationDescription) {
// Freeze the UI until the promise is resolved. A timeout will unfreeze the
// UI, just in case the promise never gets resolved.
this._busyPromise = promise;
this._busyOperationDescription = operationDescription;
this.setupBusyTimeout();
this.busy();
promise.then(() => {
this.cancelBusyTimeout();
@@ -271,62 +271,62 @@ var UI = {
console.error(e);
}
}
this.unbusy();
});
return promise;
},
- reportError: function (l10nProperty, ...l10nArgs) {
+ reportError: function(l10nProperty, ...l10nArgs) {
let text;
if (l10nArgs.length > 0) {
text = Strings.formatStringFromName(l10nProperty, l10nArgs, l10nArgs.length);
} else {
text = Strings.GetStringFromName(l10nProperty);
}
console.error(text);
let buttons = [{
label: Strings.GetStringFromName("notification_showTroubleShooting_label"),
accessKey: Strings.GetStringFromName("notification_showTroubleShooting_accesskey"),
- callback: function () {
+ callback: function() {
Cmds.showTroubleShooting();
}
}];
let nbox = document.querySelector("#notificationbox");
nbox.removeAllNotifications(true);
nbox.appendNotification(text, "webide:errornotification", null,
nbox.PRIORITY_WARNING_LOW, buttons);
},
- dismissErrorNotification: function () {
+ dismissErrorNotification: function() {
let nbox = document.querySelector("#notificationbox");
nbox.removeAllNotifications(true);
},
/** ******** COMMANDS **********/
/**
* This module emits various events when state changes occur.
*
* The events this module may emit include:
* busy:
* The window is currently busy and certain UI functions may be disabled.
* unbusy:
* The window is not busy and certain UI functions may be re-enabled.
*/
- update: function (what, details) {
+ update: function(what, details) {
this.emit("webide-update", what, details);
},
- updateCommands: function () {
+ updateCommands: function() {
// Action commands
let playCmd = document.querySelector("#cmd_play");
let stopCmd = document.querySelector("#cmd_stop");
let debugCmd = document.querySelector("#cmd_toggleToolbox");
let playButton = document.querySelector("#action-button-play");
let projectPanelCmd = document.querySelector("#cmd_showProjectPanel");
if (document.querySelector("window").classList.contains("busy")) {
@@ -357,23 +357,21 @@ var UI = {
if (AppManager.selectedProject.type == "runtimeApp") {
playCmd.removeAttribute("disabled");
} else if (AppManager.selectedProject.type == "tab") {
playCmd.removeAttribute("disabled");
stopCmd.setAttribute("disabled", "true");
} else if (AppManager.selectedProject.type == "mainProcess") {
playCmd.setAttribute("disabled", "true");
stopCmd.setAttribute("disabled", "true");
- } else {
- if (AppManager.selectedProject.errorsCount == 0 &&
+ } else if (AppManager.selectedProject.errorsCount == 0 &&
AppManager.runtimeCanHandleApps()) {
- playCmd.removeAttribute("disabled");
- } else {
- playCmd.setAttribute("disabled", "true");
- }
+ playCmd.removeAttribute("disabled");
+ } else {
+ playCmd.setAttribute("disabled", "true");
}
}
// Runtime commands
let screenshotCmd = document.querySelector("#cmd_takeScreenshot");
let detailsCmd = document.querySelector("#cmd_showRuntimeDetails");
let disconnectCmd = document.querySelector("#cmd_disconnectRuntime");
let devicePrefsCmd = document.querySelector("#cmd_showDevicePrefs");
@@ -404,17 +402,17 @@ var UI = {
} else {
runtimePanelButton.removeAttribute("active");
runtimePanelButton.setAttribute("hidden", "true");
}
projectPanelCmd.removeAttribute("disabled");
},
- updateRemoveProjectButton: function () {
+ updateRemoveProjectButton: function() {
// Remove command
let removeCmdNode = document.querySelector("#cmd_removeProject");
if (AppManager.selectedProject) {
removeCmdNode.removeAttribute("disabled");
} else {
removeCmdNode.setAttribute("disabled", "true");
}
},
@@ -424,17 +422,17 @@ var UI = {
get lastConnectedRuntime() {
return Services.prefs.getCharPref("devtools.webide.lastConnectedRuntime");
},
set lastConnectedRuntime(runtime) {
Services.prefs.setCharPref("devtools.webide.lastConnectedRuntime", runtime);
},
- autoConnectRuntime: function () {
+ autoConnectRuntime: function() {
// Automatically reconnect to the previously selected runtime,
// if available and has an ID and feature is enabled
if (AppManager.selectedRuntime ||
!Services.prefs.getBoolPref("devtools.webide.autoConnectRuntime") ||
!this.lastConnectedRuntime) {
return;
}
let [_, type, id] = this.lastConnectedRuntime.match(/^(\w+):(.+)$/);
@@ -456,17 +454,17 @@ var UI = {
// Only want one auto-connect attempt, so clear last runtime value
this.lastConnectedRuntime = "";
this.connectToRuntime(runtime);
}
}
}
},
- connectToRuntime: function (runtime) {
+ connectToRuntime: function(runtime) {
let name = runtime.name;
let promise = AppManager.connectToRuntime(runtime);
promise.then(() => this.initConnectionTelemetry())
.catch(() => {
// Empty rejection handler to silence uncaught rejection warnings
// |busyUntil| will listen for rejections.
// Bug 1121100 may find a better way to silence these.
});
@@ -474,27 +472,27 @@ var UI = {
// Stop busy timeout for runtimes that take unknown or long amounts of time
// to connect.
if (runtime.prolongedConnection) {
this.cancelBusyTimeout();
}
return promise;
},
- updateRuntimeButton: function () {
+ updateRuntimeButton: function() {
let labelNode = document.querySelector("#runtime-panel-button > .panel-button-label");
if (!AppManager.selectedRuntime) {
labelNode.setAttribute("value", Strings.GetStringFromName("runtimeButton_label"));
} else {
let name = AppManager.selectedRuntime.name;
labelNode.setAttribute("value", name);
}
},
- saveLastConnectedRuntime: function () {
+ saveLastConnectedRuntime: function() {
if (AppManager.selectedRuntime &&
AppManager.selectedRuntime.id !== undefined) {
this.lastConnectedRuntime = AppManager.selectedRuntime.type + ":" +
AppManager.selectedRuntime.id;
} else {
this.lastConnectedRuntime = "";
}
},
@@ -503,53 +501,53 @@ var UI = {
_actionsToLog: new Set(),
/**
* For each new connection, track whether play and debug were ever used. Only
* one value is collected for each button, even if they are used multiple
* times during a connection.
*/
- initConnectionTelemetry: function () {
+ initConnectionTelemetry: function() {
this._actionsToLog.add("play");
this._actionsToLog.add("debug");
},
/**
* Action occurred. Log that it happened, and remove it from the loggable
* set.
*/
- onAction: function (action) {
+ onAction: function(action) {
if (!this._actionsToLog.has(action)) {
return;
}
this.logActionState(action, true);
this._actionsToLog.delete(action);
},
/**
* Connection status changed or we are shutting down. Record any loggable
* actions as having not occurred.
*/
- updateConnectionTelemetry: function () {
+ updateConnectionTelemetry: function() {
for (let action of this._actionsToLog.values()) {
this.logActionState(action, false);
}
this._actionsToLog.clear();
},
- logActionState: function (action, state) {
+ logActionState: function(action, state) {
let histogramId = "DEVTOOLS_WEBIDE_CONNECTION_" +
action.toUpperCase() + "_USED";
this._telemetry.log(histogramId, state);
},
/** ******** PROJECTS **********/
- openProject: function () {
+ openProject: function() {
let project = AppManager.selectedProject;
if (!project) {
this.resetDeck();
return;
}
this.selectDeckPanel("details");
@@ -606,17 +604,17 @@ var UI = {
// Select project
AppManager.selectedProject = project;
this._telemetry.actionOccurred("webideImportProject");
},
// Remember the last selected project on the runtime
- saveLastSelectedProject: function () {
+ saveLastSelectedProject: function() {
let shouldRestore = Services.prefs.getBoolPref("devtools.webide.restoreLastProject");
if (!shouldRestore) {
return;
}
// Ignore unselection of project on runtime disconnection
if (!AppManager.connected) {
return;
@@ -639,17 +637,17 @@ var UI = {
if (type) {
Services.prefs.setCharPref("devtools.webide.lastSelectedProject",
type + ":" + project);
} else {
Services.prefs.clearUserPref("devtools.webide.lastSelectedProject");
}
},
- autoSelectProject: function () {
+ autoSelectProject: function() {
if (AppManager.selectedProject) {
return;
}
let shouldRestore = Services.prefs.getBoolPref("devtools.webide.restoreLastProject");
if (!shouldRestore) {
return;
}
let pref = Services.prefs.getCharPref("devtools.webide.lastSelectedProject");
@@ -690,44 +688,44 @@ var UI = {
name: app.manifest.name
};
}
}
},
/** ******** DECK **********/
- setupDeck: function () {
+ setupDeck: function() {
let iframes = document.querySelectorAll("#deck > iframe");
for (let iframe of iframes) {
iframe.tooltip = "aHTMLTooltip";
}
},
- resetFocus: function () {
+ resetFocus: function() {
document.commandDispatcher.focusedElement = document.documentElement;
},
- selectDeckPanel: function (id) {
+ selectDeckPanel: function(id) {
let deck = document.querySelector("#deck");
if (deck.selectedPanel && deck.selectedPanel.id === "deck-panel-" + id) {
// This panel is already displayed.
return;
}
this.resetFocus();
let panel = deck.querySelector("#deck-panel-" + id);
let lazysrc = panel.getAttribute("lazysrc");
if (lazysrc) {
panel.removeAttribute("lazysrc");
panel.setAttribute("src", lazysrc);
}
deck.selectedPanel = panel;
},
- resetDeck: function () {
+ resetDeck: function() {
this.resetFocus();
let deck = document.querySelector("#deck");
deck.selectedPanel = null;
},
async checkRuntimeVersion() {
if (AppManager.connected) {
let { client } = AppManager.connection;
@@ -751,17 +749,17 @@ var UI = {
* * Toggle toolbox wrench in WebIDE
* * Disconnect the current runtime gracefully
* * Yank cord out of device
* * Close or crash the app/tab
* We can't know for sure which one was used here, so reset the
* |toolboxPromise| since someone must be destroying it to reach here,
* and call our own close method.
*/
- _onToolboxClosed: function (promise, iframe) {
+ _onToolboxClosed: function(promise, iframe) {
// Only save toolbox size, disable wrench button, workaround focus issue...
// if we are closing the last toolbox:
// - toolboxPromise is nullified by destroyToolbox and is still null here
// if no other toolbox has been opened in between,
// - having two distinct promise means we are receiving closed event
// for a previous, non-current, toolbox.
if (!this.toolboxPromise || this.toolboxPromise === promise) {
this.toolboxPromise = null;
@@ -772,27 +770,27 @@ var UI = {
splitter.setAttribute("hidden", "true");
document.querySelector("#action-button-debug").removeAttribute("active");
}
// We have to destroy the iframe, otherwise, the keybindings of webide don't work
// properly anymore.
iframe.remove();
},
- destroyToolbox: function () {
+ destroyToolbox: function() {
// Only have a live toolbox if |this.toolboxPromise| exists
if (this.toolboxPromise) {
let toolboxPromise = this.toolboxPromise;
this.toolboxPromise = null;
return toolboxPromise.then(toolbox => toolbox.destroy());
}
return promise.resolve();
},
- createToolbox: function () {
+ createToolbox: function() {
// If |this.toolboxPromise| exists, there is already a live toolbox
if (this.toolboxPromise) {
return this.toolboxPromise;
}
let iframe = document.createElement("iframe");
iframe.id = "toolbox";
@@ -810,70 +808,70 @@ var UI = {
// toolbox.destroy's promise resolves.
toolbox.once("destroyed", this._onToolboxClosed.bind(this, promise, iframe));
return toolbox;
}, console.error);
return this.busyUntil(this.toolboxPromise, "opening toolbox");
},
- _showToolbox: function (target, iframe) {
+ _showToolbox: function(target, iframe) {
let splitter = document.querySelector(".devtools-horizontal-splitter");
splitter.removeAttribute("hidden");
document.querySelector("notificationbox").insertBefore(iframe, splitter.nextSibling);
let host = Toolbox.HostType.CUSTOM;
let options = { customIframe: iframe, zoom: false, uid: iframe.uid };
document.querySelector("#action-button-debug").setAttribute("active", "true");
return gDevTools.showToolbox(target, null, host, options);
},
};
EventEmitter.decorate(UI);
var Cmds = {
- quit: function () {
+ quit: function() {
window.close();
},
- showProjectPanel: function () {
+ showProjectPanel: function() {
ProjectPanel.toggleSidebar();
return promise.resolve();
},
- showRuntimePanel: function () {
+ showRuntimePanel: function() {
RuntimeScanners.scan();
RuntimePanel.toggleSidebar();
},
- disconnectRuntime: function () {
- let disconnecting = (async function () {
+ disconnectRuntime: function() {
+ let disconnecting = (async function() {
await UI.destroyToolbox();
await AppManager.disconnectRuntime();
})();
return UI.busyUntil(disconnecting, "disconnecting from runtime");
},
- takeScreenshot: function () {
+ takeScreenshot: function() {
let url = AppManager.deviceFront.screenshotToDataURL();
return UI.busyUntil(url.then(longstr => {
return longstr.string().then(dataURL => {
longstr.release().catch(console.error);
UI.openInBrowser(dataURL);
});
}), "taking screenshot");
},
- showRuntimeDetails: function () {
+ showRuntimeDetails: function() {
UI.selectDeckPanel("runtimedetails");
},
- showDevicePrefs: function () {
+ showDevicePrefs: function() {
UI.selectDeckPanel("devicepreferences");
},
async play() {
let busy;
switch (AppManager.selectedProject.type) {
case "packaged":
busy = UI.busyWithProgressUntil(AppManager.installAndRunProject(),
@@ -892,57 +890,56 @@ var Cmds = {
}
if (!busy) {
return promise.reject();
}
UI.onAction("play");
return busy;
},
- stop: function () {
+ stop: function() {
return UI.busyUntil(AppManager.stopRunningApp(), "stopping app");
},
- toggleToolbox: function () {
+ toggleToolbox: function() {
UI.onAction("debug");
if (UI.toolboxPromise) {
UI.destroyToolbox();
return promise.resolve();
- } else {
- return UI.createToolbox();
}
+ return UI.createToolbox();
},
- removeProject: function () {
+ removeProject: function() {
AppManager.removeSelectedProject();
},
- showTroubleShooting: function () {
+ showTroubleShooting: function() {
UI.openInBrowser(HELP_URL);
},
- showAddons: function () {
+ showAddons: function() {
UI.selectDeckPanel("addons");
},
- showPrefs: function () {
+ showPrefs: function() {
UI.selectDeckPanel("prefs");
},
- zoomIn: function () {
+ zoomIn: function() {
if (UI.contentViewer.fullZoom < MAX_ZOOM) {
UI.contentViewer.fullZoom += 0.1;
Services.prefs.setCharPref("devtools.webide.zoom", UI.contentViewer.fullZoom);
}
},
- zoomOut: function () {
+ zoomOut: function() {
if (UI.contentViewer.fullZoom > MIN_ZOOM) {
UI.contentViewer.fullZoom -= 0.1;
Services.prefs.setCharPref("devtools.webide.zoom", UI.contentViewer.fullZoom);
}
},
- resetZoom: function () {
+ resetZoom: function() {
UI.contentViewer.fullZoom = 1;
Services.prefs.setCharPref("devtools.webide.zoom", 1);
}
};
--- a/devtools/client/webide/content/wifi-auth.js
+++ b/devtools/client/webide/content/wifi-auth.js
@@ -4,17 +4,17 @@
"use strict";
const { require } =
ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const Services = require("Services");
const QR = require("devtools/shared/qrcode/index");
-window.addEventListener("load", function () {
+window.addEventListener("load", function() {
document.getElementById("close").onclick = () => window.close();
document.getElementById("no-scanner").onclick = showToken;
document.getElementById("yes-scanner").onclick = hideToken;
buildUI();
}, {once: true});
function buildUI() {
let { oob } = window.arguments[0];
--- a/devtools/client/webide/modules/addons.js
+++ b/devtools/client/webide/modules/addons.js
@@ -32,53 +32,53 @@ addonsListener.onDisabled =
addonsListener.onInstalled =
addonsListener.onUninstalled = (updatedAddon) => {
let addons = GetAvailableAddons();
addons.adb.updateInstallStatus();
};
AddonManager.addAddonListener(addonsListener);
var AvailableAddons = null;
-var GetAvailableAddons = exports.GetAvailableAddons = function () {
+var GetAvailableAddons = exports.GetAvailableAddons = function() {
if (!AvailableAddons) {
AvailableAddons = {
adb: new ADBAddon()
};
}
return AvailableAddons;
};
-exports.ForgetAddonsList = function () {
+exports.ForgetAddonsList = function() {
AvailableAddons = null;
};
function Addon() {}
Addon.prototype = {
_status: "unknown",
set status(value) {
if (this._status != value) {
this._status = value;
this.emit("update");
}
},
get status() {
return this._status;
},
- updateInstallStatus: function () {
+ updateInstallStatus: function() {
AddonManager.getAddonByID(this.addonID, (addon) => {
if (addon && !addon.userDisabled) {
this.status = "installed";
} else {
this.status = "uninstalled";
}
});
},
- install: function () {
+ install: function() {
AddonManager.getAddonByID(this.addonID, (addon) => {
if (addon && !addon.userDisabled) {
this.status = "installed";
return;
}
this.status = "preparing";
if (addon && addon.userDisabled) {
addon.userDisabled = false;
@@ -86,57 +86,57 @@ Addon.prototype = {
AddonManager.getInstallForURL(this.xpiLink, (install) => {
install.addListener(this);
install.install();
}, "application/x-xpinstall");
}
});
},
- uninstall: function () {
+ uninstall: function() {
AddonManager.getAddonByID(this.addonID, (addon) => {
addon.uninstall();
});
},
- installFailureHandler: function (install, message) {
+ installFailureHandler: function(install, message) {
this.status = "uninstalled";
this.emit("failure", message);
},
- onDownloadStarted: function () {
+ onDownloadStarted: function() {
this.status = "downloading";
},
- onInstallStarted: function () {
+ onInstallStarted: function() {
this.status = "installing";
},
- onDownloadProgress: function (install) {
+ onDownloadProgress: function(install) {
if (install.maxProgress == -1) {
this.emit("progress", -1);
} else {
this.emit("progress", install.progress / install.maxProgress);
}
},
- onInstallEnded: function ({addon}) {
+ onInstallEnded: function({addon}) {
addon.userDisabled = false;
},
- onDownloadCancelled: function (install) {
+ onDownloadCancelled: function(install) {
this.installFailureHandler(install, "Download cancelled");
},
- onDownloadFailed: function (install) {
+ onDownloadFailed: function(install) {
this.installFailureHandler(install, "Download failed");
},
- onInstallCancelled: function (install) {
+ onInstallCancelled: function(install) {
this.installFailureHandler(install, "Install cancelled");
},
- onInstallFailed: function (install) {
+ onInstallFailed: function(install) {
this.installFailureHandler(install, "Install failed");
},
};
function ADBAddon() {
EventEmitter.decorate(this);
// This addon uses the string "linux" for "linux32"
let fixedOS = OS == "linux32" ? "linux" : OS;
--- a/devtools/client/webide/modules/app-manager.js
+++ b/devtools/client/webide/modules/app-manager.js
@@ -23,17 +23,17 @@ const Strings = Services.strings.createB
var AppManager = exports.AppManager = {
DEFAULT_PROJECT_ICON: "chrome://webide/skin/default-app-icon.png",
DEFAULT_PROJECT_NAME: "--",
_initialized: false,
- init: function () {
+ init: function() {
if (this._initialized) {
return;
}
this._initialized = true;
let port = Services.prefs.getIntPref("devtools.debugger.remote-port");
this.connection = ConnectionManager.createConnection("localhost", port);
this.onConnectionChanged = this.onConnectionChanged.bind(this);
@@ -51,17 +51,17 @@ var AppManager = exports.AppManager = {
this._rebuildRuntimeList = this._rebuildRuntimeList.bind(this);
RuntimeScanners.on("runtime-list-updated", this._rebuildRuntimeList);
RuntimeScanners.enable();
this._rebuildRuntimeList();
this._telemetry = new Telemetry();
},
- destroy: function () {
+ destroy: function() {
if (!this._initialized) {
return;
}
this._initialized = false;
this.selectedProject = null;
this.selectedRuntime = null;
RuntimeScanners.off("runtime-list-updated", this._rebuildRuntimeList);
@@ -117,37 +117,37 @@ var AppManager = exports.AppManager = {
* Detailed runtime telemetry has been recorded. Used by tests.
* runtime-targets:
* The list of remote runtime targets available from the currently
* connected runtime (such as tabs or apps) has changed, or any of the
* user-visible details (like names) for the non-selected runtime targets
* has changed. This event includes |type| in the details, to distinguish
* "apps" and "tabs".
*/
- update: function (what, details) {
+ update: function(what, details) {
// Anything we want to forward to the UI
this.emit("app-manager-update", what, details);
},
- reportError: function (l10nProperty, ...l10nArgs) {
+ reportError: function(l10nProperty, ...l10nArgs) {
let win = Services.wm.getMostRecentWindow("devtools:webide");
if (win) {
win.UI.reportError(l10nProperty, ...l10nArgs);
} else {
let text;
if (l10nArgs.length > 0) {
text = Strings.formatStringFromName(l10nProperty, l10nArgs, l10nArgs.length);
} else {
text = Strings.GetStringFromName(l10nProperty);
}
console.error(text);
}
},
- onConnectionChanged: function () {
+ onConnectionChanged: function() {
console.log("Connection status changed: " + this.connection.status);
if (this.connection.status == Connection.Status.DISCONNECTED) {
this.selectedRuntime = null;
}
if (!this.connected) {
this._listTabsResponse = null;
@@ -165,51 +165,50 @@ var AppManager = exports.AppManager = {
get connected() {
return this.connection &&
this.connection.status == Connection.Status.CONNECTED;
},
get apps() {
if (this._appsFront) {
return this._appsFront.apps;
- } else {
- return new Map();
}
+ return new Map();
},
- isProjectRunning: function () {
+ isProjectRunning: function() {
if (this.selectedProject.type == "mainProcess" ||
this.selectedProject.type == "tab") {
return true;
}
let app = this._getProjectFront(this.selectedProject);
return app && app.running;
},
- checkIfProjectIsRunning: function () {
+ checkIfProjectIsRunning: function() {
if (this.selectedProject) {
if (this.isProjectRunning()) {
this.update("project-started");
} else {
this.update("project-stopped");
}
}
},
- listTabs: function () {
+ listTabs: function() {
return this.tabStore.listTabs();
},
- onTabList: function () {
+ onTabList: function() {
this.update("runtime-targets", { type: "tabs" });
},
// TODO: Merge this into TabProject as part of project-agnostic work
- onTabNavigate: function () {
+ onTabNavigate: function() {
this.update("runtime-targets", { type: "tabs" });
if (this.selectedProject.type !== "tab") {
return;
}
let tab = this.selectedProject.app = this.tabStore.selectedTab;
let uri = NetUtil.newURI(tab.url);
// Wanted to use nsIFaviconService here, but it only works for visited
// tabs, so that's no help for any remote tabs. Maybe some favicon wizard
@@ -221,65 +220,64 @@ var AppManager = exports.AppManager = {
tab.name = uri.host + ": " + tab.name;
}
this.selectedProject.location = tab.url;
this.selectedProject.name = tab.name;
this.selectedProject.icon = tab.favicon;
this.update("project-validated");
},
- onTabClosed: function () {
+ onTabClosed: function() {
if (this.selectedProject.type !== "tab") {
return;
}
this.selectedProject = null;
},
- reloadTab: function () {
+ reloadTab: function() {
if (this.selectedProject && this.selectedProject.type != "tab") {
return Promise.reject("tried to reload non-tab project");
}
return this.getTarget().then(target => {
target.activeTab.reload();
}, console.error);
},
- getTarget: function () {
+ getTarget: function() {
if (this.selectedProject.type == "mainProcess") {
// Fx >=39 exposes a ChromeActor to debug the main process
if (this.connection.client.mainRoot.traits.allowChromeProcess) {
return this.connection.client.getProcess()
.then(aResponse => {
return TargetFactory.forRemoteTab({
form: aResponse.form,
client: this.connection.client,
chrome: true
});
});
- } else {
+ }
// Fx <39 exposes tab actors on the root actor
- return TargetFactory.forRemoteTab({
+ return TargetFactory.forRemoteTab({
form: this._listTabsResponse,
client: this.connection.client,
chrome: true,
isTabActor: false
- });
- }
+ });
}
if (this.selectedProject.type == "tab") {
return this.tabStore.getTargetForTab();
}
let app = this._getProjectFront(this.selectedProject);
if (!app) {
return Promise.reject("Can't find app front for selected project");
}
- return (async function () {
+ return (async function() {
// Once we asked the app to launch, the app isn't necessary completely loaded.
// launch request only ask the app to launch and immediatly returns.
// We have to keep trying to get app tab actors required to create its target.
for (let i = 0; i < 10; i++) {
try {
return await app.getTarget();
} catch (e) {}
@@ -288,34 +286,34 @@ var AppManager = exports.AppManager = {
});
}
AppManager.reportError("error_cantConnectToApp", app.manifest.manifestURL);
throw new Error("can't connect to app");
})();
},
- getProjectManifestURL: function (project) {
+ getProjectManifestURL: function(project) {
let manifest = null;
if (project.type == "runtimeApp") {
manifest = project.app.manifestURL;
}
if (project.type == "hosted") {
manifest = project.location;
}
if (project.type == "packaged" && project.packagedAppOrigin) {
manifest = "app://" + project.packagedAppOrigin + "/manifest.webapp";
}
return manifest;
},
- _getProjectFront: function (project) {
+ _getProjectFront: function(project) {
let manifest = this.getProjectManifestURL(project);
if (manifest && this._appsFront) {
return this._appsFront.apps.get(manifest);
}
return null;
},
_selectedProject: null,
@@ -341,17 +339,19 @@ var AppManager = exports.AppManager = {
} else if (type === "mainProcess") {
return;
} else {
throw new Error("Unsupported project type: " + type);
}
}
let cancelled = false;
- this.update("before-project", { cancel: () => { cancelled = true; } });
+ this.update("before-project", { cancel: () => {
+ cancelled = true;
+ } });
if (cancelled) {
return;
}
this._selectedProject = project;
// Clear out tab store's selected state, if any
this.tabStore.selectedTab = null;
@@ -396,18 +396,17 @@ var AppManager = exports.AppManager = {
}
this.update("runtime");
},
get selectedRuntime() {
return this._selectedRuntime;
},
- connectToRuntime: function (runtime) {
-
+ connectToRuntime: function(runtime) {
if (this.connected && this.selectedRuntime === runtime) {
// Already connected
return Promise.resolve();
}
let deferred = new Promise((resolve, reject) => {
this.disconnectRuntime().then(() => {
this.selectedRuntime = runtime;
@@ -484,17 +483,17 @@ var AppManager = exports.AppManager = {
d.platformversion, true);
this._telemetry.logKeyed("DEVTOOLS_WEBIDE_CONNECTED_RUNTIME_APP_TYPE",
d.apptype, true);
this._telemetry.logKeyed("DEVTOOLS_WEBIDE_CONNECTED_RUNTIME_VERSION",
d.version, true);
this.update("runtime-telemetry");
},
- isMainProcessDebuggable: function () {
+ isMainProcessDebuggable: function() {
// Fx <39 exposes chrome tab actors on RootActor
// Fx >=39 exposes a dedicated actor via getProcess request
return this.connection.client &&
this.connection.client.mainRoot &&
this.connection.client.mainRoot.traits.allowChromeProcess ||
(this._listTabsResponse &&
this._listTabsResponse.consoleActor);
},
@@ -512,52 +511,51 @@ var AppManager = exports.AppManager = {
get preferenceFront() {
if (!this._listTabsResponse) {
return null;
}
return getPreferenceFront(this.connection.client, this._listTabsResponse);
},
- disconnectRuntime: function () {
+ disconnectRuntime: function() {
if (!this.connected) {
return Promise.resolve();
}
return new Promise(resolve => {
this.connection.once(Connection.Events.DISCONNECTED, () => resolve());
this.connection.disconnect();
});
},
- launchRuntimeApp: function () {
+ launchRuntimeApp: function() {
if (this.selectedProject && this.selectedProject.type != "runtimeApp") {
return Promise.reject("attempting to launch a non-runtime app");
}
let app = this._getProjectFront(this.selectedProject);
return app.launch();
},
- launchOrReloadRuntimeApp: function () {
+ launchOrReloadRuntimeApp: function() {
if (this.selectedProject && this.selectedProject.type != "runtimeApp") {
return Promise.reject("attempting to launch / reload a non-runtime app");
}
let app = this._getProjectFront(this.selectedProject);
if (!app.running) {
return app.launch();
- } else {
- return app.reload();
}
+ return app.reload();
},
- runtimeCanHandleApps: function () {
+ runtimeCanHandleApps: function() {
return !!this._appsFront;
},
- installAndRunProject: function () {
+ installAndRunProject: function() {
let project = this.selectedProject;
if (!project || (project.type != "packaged" && project.type != "hosted")) {
console.error("Can't install project. Unknown type of project.");
return Promise.reject("Can't install");
}
if (!this._listTabsResponse) {
@@ -565,17 +563,17 @@ var AppManager = exports.AppManager = {
return Promise.reject("Can't install");
}
if (!this._appsFront) {
console.error("Runtime doesn't have a webappsActor");
return Promise.reject("Can't install");
}
- return (async function () {
+ return (async function() {
let self = AppManager;
// Validate project
await self.validateAndUpdateProject(project);
if (project.errorsCount > 0) {
self.reportError("error_cantInstallValidationErrors");
return;
@@ -634,30 +632,29 @@ var AppManager = exports.AppManager = {
await app.launch();
await deferred;
} else {
await app.reload();
}
})();
},
- stopRunningApp: function () {
+ stopRunningApp: function() {
let app = this._getProjectFront(this.selectedProject);
return app.close();
},
/* PROJECT VALIDATION */
- validateAndUpdateProject: function (project) {
+ validateAndUpdateProject: function(project) {
if (!project) {
return Promise.reject();
}
- return (async function () {
-
+ return (async function() {
let packageDir = project.location;
let validation = new AppValidator({
type: project.type,
// Build process may place the manifest in a non-root directory
location: packageDir
});
await validation.validate();
@@ -668,26 +665,24 @@ var AppManager = exports.AppManager = {
if (manifest.icons) {
let size = Object.keys(manifest.icons).sort((a, b) => b - a)[0];
if (size) {
iconPath = manifest.icons[size];
}
}
if (!iconPath) {
project.icon = AppManager.DEFAULT_PROJECT_ICON;
- } else {
- if (project.type == "hosted") {
- let manifestURL = Services.io.newURI(project.location);
- let origin = Services.io.newURI(manifestURL.prePath);
- project.icon = Services.io.newURI(iconPath, null, origin).spec;
- } else if (project.type == "packaged") {
- let projectFolder = FileUtils.File(packageDir);
- let folderURI = Services.io.newFileURI(projectFolder).spec;
- project.icon = folderURI + iconPath.replace(/^\/|\\/, "");
- }
+ } else if (project.type == "hosted") {
+ let manifestURL = Services.io.newURI(project.location);
+ let origin = Services.io.newURI(manifestURL.prePath);
+ project.icon = Services.io.newURI(iconPath, null, origin).spec;
+ } else if (project.type == "packaged") {
+ let projectFolder = FileUtils.File(packageDir);
+ let folderURI = Services.io.newFileURI(projectFolder).spec;
+ project.icon = folderURI + iconPath.replace(/^\/|\\/, "");
}
project.manifest = validation.manifest;
if ("name" in project.manifest) {
project.name = project.manifest.name;
} else {
project.name = AppManager.DEFAULT_PROJECT_NAME;
}
@@ -730,25 +725,25 @@ var AppManager = exports.AppManager = {
if (AppManager.selectedProject === project) {
AppManager.update("project-validated");
}
})();
},
/* RUNTIME LIST */
- _clearRuntimeList: function () {
+ _clearRuntimeList: function() {
this.runtimeList = {
usb: [],
wifi: [],
other: []
};
},
- _rebuildRuntimeList: function () {
+ _rebuildRuntimeList: function() {
let runtimes = RuntimeScanners.listRuntimes();
this._clearRuntimeList();
// Reorganize runtimes by type
for (let runtime of runtimes) {
switch (runtime.type) {
case RuntimeTypes.USB:
this.runtimeList.usb.push(runtime);
@@ -762,17 +757,17 @@ var AppManager = exports.AppManager = {
}
this.update("runtime-details");
this.update("runtime-list");
},
/* MANIFEST UTILS */
- writeManifest: function (project) {
+ writeManifest: function(project) {
if (project.type != "packaged") {
return Promise.reject("Not a packaged app");
}
if (!project.manifest) {
project.manifest = {};
}
--- a/devtools/client/webide/modules/app-projects.js
+++ b/devtools/client/webide/modules/app-projects.js
@@ -14,45 +14,43 @@ const {FileUtils} = require("resource://
* The only constraint is that project objects have to have
* a unique `location` object.
*/
const IDB = {
_db: null,
databaseName: "AppProjects",
- open: function () {
+ open: function() {
return new Promise((resolve, reject) => {
let request = indexedDB.open(IDB.databaseName, 5);
- request.onerror = function (event) {
+ request.onerror = function(event) {
reject("Unable to open AppProjects indexedDB: " +
this.error.name + " - " + this.error.message);
};
- request.onupgradeneeded = function (event) {
+ request.onupgradeneeded = function(event) {
let db = event.target.result;
db.createObjectStore("projects", { keyPath: "location" });
};
- request.onsuccess = function () {
+ request.onsuccess = function() {
let db = IDB._db = request.result;
let objectStore = db.transaction("projects").objectStore("projects");
let projects = [];
let toRemove = [];
- objectStore.openCursor().onsuccess = function (event) {
+ objectStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
if (cursor) {
if (cursor.value.location) {
-
// We need to make sure this object has a `.location` property.
// The UI depends on this property.
// This should not be needed as we make sure to register valid
// projects, but in the past (before bug 924568), we might have
// registered invalid objects.
-
// We also want to make sure the location is valid.
// If the location doesn't exist, we remove the project.
try {
let file = FileUtils.File(cursor.value.location);
if (file.exists()) {
projects.push(cursor.value);
} else {
@@ -75,78 +73,78 @@ const IDB = {
resolve(projects);
});
}
};
};
});
},
- add: function (project) {
+ add: function(project) {
return new Promise((resolve, reject) => {
if (!project.location) {
// We need to make sure this object has a `.location` property.
reject("Missing location property on project object.");
} else {
let transaction = IDB._db.transaction(["projects"], "readwrite");
let objectStore = transaction.objectStore("projects");
let request = objectStore.add(project);
- request.onerror = function (event) {
+ request.onerror = function(event) {
reject("Unable to add project to the AppProjects indexedDB: " +
this.error.name + " - " + this.error.message);
};
- request.onsuccess = function () {
+ request.onsuccess = function() {
resolve();
};
}
});
},
- update: function (project) {
+ update: function(project) {
return new Promise((resolve, reject) => {
var transaction = IDB._db.transaction(["projects"], "readwrite");
var objectStore = transaction.objectStore("projects");
var request = objectStore.put(project);
- request.onerror = function (event) {
+ request.onerror = function(event) {
reject("Unable to update project to the AppProjects indexedDB: " +
this.error.name + " - " + this.error.message);
};
- request.onsuccess = function () {
+ request.onsuccess = function() {
resolve();
};
});
},
- remove: function (location) {
+ remove: function(location) {
return new Promise((resolve, reject) => {
let request = IDB._db.transaction(["projects"], "readwrite")
.objectStore("projects")
.delete(location);
- request.onsuccess = function (event) {
+ request.onsuccess = function(event) {
resolve();
};
- request.onerror = function () {
+ request.onerror = function() {
reject("Unable to delete project to the AppProjects indexedDB: " +
this.error.name + " - " + this.error.message);
};
});
}
};
-var loadDeferred = IDB.open().then(function (projects) {
+var loadDeferred = IDB.open().then(function(projects) {
AppProjects.projects = projects;
AppProjects.emit("ready", projects);
});
const AppProjects = {
- load: function () {
+ load: function() {
return loadDeferred;
},
- addPackaged: function (folder) {
+ addPackaged: function(folder) {
let file = FileUtils.File(folder.path);
if (!file.exists()) {
return Promise.reject("path doesn't exist");
}
let existingProject = this.get(folder.path);
if (existingProject) {
return Promise.reject("Already added");
}
@@ -163,56 +161,56 @@ const AppProjects = {
packagedAppOrigin: generateUUID().toString().slice(1, -1)
};
return IDB.add(project).then(() => {
this.projects.push(project);
return project;
});
},
- addHosted: function (manifestURL) {
+ addHosted: function(manifestURL) {
let existingProject = this.get(manifestURL);
if (existingProject) {
return Promise.reject("Already added");
}
let project = {
type: "hosted",
location: manifestURL
};
return IDB.add(project).then(() => {
this.projects.push(project);
return project;
});
},
- update: function (project) {
+ update: function(project) {
return IDB.update(project);
},
- updateLocation: function (project, newLocation) {
+ updateLocation: function(project, newLocation) {
return IDB.remove(project.location)
.then(() => {
project.location = newLocation;
return IDB.add(project);
});
},
- remove: function (location) {
+ remove: function(location) {
return IDB.remove(location).then(() => {
for (let i = 0; i < this.projects.length; i++) {
if (this.projects[i].location == location) {
this.projects.splice(i, 1);
return;
}
}
throw new Error("Unable to find project in AppProjects store");
});
},
- get: function (location) {
+ get: function(location) {
for (let i = 0; i < this.projects.length; i++) {
if (this.projects[i].location == location) {
return this.projects[i];
}
}
return null;
},
--- a/devtools/client/webide/modules/app-validator.js
+++ b/devtools/client/webide/modules/app-validator.js
@@ -11,25 +11,25 @@ var strings = Services.strings.createBun
function AppValidator({ type, location }) {
this.type = type;
this.location = location;
this.errors = [];
this.warnings = [];
}
-AppValidator.prototype.error = function (message) {
+AppValidator.prototype.error = function(message) {
this.errors.push(message);
};
-AppValidator.prototype.warning = function (message) {
+AppValidator.prototype.warning = function(message) {
this.warnings.push(message);
};
-AppValidator.prototype._getPackagedManifestFile = function () {
+AppValidator.prototype._getPackagedManifestFile = function() {
let manifestFile = FileUtils.File(this.location);
if (!manifestFile.exists()) {
this.error(strings.GetStringFromName("validator.nonExistingFolder"));
return null;
}
if (!manifestFile.isDirectory()) {
this.error(strings.GetStringFromName("validator.expectProjectFolder"));
return null;
@@ -47,95 +47,95 @@ AppValidator.prototype._getPackagedManif
if (!hasAppManifest && !hasJsonManifest) {
this.error(strings.GetStringFromName("validator.noManifestFile"));
return null;
}
return hasAppManifest ? appManifestFile : jsonManifestFile;
};
-AppValidator.prototype._getPackagedManifestURL = function () {
+AppValidator.prototype._getPackagedManifestURL = function() {
let manifestFile = this._getPackagedManifestFile();
if (!manifestFile) {
return null;
}
return Services.io.newFileURI(manifestFile).spec;
};
-AppValidator.checkManifest = function (manifestURL) {
+AppValidator.checkManifest = function(manifestURL) {
return new Promise((resolve, reject) => {
let error;
let req = new XMLHttpRequest();
req.overrideMimeType("text/plain");
try {
req.open("GET", manifestURL, true);
req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE | Ci.nsIRequest.INHIBIT_CACHING;
} catch (e) {
error = strings.formatStringFromName("validator.invalidManifestURL", [manifestURL], 1);
return reject(error);
}
- req.onload = function () {
+ req.onload = function() {
let manifest = null;
try {
manifest = JSON.parse(req.responseText);
} catch (e) {
error = strings.formatStringFromName("validator.invalidManifestJSON", [e, manifestURL], 2);
reject(error);
}
resolve({manifest, manifestURL});
};
- req.onerror = function () {
+ req.onerror = function() {
error = strings.formatStringFromName("validator.noAccessManifestURL", [req.statusText, manifestURL], 2);
reject(error);
};
try {
req.send(null);
} catch (e) {
error = strings.formatStringFromName("validator.noAccessManifestURL", [e, manifestURL], 2);
reject(error);
}
});
};
-AppValidator.findManifestAtOrigin = function (manifestURL) {
+AppValidator.findManifestAtOrigin = function(manifestURL) {
let fixedManifest = Services.io.newURI(manifestURL).prePath + "/manifest.webapp";
return AppValidator.checkManifest(fixedManifest);
};
-AppValidator.findManifestPath = function (manifestURL) {
+AppValidator.findManifestPath = function(manifestURL) {
return new Promise((resolve, reject) => {
if (manifestURL.endsWith("manifest.webapp")) {
reject();
} else {
let fixedManifest = manifestURL + "/manifest.webapp";
resolve(AppValidator.checkManifest(fixedManifest));
}
});
};
-AppValidator.checkAlternateManifest = function (manifestURL) {
- return (async function () {
+AppValidator.checkAlternateManifest = function(manifestURL) {
+ return (async function() {
let result;
try {
result = await AppValidator.findManifestPath(manifestURL);
} catch (e) {
result = await AppValidator.findManifestAtOrigin(manifestURL);
}
return result;
})();
};
-AppValidator.prototype._fetchManifest = function (manifestURL) {
+AppValidator.prototype._fetchManifest = function(manifestURL) {
return new Promise(resolve => {
this.manifestURL = manifestURL;
AppValidator.checkManifest(manifestURL)
.then(({manifest, manifestURL}) => {
resolve(manifest);
}, error => {
AppValidator.checkAlternateManifest(manifestURL)
@@ -145,59 +145,60 @@ AppValidator.prototype._fetchManifest =
}, () => {
this.error(error);
resolve(null);
});
});
});
};
-AppValidator.prototype._getManifest = function () {
+AppValidator.prototype._getManifest = function() {
let manifestURL;
if (this.type == "packaged") {
manifestURL = this._getPackagedManifestURL();
- if (!manifestURL)
+ if (!manifestURL) {
return Promise.resolve(null);
+ }
} else if (this.type == "hosted") {
manifestURL = this.location;
try {
Services.io.newURI(manifestURL);
} catch (e) {
this.error(strings.formatStringFromName("validator.invalidHostedManifestURL", [manifestURL, e.message], 2));
return Promise.resolve(null);
}
} else {
this.error(strings.formatStringFromName("validator.invalidProjectType", [this.type], 1));
return Promise.resolve(null);
}
return this._fetchManifest(manifestURL);
};
-AppValidator.prototype.validateManifest = function (manifest) {
+AppValidator.prototype.validateManifest = function(manifest) {
if (!manifest.name) {
this.error(strings.GetStringFromName("validator.missNameManifestProperty"));
}
if (!manifest.icons || Object.keys(manifest.icons).length === 0) {
this.warning(strings.GetStringFromName("validator.missIconsManifestProperty"));
} else if (!manifest.icons["128"]) {
this.warning(strings.GetStringFromName("validator.missIconMarketplace2"));
}
};
-AppValidator.prototype._getOriginURL = function () {
+AppValidator.prototype._getOriginURL = function() {
if (this.type == "packaged") {
let manifestURL = Services.io.newURI(this.manifestURL);
return Services.io.newURI(".", null, manifestURL).spec;
} else if (this.type == "hosted") {
return Services.io.newURI(this.location).prePath;
}
};
-AppValidator.prototype.validateLaunchPath = function (manifest) {
+AppValidator.prototype.validateLaunchPath = function(manifest) {
return new Promise(resolve => {
// The launch_path field has to start with a `/`
if (manifest.launch_path && manifest.launch_path[0] !== "/") {
this.error(strings.formatStringFromName("validator.nonAbsoluteLaunchPath", [manifest.launch_path], 1));
resolve();
}
let origin = this._getOriginURL();
let path;
@@ -219,54 +220,55 @@ AppValidator.prototype.validateLaunchPat
try {
req.open("HEAD", indexURL, true);
req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE | Ci.nsIRequest.INHIBIT_CACHING;
} catch (e) {
this.error(strings.formatStringFromName("validator.accessFailedLaunchPath", [indexURL], 1));
return resolve();
}
req.onload = () => {
- if (req.status >= 400)
+ if (req.status >= 400) {
this.error(strings.formatStringFromName("validator.accessFailedLaunchPathBadHttpCode", [indexURL, req.status], 2));
+ }
resolve();
};
req.onerror = () => {
this.error(strings.formatStringFromName("validator.accessFailedLaunchPath", [indexURL], 1));
resolve();
};
try {
req.send(null);
} catch (e) {
this.error(strings.formatStringFromName("validator.accessFailedLaunchPath", [indexURL], 1));
resolve();
}
});
};
-AppValidator.prototype.validateType = function (manifest) {
+AppValidator.prototype.validateType = function(manifest) {
let appType = manifest.type || "web";
if (!["web", "privileged", "certified"].includes(appType)) {
this.error(strings.formatStringFromName("validator.invalidAppType", [appType], 1));
} else if (this.type == "hosted" &&
["certified", "privileged"].includes(appType)) {
this.error(strings.formatStringFromName("validator.invalidHostedPriviledges", [appType], 1));
}
// certified app are not fully supported on the simulator
if (appType === "certified") {
this.warning(strings.GetStringFromName("validator.noCertifiedSupport"));
}
};
-AppValidator.prototype.validate = function () {
+AppValidator.prototype.validate = function() {
this.errors = [];
this.warnings = [];
- return this._getManifest().
- then((manifest) => {
+ return this._getManifest()
+ .then((manifest) => {
if (manifest) {
this.manifest = manifest;
// Skip validations for add-ons
if (manifest.role === "addon" || manifest.manifest_version) {
return Promise.resolve();
}
--- a/devtools/client/webide/modules/config-view.js
+++ b/devtools/client/webide/modules/config-view.js
@@ -5,25 +5,25 @@
const {Cu} = require("chrome");
const EventEmitter = require("devtools/shared/event-emitter");
const Services = require("Services");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
var ConfigView;
-module.exports = ConfigView = function (window) {
+module.exports = ConfigView = function(window) {
EventEmitter.decorate(this);
this._doc = window.document;
this._keys = [];
return this;
};
ConfigView.prototype = {
- _renderByType: function (input, name, value, customType) {
+ _renderByType: function(input, name, value, customType) {
value = customType || typeof value;
switch (value) {
case "boolean":
input.setAttribute("data-type", "boolean");
input.setAttribute("type", "checkbox");
break;
case "number":
@@ -57,17 +57,17 @@ ConfigView.prototype = {
set kind(kind) {
this._kind = kind;
},
set includeTypeName(include) {
this._includeTypeName = include;
},
- search: function (event) {
+ search: function(event) {
if (event.target.value.length) {
let stringMatch = new RegExp(event.target.value, "i");
for (let i = 0; i < this._keys.length; i++) {
let key = this._keys[i];
let row = this._doc.getElementById("row-" + key);
if (key.match(stringMatch)) {
row.classList.remove("hide");
@@ -79,27 +79,27 @@ ConfigView.prototype = {
var trs = this._doc.getElementById("device-fields").querySelectorAll("tr");
for (let i = 0; i < trs.length; i++) {
trs[i].classList.remove("hide");
}
}
},
- generateDisplay: function (json) {
+ 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) {
+ generateField: function(name, value, hasUserValue, customType, newRow) {
let table = this._doc.querySelector("table");
let sResetDefault = Strings.GetStringFromName("device_reset_default");
if (!this._keys.includes(name)) {
this._keys.push(name);
}
let input = this._doc.createElement("input");
@@ -155,48 +155,48 @@ ConfigView.prototype = {
} else {
existing.value = value;
}
} else {
table.appendChild(tr);
}
},
- resetTable: function () {
+ resetTable: function() {
let table = this._doc.querySelector("table");
let trs = table.querySelectorAll("tr:not(#add-custom-field)");
for (var i = 0; i < trs.length; i++) {
table.removeChild(trs[i]);
}
return table;
},
- _getCallType: function (type, name) {
+ _getCallType: function(type, name) {
let frontName = "get";
if (this._includeTypeName) {
frontName += type;
}
return this._front[frontName + this._kind](name);
},
- _setCallType: function (type, name, value) {
+ _setCallType: function(type, name, value) {
let frontName = "set";
if (this._includeTypeName) {
frontName += type;
}
return this._front[frontName + this._kind](name, value);
},
- _saveByType: function (options) {
+ _saveByType: function(options) {
let fieldName = options.id;
let inputType = options.type;
let value = options.value;
let input = this._doc.getElementById(fieldName);
switch (inputType) {
case "boolean":
this._setCallType("Bool", fieldName, input.checked);
@@ -211,17 +211,17 @@ ConfigView.prototype = {
this._setCallType("Object", fieldName, value);
break;
default:
this._setCallType("Char", fieldName, value);
break;
}
},
- updateField: function (event) {
+ updateField: function(event) {
if (event.target) {
let inputType = event.target.getAttribute("data-type");
let inputValue = event.target.checked || event.target.value;
if (event.target.nodeName == "input" &&
event.target.validity.valid &&
event.target.classList.contains("editable")) {
let id = event.target.id;
@@ -238,17 +238,17 @@ ConfigView.prototype = {
type: inputType,
value: inputValue
});
this._doc.getElementById("btn-" + id).classList.remove("hide");
}
}
},
- _resetToDefault: function (name, input, button) {
+ _resetToDefault: function(name, input, button) {
this._front["clearUser" + this._kind](name);
let dataType = input.getAttribute("data-type");
let tr = this._doc.getElementById("row-" + name);
switch (dataType) {
case "boolean":
this._defaultField = this._getCallType("Bool", name);
this._defaultField.then(boolean => {
@@ -282,25 +282,25 @@ ConfigView.prototype = {
tr.remove();
});
break;
}
button.classList.add("hide");
},
- checkReset: function (event) {
+ checkReset: function(event) {
if (event.target.classList.contains("reset")) {
let btnId = event.target.getAttribute("data-id");
let input = this._doc.getElementById(btnId);
this._resetToDefault(btnId, input, event.target);
}
},
- updateFieldType: function () {
+ updateFieldType: function() {
let table = this._doc.querySelector("table");
let customValueType = table.querySelector("#custom-value-type").value;
let customTextEl = table.querySelector("#custom-value-text");
let customText = customTextEl.value;
if (customValueType.length === 0) {
return false;
}
@@ -317,29 +317,29 @@ ConfigView.prototype = {
default:
customTextEl.type = "text";
break;
}
return customValueType;
},
- clearNewFields: function () {
+ clearNewFields: function() {
let table = this._doc.querySelector("table");
let customTextEl = table.querySelector("#custom-value-text");
if (customTextEl.checked) {
customTextEl.checked = false;
} else {
customTextEl.value = "";
}
this.updateFieldType();
},
- updateNewField: function () {
+ updateNewField: function() {
let table = this._doc.querySelector("table");
let customValueType = this.updateFieldType();
if (!customValueType) {
return;
}
let customRow = table.querySelector("tr:nth-of-type(2)");
@@ -360,14 +360,14 @@ ConfigView.prototype = {
type: customValueType,
value: customText
});
customTextNameEl.value = "";
this.clearNewFields();
}
},
- checkNewFieldSubmit: function (event) {
+ checkNewFieldSubmit: function(event) {
if (event.keyCode === 13) {
this._doc.getElementById("custom-value").click();
}
}
};
--- a/devtools/client/webide/modules/project-list.js
+++ b/devtools/client/webide/modules/project-list.js
@@ -10,17 +10,17 @@ const {AppManager} = require("devtools/c
const EventEmitter = require("devtools/shared/event-emitter");
const utils = require("devtools/client/webide/modules/utils");
const Telemetry = require("devtools/client/shared/telemetry");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
var ProjectList;
-module.exports = ProjectList = function (win, parentWindow) {
+module.exports = ProjectList = function(win, parentWindow) {
EventEmitter.decorate(this);
this._doc = win.document;
this._UI = parentWindow.UI;
this._parentWindow = parentWindow;
this._telemetry = new Telemetry();
this._panelNodeEl = "div";
this.onWebIDEUpdate = this.onWebIDEUpdate.bind(this);
@@ -31,84 +31,85 @@ module.exports = ProjectList = function
AppManager.on("app-manager-update", this.appManagerUpdate);
};
ProjectList.prototype = {
get doc() {
return this._doc;
},
- appManagerUpdate: function (what, details) {
+ appManagerUpdate: function(what, details) {
// Got a message from app-manager.js
// See AppManager.update() for descriptions of what these events mean.
switch (what) {
case "project-removed":
case "runtime-targets":
case "connection":
this.update(details);
break;
case "project":
this.updateCommands();
this.update(details);
break;
}
},
- onWebIDEUpdate: function (what, details) {
+ onWebIDEUpdate: function(what, details) {
if (what == "busy" || what == "unbusy") {
this.updateCommands();
}
},
/**
* testOptions: { chrome mochitest support
* folder: nsIFile, where to store the app
* index: Number, index of the app in the template list
* name: String name of the app
* }
*/
- newApp: function (testOptions) {
+ newApp: function(testOptions) {
let parentWindow = this._parentWindow;
let self = this;
- return this._UI.busyUntil((async function () {
+ return this._UI.busyUntil((async function() {
// Open newapp.xul, which will feed ret.location
let ret = {location: null, testOptions: testOptions};
parentWindow.openDialog("chrome://webide/content/newapp.xul", "newapp", "chrome,modal", ret);
- if (!ret.location)
+ if (!ret.location) {
return;
+ }
// Retrieve added project
let project = AppProjects.get(ret.location);
// Select project
AppManager.selectedProject = project;
self._telemetry.actionOccurred("webideNewProject");
})(), "creating new app");
},
- importPackagedApp: function (location) {
+ importPackagedApp: function(location) {
let parentWindow = this._parentWindow;
let UI = this._UI;
- return UI.busyUntil((async function () {
+ return UI.busyUntil((async function() {
let directory = await utils.getPackagedDirectory(parentWindow, location);
if (!directory) {
// User cancelled directory selection
return;
}
await UI.importAndSelectApp(directory);
})(), "importing packaged app");
},
- importHostedApp: function (location) {
+ importHostedApp: function(location) {
let parentWindow = this._parentWindow;
let UI = this._UI;
- return UI.busyUntil((async function () {
+ return UI.busyUntil((async function() {
let url = utils.getHostedURL(parentWindow, location);
if (!url) {
return;
}
await UI.importAndSelectApp(url);
})(), "importing hosted app");
@@ -116,36 +117,36 @@ ProjectList.prototype = {
/**
* opts: {
* panel: Object, currenl project panel node
* name: String, name of the project
* icon: String path of the project icon
* }
*/
- _renderProjectItem: function (opts) {
+ _renderProjectItem: function(opts) {
let span = opts.panel.querySelector("span") || this._doc.createElement("span");
span.textContent = opts.name;
let icon = opts.panel.querySelector("img") || this._doc.createElement("img");
icon.className = "project-image";
icon.setAttribute("src", opts.icon);
opts.panel.appendChild(icon);
opts.panel.appendChild(span);
opts.panel.setAttribute("title", opts.name);
},
- refreshTabs: function () {
+ refreshTabs: function() {
if (AppManager.connected) {
return AppManager.listTabs().then(() => {
this.updateTabs();
}).catch(console.error);
}
},
- updateTabs: function () {
+ updateTabs: function() {
let tabsHeaderNode = this._doc.querySelector("#panel-header-tabs");
let tabsNode = this._doc.querySelector("#project-panel-tabs");
while (tabsNode.hasChildNodes()) {
tabsNode.firstChild.remove();
}
if (!AppManager.connected) {
@@ -195,17 +196,17 @@ ProjectList.prototype = {
name: tab.name
};
}, true);
}
return Promise.resolve();
},
- updateApps: function () {
+ updateApps: function() {
let doc = this._doc;
let runtimeappsHeaderNode = doc.querySelector("#panel-header-runtimeapps");
let sortedApps = [];
for (let [manifestURL, app] of AppManager.apps) {
sortedApps.push(app);
}
sortedApps = sortedApps.sort((a, b) => {
return a.manifest.name > b.manifest.name;
@@ -258,17 +259,17 @@ ProjectList.prototype = {
name: app.manifest.name
};
}, true);
}
return Promise.resolve();
},
- updateCommands: function () {
+ updateCommands: function() {
let doc = this._doc;
let newAppCmd;
let packagedAppCmd;
let hostedAppCmd;
newAppCmd = doc.querySelector("#new-app");
packagedAppCmd = doc.querySelector("#packaged-app");
hostedAppCmd = doc.querySelector("#hosted-app");
@@ -290,17 +291,17 @@ ProjectList.prototype = {
},
/**
* Trigger an update of the project and remote runtime list.
* @param options object (optional)
* An |options| object containing a type of |apps| or |tabs| will limit
* what is updated to only those sections.
*/
- update: function (options) {
+ update: function(options) {
if (options && options.type === "apps") {
return this.updateApps();
} else if (options && options.type === "tabs") {
return this.updateTabs();
}
return new Promise((resolve, reject) => {
let doc = this._doc;
@@ -354,17 +355,17 @@ ProjectList.prototype = {
if (AppManager.connected) {
AppManager.listTabs().then(() => {
this.updateTabs();
}).catch(console.error);
}
});
},
- destroy: function () {
+ destroy: function() {
this._doc = null;
AppManager.off("app-manager-update", this.appManagerUpdate);
this._UI.off("webide-update", this.onWebIDEUpdate);
this._UI = null;
this._parentWindow = null;
this._panelNodeEl = null;
}
};
--- a/devtools/client/webide/modules/runtime-list.js
+++ b/devtools/client/webide/modules/runtime-list.js
@@ -10,17 +10,17 @@ const EventEmitter = require("devtools/s
const {RuntimeScanners, WiFiScanner} = require("devtools/client/webide/modules/runtimes");
const {Devices} = require("resource://devtools/shared/apps/Devices.jsm");
const utils = require("devtools/client/webide/modules/utils");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
var RuntimeList;
-module.exports = RuntimeList = function (window, parentWindow) {
+module.exports = RuntimeList = function(window, parentWindow) {
EventEmitter.decorate(this);
this._doc = window.document;
this._UI = parentWindow.UI;
this._Cmds = parentWindow.Cmds;
this._parentWindow = parentWindow;
this._panelNodeEl = "button";
this._panelBoxEl = "div";
@@ -32,65 +32,65 @@ module.exports = RuntimeList = function
AppManager.on("app-manager-update", this.appManagerUpdate);
};
RuntimeList.prototype = {
get doc() {
return this._doc;
},
- appManagerUpdate: function (what, details) {
+ appManagerUpdate: function(what, details) {
// Got a message from app-manager.js
// See AppManager.update() for descriptions of what these events mean.
switch (what) {
case "runtime-list":
this.update();
break;
case "connection":
case "runtime-global-actors":
this.updateCommands();
break;
}
},
- onWebIDEUpdate: function (what, details) {
+ onWebIDEUpdate: function(what, details) {
if (what == "busy" || what == "unbusy") {
this.updateCommands();
}
},
- takeScreenshot: function () {
+ takeScreenshot: function() {
this._Cmds.takeScreenshot();
},
- showRuntimeDetails: function () {
+ showRuntimeDetails: function() {
this._Cmds.showRuntimeDetails();
},
- showDevicePreferences: function () {
+ showDevicePreferences: function() {
this._Cmds.showDevicePrefs();
},
- showSettings: function () {
+ showSettings: function() {
this._Cmds.showSettings();
},
- showTroubleShooting: function () {
+ showTroubleShooting: function() {
this._Cmds.showTroubleShooting();
},
- showAddons: function () {
+ showAddons: function() {
this._Cmds.showAddons();
},
- refreshScanners: function () {
+ refreshScanners: function() {
RuntimeScanners.scan();
},
- updateCommands: function () {
+ updateCommands: function() {
let doc = this._doc;
// Runtime commands
let screenshotCmd = doc.querySelector("#runtime-screenshot");
let detailsCmd = doc.querySelector("#runtime-details");
let disconnectCmd = doc.querySelector("#runtime-disconnect");
let devicePrefsCmd = doc.querySelector("#runtime-preferences");
let settingsCmd = doc.querySelector("#runtime-settings");
@@ -108,17 +108,17 @@ RuntimeList.prototype = {
detailsCmd.setAttribute("disabled", "true");
screenshotCmd.setAttribute("disabled", "true");
disconnectCmd.setAttribute("disabled", "true");
devicePrefsCmd.setAttribute("disabled", "true");
settingsCmd.setAttribute("disabled", "true");
}
},
- update: function () {
+ update: function() {
let doc = this._doc;
let wifiHeaderNode = doc.querySelector("#runtime-header-wifi");
if (WiFiScanner.allowed) {
wifiHeaderNode.removeAttribute("hidden");
} else {
wifiHeaderNode.setAttribute("hidden", "true");
}
@@ -177,17 +177,17 @@ RuntimeList.prototype = {
panelItemNode.appendChild(configButton);
}
parent.appendChild(panelItemNode);
}
}
},
- destroy: function () {
+ destroy: function() {
this._doc = null;
AppManager.off("app-manager-update", this.appManagerUpdate);
this._UI.off("webide-update", this.onWebIDEUpdate);
this._UI = null;
this._Cmds = null;
this._parentWindow = null;
this._panelNodeEl = null;
}
--- a/devtools/client/webide/modules/runtimes.js
+++ b/devtools/client/webide/modules/runtimes.js
@@ -209,17 +209,17 @@ var LazyAdbScanner = {
disable() {
Devices.emit("adb-stop-polling");
},
scan() {
return promise.resolve();
},
- listRuntimes: function () {
+ listRuntimes: function() {
return [];
}
};
EventEmitter.decorate(LazyAdbScanner);
RuntimeScanners.add(LazyAdbScanner);
@@ -258,17 +258,17 @@ var WiFiScanner = {
this._emitUpdated();
},
scan() {
discovery.scan();
return promise.resolve();
},
- listRuntimes: function () {
+ listRuntimes: function() {
return this._runtimes;
},
ALLOWED_PREF: "devtools.remote.wifi.scan",
get allowed() {
return Services.prefs.getBoolPref(this.ALLOWED_PREF);
},
@@ -294,17 +294,19 @@ var WiFiScanner = {
EventEmitter.decorate(WiFiScanner);
WiFiScanner.init();
exports.WiFiScanner = WiFiScanner;
var StaticScanner = {
enable() {},
disable() {},
- scan() { return promise.resolve(); },
+ scan() {
+ return promise.resolve();
+ },
listRuntimes() {
let runtimes = [gRemoteRuntime];
if (Services.prefs.getBoolPref("devtools.webide.enableLocalRuntime")) {
runtimes.push(gLocalRuntime);
}
return runtimes;
}
};
@@ -327,17 +329,17 @@ var RuntimeTypes = exports.RuntimeTypes
function WiFiRuntime(deviceName) {
this.deviceName = deviceName;
}
WiFiRuntime.prototype = {
type: RuntimeTypes.WIFI,
// Mark runtime as taking a long time to connect
prolongedConnection: true,
- connect: function (connection) {
+ connect: function(connection) {
let service = discovery.getRemoteService("devtools", this.deviceName);
if (!service) {
return promise.reject(new Error("Can't find device: " + this.name));
}
connection.advertisement = service;
connection.authenticator.sendOOB = this.sendOOB;
// Disable the default connection timeout, since QR scanning can take an
// unknown amount of time. This prevents spurious errors (even after
@@ -387,17 +389,17 @@ WiFiRuntime.prototype = {
}
// Listen for the window our prompt opens, so we can close it programatically
let promptWindow;
let windowListener = {
onOpenWindow(xulWindow) {
let win = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function () {
+ win.addEventListener("load", function() {
if (win.document.documentElement.getAttribute("id") != WINDOW_ID) {
return;
}
// Found the window
promptWindow = win;
Services.wm.removeListener(windowListener);
}, {once: true});
},
@@ -430,17 +432,17 @@ WiFiRuntime.prototype = {
}
};
// For testing use only
exports._WiFiRuntime = WiFiRuntime;
var gLocalRuntime = {
type: RuntimeTypes.LOCAL,
- connect: function (connection) {
+ connect: function(connection) {
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
connection.host = null; // Force Pipe transport
connection.port = null;
connection.connect();
return promise.resolve();
},
@@ -452,17 +454,17 @@ var gLocalRuntime = {
},
};
// For testing use only
exports._gLocalRuntime = gLocalRuntime;
var gRemoteRuntime = {
type: RuntimeTypes.REMOTE,
- connect: function (connection) {
+ connect: function(connection) {
let win = Services.wm.getMostRecentWindow("devtools:webide");
if (!win) {
return promise.reject(new Error("No WebIDE window found"));
}
let ret = {value: connection.host + ":" + connection.port};
let title = Strings.GetStringFromName("remote_runtime_promptTitle");
let message = Strings.GetStringFromName("remote_runtime_promptMessage");
let ok = Services.prompt.prompt(win, title, message, ret, null, {});
--- a/devtools/client/webide/modules/tab-store.js
+++ b/devtools/client/webide/modules/tab-store.js
@@ -7,17 +7,17 @@ const { Cu } = require("chrome");
const { TargetFactory } = require("devtools/client/framework/target");
const EventEmitter = require("devtools/shared/event-emitter");
const { Connection } = require("devtools/shared/client/connection-manager");
const _knownTabStores = new WeakMap();
var TabStore;
-module.exports = TabStore = function (connection) {
+module.exports = TabStore = function(connection) {
// If we already know about this connection,
// let's re-use the existing store.
if (_knownTabStores.has(connection)) {
return _knownTabStores.get(connection);
}
_knownTabStores.set(connection, this);
@@ -34,36 +34,36 @@ module.exports = TabStore = function (co
this._onTabListChanged = this._onTabListChanged.bind(this);
this._onTabNavigated = this._onTabNavigated.bind(this);
this._onStatusChanged();
return this;
};
TabStore.prototype = {
- destroy: function () {
+ destroy: function() {
if (this._connection) {
// While this.destroy is bound using .once() above, that event may not
// have occurred when the TabStore client calls destroy, so we
// manually remove it here.
this._connection.off(Connection.Events.DESTROYED, this.destroy);
this._connection.off(Connection.Events.STATUS_CHANGED, this._onStatusChanged);
_knownTabStores.delete(this._connection);
this._connection = null;
}
},
- _resetStore: function () {
+ _resetStore: function() {
this.response = null;
this.tabs = [];
this._selectedTab = null;
this._selectedTabTargetPromise = null;
},
- _onStatusChanged: function () {
+ _onStatusChanged: function() {
if (this._connection.status == Connection.Status.CONNECTED) {
// Watch for changes to remote browser tabs
this._connection.client.addListener("tabListChanged",
this._onTabListChanged);
this._connection.client.addListener("tabNavigated",
this._onTabNavigated);
this.listTabs();
} else {
@@ -72,31 +72,31 @@ TabStore.prototype = {
this._onTabListChanged);
this._connection.client.removeListener("tabNavigated",
this._onTabNavigated);
}
this._resetStore();
}
},
- _onTabListChanged: function () {
+ _onTabListChanged: function() {
this.listTabs().then(() => this.emit("tab-list"))
.catch(console.error);
},
- _onTabNavigated: function (e, { from, title, url }) {
+ _onTabNavigated: function(e, { from, title, url }) {
if (!this._selectedTab || from !== this._selectedTab.actor) {
return;
}
this._selectedTab.url = url;
this._selectedTab.title = title;
this.emit("navigate");
},
- listTabs: function () {
+ listTabs: function() {
if (!this._connection || !this._connection.client) {
return Promise.reject(new Error("Can't listTabs, not connected."));
}
return new Promise((resolve, reject) => {
this._connection.client.listTabs().then(response => {
if (response.error) {
this._connection.disconnect();
@@ -130,36 +130,36 @@ TabStore.prototype = {
this._selectedTab = tab;
this._selectedTabTargetPromise = null;
// Attach to the tab to follow navigation events
if (this._selectedTab) {
this.getTargetForTab();
}
},
- _checkSelectedTab: function () {
+ _checkSelectedTab: function() {
if (!this._selectedTab) {
return;
}
let alive = this.tabs.some(tab => {
return tab.actor === this._selectedTab.actor;
});
if (!alive) {
this._selectedTab = null;
this._selectedTabTargetPromise = null;
this.emit("closed");
}
},
- getTargetForTab: function () {
+ getTargetForTab: function() {
if (this._selectedTabTargetPromise) {
return this._selectedTabTargetPromise;
}
let store = this;
- this._selectedTabTargetPromise = (async function () {
+ this._selectedTabTargetPromise = (async function() {
// If you connect to a tab, then detach from it, the root actor may have
// de-listed the actors that belong to the tab. This breaks the toolbox
// if you try to connect to the same tab again. To work around this
// issue, we force a "listTabs" request before connecting to a tab.
await store.listTabs();
return TargetFactory.forRemoteTab({
form: store._selectedTab,
client: store._connection.client,
--- a/devtools/client/webide/test/browser_tabs.js
+++ b/devtools/client/webide/test/browser_tabs.js
@@ -3,17 +3,17 @@
"use strict";
const TEST_URI = "http://example.com/browser/devtools/client/webide/test/doc_tabs.html";
function test() {
waitForExplicitFinish();
requestCompleteLog();
- (async function () {
+ (async function() {
// Since we test the connections set below, destroy the server in case it
// was left open.
DebuggerServer.destroy();
DebuggerServer.init();
DebuggerServer.registerAllActors();
let tab = await addTab(TEST_URI);
@@ -68,17 +68,17 @@ function connectToLocal(win, docRuntime)
win.AppManager.connection.once(
win.Connection.Events.CONNECTED,
resolve);
docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
});
}
function selectTabProject(win, docProject) {
- return (async function () {
+ return (async function() {
await waitForUpdate(win, "runtime-targets");
let tabsNode = docProject.querySelector("#project-panel-tabs");
let tabNode = tabsNode.querySelectorAll(".panel-item")[1];
let project = waitForUpdate(win, "project");
tabNode.click();
await project;
})();
}
--- a/devtools/client/webide/test/device_front_shared.js
+++ b/devtools/client/webide/test/device_front_shared.js
@@ -104,17 +104,17 @@ function addNewFieldInteger() {
is(newField.type, "number", "Custom type is a number");
is(newField.value, "1", "Custom integer value is correct");
}
ok(found, "Found new integer field line");
is(customName.value, "", "Custom integer name reset");
is(customValue.value, "", "Custom integer value reset");
}
-var editFieldInteger = async function () {
+var editFieldInteger = async function() {
// Edit existing custom integer preference
newField.value = 3;
newField.click();
is(newField.value, "3", "Custom integer existing value is correct");
// Reset a custom field
let resetBtn = doc.querySelector("#btn-new-integer-field");
resetBtn.click();
@@ -125,30 +125,30 @@ var editFieldInteger = async function ()
let fieldRow = doc.querySelector("#row-new-integer-field");
if (!fieldRow) {
found = false;
}
ok(!found, "Custom field removed");
}
};
-var resetExistingField = async function (id) {
+var resetExistingField = async function(id) {
let existing = doc.getElementById(id);
existing.click();
is(existing.checked, true, "Existing boolean value is correct");
resetBtn = doc.getElementById("btn-" + id);
resetBtn.click();
await iframe.contentWindow.configView._defaultField;
ok(resetBtn.classList.contains("hide"), true, "Reset button hidden");
is(existing.checked, true, "Existing field reset");
};
-var resetNewField = async function (id) {
+var resetNewField = async function(id) {
let custom = doc.getElementById(id);
custom.click();
is(custom.value, "test", "New string value is correct");
resetBtn = doc.getElementById("btn-" + id);
resetBtn.click();
await iframe.contentWindow.configView._defaultField;
--- a/devtools/client/webide/test/head.js
+++ b/devtools/client/webide/test/head.js
@@ -34,51 +34,51 @@ registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.webide.enabled");
Services.prefs.clearUserPref("devtools.webide.enableLocalRuntime");
Services.prefs.clearUserPref("devtools.webide.autoinstallADBHelper");
Services.prefs.clearUserPref("devtools.webide.busyTimeout");
Services.prefs.clearUserPref("devtools.webide.lastSelectedProject");
Services.prefs.clearUserPref("devtools.webide.lastConnectedRuntime");
});
-var openWebIDE = async function (autoInstallAddons) {
+var openWebIDE = async function(autoInstallAddons) {
info("opening WebIDE");
Services.prefs.setBoolPref("devtools.webide.autoinstallADBHelper", !!autoInstallAddons);
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
let win = ww.openWindow(null, "chrome://webide/content/", "webide", "chrome,centerscreen,resizable", null);
await new Promise(resolve => {
- win.addEventListener("load", function () {
+ win.addEventListener("load", function() {
SimpleTest.requestCompleteLog();
SimpleTest.executeSoon(resolve);
}, {once: true});
});
info("WebIDE open");
return win;
};
function closeWebIDE(win) {
info("Closing WebIDE");
return new Promise(resolve => {
- win.addEventListener("unload", function () {
+ win.addEventListener("unload", function() {
info("WebIDE closed");
SimpleTest.executeSoon(resolve);
}, {once: true});
win.close();
});
}
function removeAllProjects() {
- return (async function () {
+ return (async function() {
await AppProjects.load();
// use a new array so we're not iterating over the same
// underlying array that's being modified by AppProjects
let projects = AppProjects.projects.map(p => p.location);
for (let i = 0; i < projects.length; i++) {
await AppProjects.remove(projects[i]);
}
})();
@@ -122,49 +122,49 @@ function documentIsLoaded(doc) {
}
});
}
});
}
function lazyIframeIsLoaded(iframe) {
return new Promise(resolve => {
- iframe.addEventListener("load", function () {
+ iframe.addEventListener("load", function() {
resolve(nextTick());
}, {capture: true, once: true});
});
}
function addTab(aUrl, aWindow) {
info("Adding tab: " + aUrl);
return new Promise(resolve => {
let targetWindow = aWindow || window;
let targetBrowser = targetWindow.gBrowser;
targetWindow.focus();
let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
let linkedBrowser = tab.linkedBrowser;
- BrowserTestUtils.browserLoaded(linkedBrowser).then(function () {
+ BrowserTestUtils.browserLoaded(linkedBrowser).then(function() {
info("Tab added and finished loading: " + aUrl);
resolve(tab);
});
});
}
function removeTab(aTab, aWindow) {
info("Removing tab.");
return new Promise(resolve => {
let targetWindow = aWindow || window;
let targetBrowser = targetWindow.gBrowser;
let tabContainer = targetBrowser.tabContainer;
- tabContainer.addEventListener("TabClose", function (aEvent) {
+ tabContainer.addEventListener("TabClose", function(aEvent) {
info("Tab removed and finished closing.");
resolve();
}, {once: true});
targetBrowser.removeTab(aTab);
});
}
--- a/devtools/client/webide/test/test_addons.html
+++ b/devtools/client/webide/test/test_addons.html
@@ -28,47 +28,45 @@
nextTick().then(() => {
let li = doc.querySelector('[status="uninstalled"][addon="adb"]');
if (li) {
Devices.off("addon-status-updated", onUpdate);
resolve();
} else {
reject("Can't find item");
}
- })
+ });
});
let li = doc.querySelector('[status="installed"][addon="adb"]');
li.querySelector(".uninstall-button").click();
});
}
- (async function () {
-
+ (async function() {
ok(!Devices.helperAddonInstalled, "Helper not installed");
let win = await openWebIDE(true);
let docRuntime = getRuntimeDocument(win);
ok(Devices.helperAddonInstalled, "Helper has been auto-installed");
await nextTick();
let w = addonDoc.querySelector(".warning");
- let display = addonDoc.defaultView.getComputedStyle(w).display
+ let display = addonDoc.defaultView.getComputedStyle(w).display;
is(display, "none", "Warning about missing ADB hidden");
await uninstallADBFromUI(addonDoc, "adb");
items = panelNode.querySelectorAll(".runtime-panel-item-usb");
is(items.length, 0, "No usb runtime listed");
- display = addonDoc.defaultView.getComputedStyle(w).display
+ display = addonDoc.defaultView.getComputedStyle(w).display;
is(display, "block", "Warning about missing ADB present");
await closeWebIDE(win);
SimpleTest.finish();
-
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_app_validator.html
+++ b/devtools/client/webide/test/test_app_validator.html
@@ -29,19 +29,19 @@
window.onload = function() {
SimpleTest.waitForExplicitFinish();
httpserver = new HttpServer();
httpserver.start(-1);
origin = "http://localhost:" + httpserver.identity.primaryPort + "/";
next();
- }
+ };
- function createHosted(path, manifestFile="/manifest.webapp") {
+ function createHosted(path, manifestFile = "/manifest.webapp") {
let dirPath = getTestFilePath("validator/" + path);
httpserver.registerDirectory("/", nsFile(dirPath));
return new AppValidator({
type: "hosted",
location: origin + manifestFile
});
}
@@ -53,123 +53,123 @@
});
}
function next() {
let test = tests.shift();
if (test) {
try {
test();
- } catch(e) {
+ } catch (e) {
console.error("exception", String(e), e, e.stack);
}
} else {
httpserver.stop(function() {
SimpleTest.finish();
});
}
}
let tests = [
// Test a 100% valid example
- function () {
+ function() {
let validator = createHosted("valid");
validator.validate().then(() => {
- is(validator.errors.length, 0, "valid app got no error");
- is(validator.warnings.length, 0, "valid app got no warning");
+ is(validator.errors.length, 0, "valid app got no error");
+ is(validator.warnings.length, 0, "valid app got no warning");
- next();
- });
+ next();
+ });
},
- function () {
+ function() {
let validator = createPackaged("valid");
validator.validate().then(() => {
- is(validator.errors.length, 0, "valid packaged app got no error");
- is(validator.warnings.length, 0, "valid packaged app got no warning");
+ is(validator.errors.length, 0, "valid packaged app got no error");
+ is(validator.warnings.length, 0, "valid packaged app got no warning");
- next();
- });
+ next();
+ });
},
// Test a launch path that returns a 404
- function () {
+ function() {
let validator = createHosted("wrong-launch-path");
validator.validate().then(() => {
- is(validator.errors.length, 1, "app with non-existant launch path got an error");
- is(validator.errors[0], strings.formatStringFromName("validator.accessFailedLaunchPathBadHttpCode", [origin + "wrong-path.html", 404], 2),
+ is(validator.errors.length, 1, "app with non-existant launch path got an error");
+ is(validator.errors[0], strings.formatStringFromName("validator.accessFailedLaunchPathBadHttpCode", [origin + "wrong-path.html", 404], 2),
"with the right error message");
- is(validator.warnings.length, 0, "but no warning");
- next();
- });
+ is(validator.warnings.length, 0, "but no warning");
+ next();
+ });
},
- function () {
+ function() {
let validator = createPackaged("wrong-launch-path");
validator.validate().then(() => {
- is(validator.errors.length, 1, "app with wrong path got an error");
- let file = nsFile(validator.location);
- file.append("wrong-path.html");
- let url = Services.io.newFileURI(file);
- is(validator.errors[0], strings.formatStringFromName("validator.accessFailedLaunchPath", [url.spec], 1),
+ is(validator.errors.length, 1, "app with wrong path got an error");
+ let file = nsFile(validator.location);
+ file.append("wrong-path.html");
+ let url = Services.io.newFileURI(file);
+ is(validator.errors[0], strings.formatStringFromName("validator.accessFailedLaunchPath", [url.spec], 1),
"with the expected message");
- is(validator.warnings.length, 0, "but no warning");
+ is(validator.warnings.length, 0, "but no warning");
- next();
- });
+ next();
+ });
},
// Test when using a non-absolute path for launch_path
- function () {
+ function() {
let validator = createHosted("non-absolute-path");
validator.validate().then(() => {
- is(validator.errors.length, 1, "app with non absolute path got an error");
- is(validator.errors[0], strings.formatStringFromName("validator.nonAbsoluteLaunchPath", ["non-absolute.html"], 1),
+ is(validator.errors.length, 1, "app with non absolute path got an error");
+ is(validator.errors[0], strings.formatStringFromName("validator.nonAbsoluteLaunchPath", ["non-absolute.html"], 1),
"with expected message");
- is(validator.warnings.length, 0, "but no warning");
- next();
- });
+ is(validator.warnings.length, 0, "but no warning");
+ next();
+ });
},
- function () {
+ function() {
let validator = createPackaged("non-absolute-path");
validator.validate().then(() => {
- is(validator.errors.length, 1, "app with non absolute path got an error");
- is(validator.errors[0], strings.formatStringFromName("validator.nonAbsoluteLaunchPath", ["non-absolute.html"], 1),
+ is(validator.errors.length, 1, "app with non absolute path got an error");
+ is(validator.errors[0], strings.formatStringFromName("validator.nonAbsoluteLaunchPath", ["non-absolute.html"], 1),
"with expected message");
- is(validator.warnings.length, 0, "but no warning");
- next();
- });
+ is(validator.warnings.length, 0, "but no warning");
+ next();
+ });
},
// Test multiple failures (missing name [error] and icon [warning])
- function () {
+ function() {
let validator = createHosted("no-name-or-icon");
validator.validate().then(() => {
checkNoNameOrIcon(validator);
});
},
- function () {
+ function() {
let validator = createPackaged("no-name-or-icon");
validator.validate().then(() => {
checkNoNameOrIcon(validator);
});
},
// Test a regular URL instead of a direct link to the manifest
- function () {
+ function() {
let validator = createHosted("valid", "/");
validator.validate().then(() => {
is(validator.warnings.length, 0, "manifest found got no warning");
is(validator.errors.length, 0, "manifest found got no error");
next();
});
},
// Test finding a manifest at origin's root
- function () {
+ function() {
let validator = createHosted("valid", "/unexisting-dir");
validator.validate().then(() => {
is(validator.warnings.length, 0, "manifest found at origin root got no warning");
is(validator.errors.length, 0, "manifest found at origin root got no error");
next();
});
},
--- a/devtools/client/webide/test/test_autoconnect_runtime.html
+++ b/devtools/client/webide/test/test_autoconnect_runtime.html
@@ -13,17 +13,17 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = await openWebIDE();
let docRuntime = getRuntimeDocument(win);
let fakeRuntime = {
type: "USB",
@@ -81,12 +81,12 @@
await win.Cmds.disconnectRuntime();
await closeWebIDE(win);
DebuggerServer.destroy();
SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_autoselect_project.html
+++ b/devtools/client/webide/test/test_autoselect_project.html
@@ -13,17 +13,17 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = await openWebIDE();
let docRuntime = getRuntimeDocument(win);
let docProject = getProjectDocument(win);
let panelNode = docRuntime.querySelector("#runtime-panel");
@@ -97,12 +97,12 @@
await win.Cmds.disconnectRuntime();
await closeWebIDE(win);
DebuggerServer.destroy();
SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_basic.html
+++ b/devtools/client/webide/test/test_basic.html
@@ -13,44 +13,44 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
- let win = await openWebIDE();
+ (async function() {
+ let win = await openWebIDE();
- const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
- await gDevToolsBrowser.isWebIDEInitialized.promise;
- ok(true, "WebIDE was initialized");
+ const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
+ await gDevToolsBrowser.isWebIDEInitialized.promise;
+ ok(true, "WebIDE was initialized");
- ok(win, "Found a window");
- ok(win.AppManager, "App Manager accessible");
- let appmgr = win.AppManager;
- ok(appmgr.connection, "App Manager connection ready");
- ok(appmgr.runtimeList, "Runtime list ready");
+ ok(win, "Found a window");
+ ok(win.AppManager, "App Manager accessible");
+ let appmgr = win.AppManager;
+ ok(appmgr.connection, "App Manager connection ready");
+ ok(appmgr.runtimeList, "Runtime list ready");
// test error reporting
- let nbox = win.document.querySelector("#notificationbox");
- let notification = nbox.getNotificationWithValue("webide:errornotification");
- ok(!notification, "No notification yet");
- let deferred = new Promise((resolve, reject) => {
- nextTick().then(() => {
- reject("BOOM!");
- });
+ let nbox = win.document.querySelector("#notificationbox");
+ let notification = nbox.getNotificationWithValue("webide:errornotification");
+ ok(!notification, "No notification yet");
+ let deferred = new Promise((resolve, reject) => {
+ nextTick().then(() => {
+ reject("BOOM!");
});
- try {
- await win.UI.busyUntil(deferred, "xx");
- } catch(e) {/* This *will* fail */}
- notification = nbox.getNotificationWithValue("webide:errornotification");
- ok(notification, "Error has been reported");
+ });
+ try {
+ await win.UI.busyUntil(deferred, "xx");
+ } catch (e) { /* This *will* fail */ }
+ notification = nbox.getNotificationWithValue("webide:errornotification");
+ ok(notification, "Error has been reported");
- await closeWebIDE(win);
+ await closeWebIDE(win);
- SimpleTest.finish();
+ SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_device_preferences.html
+++ b/devtools/client/webide/test/test_device_preferences.html
@@ -13,17 +13,17 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = await openWebIDE();
let prefIframe = win.document.querySelector("#deck-panel-devicepreferences");
let docRuntime = getRuntimeDocument(win);
@@ -74,12 +74,12 @@
await closeWebIDE(win);
SimpleTest.finish();
})().catch(e => {
ok(false, "Exception: " + e);
SimpleTest.finish();
});
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_device_runtime.html
+++ b/devtools/client/webide/test/test_device_runtime.html
@@ -13,17 +13,17 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = await openWebIDE();
let detailsIframe = win.document.querySelector("#deck-panel-runtimedetails");
await connectToLocalRuntime(win);
@@ -46,17 +46,17 @@
// 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");
+ 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");
@@ -68,12 +68,12 @@
await closeWebIDE(win);
SimpleTest.finish();
})().catch(e => {
ok(false, "Exception: " + e);
SimpleTest.finish();
});
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_duplicate_import.html
+++ b/devtools/client/webide/test/test_duplicate_import.html
@@ -12,17 +12,17 @@
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
let win = await openWebIDE();
let docProject = getProjectDocument(win);
let winProject = getProjectWindow(win);
let packagedAppLocation = getTestFilePath("app");
let hostedAppManifest = TEST_BASE + "hosted_app.manifest";
await win.AppProjects.load();
is(win.AppProjects.projects.length, 0, "IDB is empty");
@@ -65,13 +65,13 @@
await removeAllProjects();
SimpleTest.finish();
})().catch(e => {
ok(false, "Exception: " + e);
SimpleTest.finish();
});
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_fullscreenToolbox.html
+++ b/devtools/client/webide/test/test_fullscreenToolbox.html
@@ -22,17 +22,17 @@
resolve);
docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
});
}
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
let win = await openWebIDE();
let docProject = getProjectDocument(win);
let docRuntime = getRuntimeDocument(win);
win.AppManager.update("runtime-list");
connectToLocal(win, docRuntime);
// Select main process
@@ -56,12 +56,12 @@
await win.Cmds.disconnectRuntime();
await closeWebIDE(win);
DebuggerServer.destroy();
SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_import.html
+++ b/devtools/client/webide/test/test_import.html
@@ -12,17 +12,17 @@
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
let win = await openWebIDE();
let docProject = getProjectDocument(win);
let winProject = getProjectWindow(win);
let packagedAppLocation = getTestFilePath("app");
await win.AppProjects.load();
is(win.AppProjects.projects.length, 0, "IDB is empty");
@@ -53,17 +53,17 @@
await nextTick();
hostedAppManifest = TEST_BASE + "/app";
await winProject.projectList.importHostedApp(hostedAppManifest);
await waitForUpdate(win, "project-validated");
project = win.AppManager.selectedProject;
- ok(project.location.endsWith('manifest.webapp'), "The manifest was found and the project was updated");
+ ok(project.location.endsWith("manifest.webapp"), "The manifest was found and the project was updated");
let panelNode = docProject.querySelector("#project-panel");
let items = panelNode.querySelectorAll(".panel-item");
// 4 controls, + 2 projects
is(items.length, 6, "6 projects in panel");
is(items[3].querySelector("span").textContent, "A name (in app directory)", "Panel text is correct");
is(items[4].querySelector("span").textContent, "hosted manifest name property", "Panel text is correct");
@@ -71,12 +71,12 @@
await removeAllProjects();
SimpleTest.finish();
})().catch(e => {
ok(false, "Exception: " + e);
SimpleTest.finish();
});
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_manifestUpdate.html
+++ b/devtools/client/webide/test/test_manifestUpdate.html
@@ -15,84 +15,84 @@
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
let {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm", {});
- (async function () {
- let win = await openWebIDE();
- let winProject = getProjectWindow(win);
- let AppManager = win.AppManager;
+ (async function() {
+ let win = await openWebIDE();
+ let winProject = getProjectWindow(win);
+ let AppManager = win.AppManager;
- function isProjectMarkedAsValid() {
- let details = win.frames[1];
- return !details.document.body.classList.contains("error");
- }
+ function isProjectMarkedAsValid() {
+ let details = win.frames[1];
+ return !details.document.body.classList.contains("error");
+ }
- let packagedAppLocation = getTestFilePath("app");
+ let packagedAppLocation = getTestFilePath("app");
- let onValidated = waitForUpdate(win, "project-validated");
- let onDetails = waitForUpdate(win, "details");
- await winProject.projectList.importPackagedApp(packagedAppLocation);
- await onValidated;
- await onDetails;
+ let onValidated = waitForUpdate(win, "project-validated");
+ let onDetails = waitForUpdate(win, "details");
+ await winProject.projectList.importPackagedApp(packagedAppLocation);
+ await onValidated;
+ await onDetails;
- let project = win.AppManager.selectedProject;
+ let project = win.AppManager.selectedProject;
- ok("name" in project.manifest, "manifest includes name");
- is(project.name, project.manifest.name, "Display name uses manifest name");
- ok(isProjectMarkedAsValid(), "project is marked as valid");
+ ok("name" in project.manifest, "manifest includes name");
+ is(project.name, project.manifest.name, "Display name uses manifest name");
+ ok(isProjectMarkedAsValid(), "project is marked as valid");
// Change the name
- let originalName = project.manifest.name;
+ let originalName = project.manifest.name;
- project.manifest.name = "xxx";
+ project.manifest.name = "xxx";
// Write to disk
- await AppManager.writeManifest(project);
+ await AppManager.writeManifest(project);
// Read file
- let manifestPath = OS.Path.join(packagedAppLocation, "manifest.webapp");
- let Decoder = new TextDecoder();
- let data = await OS.File.read(manifestPath);
- data = new TextDecoder().decode(data);
- let json = JSON.parse(data);
- is(json.name, "xxx", "manifest written on disc");
+ let manifestPath = OS.Path.join(packagedAppLocation, "manifest.webapp");
+ let Decoder = new TextDecoder();
+ let data = await OS.File.read(manifestPath);
+ data = new TextDecoder().decode(data);
+ let json = JSON.parse(data);
+ is(json.name, "xxx", "manifest written on disc");
// Make the manifest invalid on disk
- delete json.name;
- let Encoder = new TextEncoder();
- data = Encoder.encode(JSON.stringify(json));
- await OS.File.writeAtomic(manifestPath, data , {tmpPath: manifestPath + ".tmp"});
+ delete json.name;
+ let Encoder = new TextEncoder();
+ data = Encoder.encode(JSON.stringify(json));
+ await OS.File.writeAtomic(manifestPath, data, {tmpPath: manifestPath + ".tmp"});
// Trigger validation
- await AppManager.validateAndUpdateProject(AppManager.selectedProject);
- await nextTick();
+ await AppManager.validateAndUpdateProject(AppManager.selectedProject);
+ await nextTick();
- ok(!("name" in project.manifest), "manifest has been updated");
- is(project.name, "--", "Placeholder is used for display name");
- ok(!isProjectMarkedAsValid(), "project is marked as invalid");
+ ok(!("name" in project.manifest), "manifest has been updated");
+ is(project.name, "--", "Placeholder is used for display name");
+ ok(!isProjectMarkedAsValid(), "project is marked as invalid");
// Make the manifest valid on disk
- project.manifest.name = originalName;
- await AppManager.writeManifest(project);
+ project.manifest.name = originalName;
+ await AppManager.writeManifest(project);
// Trigger validation
- await AppManager.validateAndUpdateProject(AppManager.selectedProject);
- await nextTick();
+ await AppManager.validateAndUpdateProject(AppManager.selectedProject);
+ await nextTick();
- ok("name" in project.manifest, "manifest includes name");
- is(project.name, originalName, "Display name uses original manifest name");
- ok(isProjectMarkedAsValid(), "project is marked as valid");
+ ok("name" in project.manifest, "manifest includes name");
+ is(project.name, originalName, "Display name uses original manifest name");
+ ok(isProjectMarkedAsValid(), "project is marked as valid");
- await closeWebIDE(win);
+ await closeWebIDE(win);
- await removeAllProjects();
+ await removeAllProjects();
- SimpleTest.finish();
+ SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_newapp.html
+++ b/devtools/client/webide/test/test_newapp.html
@@ -13,17 +13,17 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
+ (async function() {
let win = await openWebIDE();
let winProject = getProjectWindow(win);
let tmpDir = FileUtils.getDir("TmpD", []);
await winProject.projectList.newApp({
index: 0,
name: "webideTmpApp",
folder: tmpDir
});
@@ -35,12 +35,12 @@
is(project.name, "webideTmpApp", "name field has been updated");
// Clean up
tmpDir.remove(true);
await closeWebIDE(win);
await removeAllProjects();
SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_runtime.html
+++ b/devtools/client/webide/test/test_runtime.html
@@ -16,26 +16,26 @@
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
let win;
SimpleTest.registerCleanupFunction(() => {
- (async function () {
+ (async function() {
if (win) {
await closeWebIDE(win);
}
DebuggerServer.destroy();
await removeAllProjects();
})();
});
- (async function () {
+ (async function() {
function isPlayActive() {
return !win.document.querySelector("#cmd_play").hasAttribute("disabled");
}
function isStopActive() {
return !win.document.querySelector("#cmd_stop").hasAttribute("disabled");
}
@@ -187,12 +187,12 @@
setTimeout(() => {
resolve();
}, 1000);
});
SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_toolbox.html
+++ b/devtools/client/webide/test/test_toolbox.html
@@ -16,37 +16,37 @@
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
let win;
SimpleTest.registerCleanupFunction(() => {
- (async function () {
+ (async function() {
if (win) {
await closeWebIDE(win);
}
DebuggerServer.destroy();
await removeAllProjects();
})();
});
- (async function () {
+ (async function() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
win = await openWebIDE();
let docRuntime = getRuntimeDocument(win);
let docProject = getProjectDocument(win);
win.AppManager.update("runtime-list");
let deferred = new Promise(resolve => {
- win.AppManager.connection.once(
+ win.AppManager.connection.once(
win.Connection.Events.CONNECTED,
resolve);
});
docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
await win.UI._busyPromise;
@@ -81,12 +81,12 @@
await win.UI.destroyToolbox();
ok(!win.UI.toolboxPromise, "Toolbox promise is also nullified the second times");
await win.Cmds.disconnectRuntime();
SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_zoom.html
+++ b/devtools/client/webide/test/test_zoom.html
@@ -13,65 +13,65 @@
</head>
<body>
<script type="application/javascript">
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- (async function () {
- let win = await openWebIDE();
- let viewer = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ (async function() {
+ let win = await openWebIDE();
+ let viewer = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.contentViewer;
- win.Cmds.zoomOut();
- win.Cmds.zoomOut();
- win.Cmds.zoomOut();
- win.Cmds.zoomOut();
- win.Cmds.zoomOut();
- win.Cmds.zoomOut();
- win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
+ win.Cmds.zoomOut();
- let roundZoom = Math.round(10 * viewer.fullZoom) / 10;
- is(roundZoom, 0.6, "Reach min zoom");
+ let roundZoom = Math.round(10 * viewer.fullZoom) / 10;
+ is(roundZoom, 0.6, "Reach min zoom");
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
- win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
+ win.Cmds.zoomIn();
- roundZoom = Math.round(10 * viewer.fullZoom) / 10;
- is(roundZoom, 1.4, "Reach max zoom");
+ roundZoom = Math.round(10 * viewer.fullZoom) / 10;
+ is(roundZoom, 1.4, "Reach max zoom");
- await closeWebIDE(win);
+ await closeWebIDE(win);
- win = await openWebIDE();
- viewer = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ win = await openWebIDE();
+ viewer = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.contentViewer;
- roundZoom = Math.round(10 * viewer.fullZoom) / 10;
- is(roundZoom, 1.4, "Zoom restored");
+ roundZoom = Math.round(10 * viewer.fullZoom) / 10;
+ is(roundZoom, 1.4, "Zoom restored");
- win.Cmds.resetZoom();
+ win.Cmds.resetZoom();
- is(viewer.fullZoom, 1, "Zoom reset");
+ is(viewer.fullZoom, 1, "Zoom reset");
- await closeWebIDE(win);
+ await closeWebIDE(win);
- SimpleTest.finish();
+ SimpleTest.finish();
})();
- }
+ };
</script>
</body>
</html>