--- a/.eslintignore
+++ b/.eslintignore
@@ -111,44 +111,41 @@ devtools/client/shared/components/test/m
devtools/client/shared/shim/test/test_*.html
devtools/client/shared/test/browser_toolbar_webconsole_errors_count.html
devtools/client/storage/test/*.html
!devtools/client/storage/test/storage-cookies.html
!devtools/client/storage/test/storage-overflow.html
!devtools/client/storage/test/storage-search.html
!devtools/client/storage/test/storage-unsecured-iframe.html
!devtools/client/storage/test/storage-unsecured-iframe-usercontextid.html
-devtools/client/webaudioeditor/**
-devtools/client/webconsole/old/net/**
-!devtools/client/webconsole/test/mochitest/**
-devtools/client/webconsole/old/test/**
-devtools/client/webconsole/old/webconsole.js
-devtools/client/webide/**
-!devtools/client/webide/components/webideCli.js
devtools/server/tests/browser/storage-*.html
!devtools/server/tests/browser/storage-unsecured-iframe.html
devtools/server/tests/browser/stylesheets-nested-iframes.html
-devtools/server/tests/unit/xpcshell_debugging_script.js
devtools/client/shared/webpack/shims/test/test_clipboard.html
devtools/shared/qrcode/tests/mochitest/test_decode.html
devtools/shared/tests/mochitest/*.html
devtools/shared/webconsole/test/test_*.html
# Soon to be removed
devtools/client/commandline/**
# Soon to be removed, the new/ directory is explicitly excluded below due to
# also being an imported repository.
devtools/client/debugger/**
+# Soon to be removed
+devtools/client/webconsole/old/net/**
+devtools/client/webconsole/old/test/**
+devtools/client/webconsole/old/webconsole.js
# Ignore devtools imported repositories
devtools/client/debugger/new/**
devtools/client/shared/components/reps/**
# Ignore devtools preferences files
devtools/client/preferences/**
+devtools/client/webide/preferences/**
devtools/shared/preferences/**
devtools/startup/preferences/devtools-startup.js
# Ignore devtools third-party libs
devtools/shared/jsbeautify/*
devtools/shared/acorn/*
devtools/shared/gcli/source/*
devtools/shared/node-properties/*
@@ -175,16 +172,19 @@ devtools/client/framework/test/code_*
devtools/client/inspector/markup/test/events_bundle.js
devtools/client/netmonitor/test/xhr_bundle.js
devtools/client/webconsole/test/mochitest/code_bundle_nosource.js
devtools/client/webconsole/test/mochitest/code_bundle_invalidmap.js
devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js
devtools/server/tests/unit/setBreakpoint*
devtools/server/tests/unit/sourcemapped.js
+# devtools specific format test file
+devtools/server/tests/unit/xpcshell_debugging_script.js
+
# dom/ exclusions
dom/abort/**
dom/animation/**
dom/archivereader/**
dom/asmjscache/**
dom/audiochannel/**
dom/base/**
dom/battery/**
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -42,35 +42,38 @@ module.exports = {
"camelcase": "off",
}
}, {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
+ "client/webide/**",
],
"rules": {
"consistent-return": "off",
}
}, {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/AppCacheUtils.jsm",
+ "client/webide/**",
],
"rules": {
"max-nested-callbacks": "off",
}
}, {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
+ "client/webide/**",
],
"rules": {
"max-len": "off",
}
}, {
"files": [
"client/scratchpad/test/browser_scratchpad_inspect.js",
"client/scratchpad/test/browser_scratchpad_inspect_primitives.js",
@@ -79,16 +82,17 @@ module.exports = {
"no-labels": "off",
}
}, {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/*.jsm",
"client/shared/widgets/*.jsm",
+ "client/webide/**",
],
"rules": {
"mozilla/no-aArgs": "off",
}
}, {
"files": [
"client/framework/test/**",
"client/scratchpad/**",
@@ -97,46 +101,53 @@ module.exports = {
"mozilla/var-only-at-top-level": "off",
}
}, {
"files": [
"client/framework/**",
"client/scratchpad/**",
"client/shared/AppCacheUtils.jsm",
"client/shared/widgets/*.jsm",
+ "client/webide/**",
],
"rules": {
"no-shadow": "off",
}
}, {
"files": [
"client/framework/**",
"client/scratchpad/**",
+ "client/webide/**",
],
"rules": {
"strict": "off",
}
}, {
"files": [
// Note: Bug 1403938 may be removing canvasdebugger, check before
// doing more work on enabling these rules.
"client/canvasdebugger/**",
// Note: Bug 1342237 may be removing shadereditor, check before
// doing more work on enabling these rules.
"client/shadereditor/**",
+ // Note: Bug 1403944 may be removing webaudioeditor, check before
+ // doing more work on enabling these rules.
+ "client/webaudioeditor/**",
],
"rules": {
"consistent-return": "off",
"max-len": "off",
"mozilla/no-aArgs": "off",
"mozilla/var-only-at-top-level": "off",
+ "no-redeclare": "off",
"no-return-assign": "off",
"no-shadow": "off",
"no-undef": "off",
"no-unused-vars": "off",
+ "no-useless-call": "off",
"strict": "off",
}
}, {
// For all head*.js files, turn off no-unused-vars at a global level
"files": [
"**/head*.js",
],
"rules": {
--- a/devtools/client/webaudioeditor/models.js
+++ b/devtools/client/webaudioeditor/models.js
@@ -175,16 +175,17 @@ class AudioNodesCollection extends Event
* instance.
*
* Emits "add" event on instance when completed.
*
* @param Object obj
* @return AudioNodeModel
*/
add(obj) {
+ // eslint-disable-next-line new-cap
let node = new this.model(obj);
node.collection = this;
this.models.add(node);
node.on("*", this._onModelEvent);
EventEmitter.emit(this, "add", node);
return node;
--- a/devtools/client/webaudioeditor/test/browser_wa_properties-view-edit-01.js
+++ b/devtools/client/webaudioeditor/test/browser_wa_properties-view-edit-01.js
@@ -32,27 +32,27 @@ add_task(async function() {
checkVariableView(gVars, 0, {
"type": "sine",
"frequency": 440,
"detune": 0
}, "default loaded string");
click(panelWin, findGraphNode(panelWin, nodeIds[2]));
- await waitForInspectorRender(panelWin, EVENTS),
+ await waitForInspectorRender(panelWin, EVENTS);
checkVariableView(gVars, 0, {
"gain": 0
}, "default loaded number");
click(panelWin, findGraphNode(panelWin, nodeIds[1]));
- await waitForInspectorRender(panelWin, EVENTS),
+ await waitForInspectorRender(panelWin, EVENTS);
await setAndCheck(0, "type", "square", "square", "sets string as string");
click(panelWin, findGraphNode(panelWin, nodeIds[2]));
- await waitForInspectorRender(panelWin, EVENTS),
+ await waitForInspectorRender(panelWin, EVENTS);
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) {
--- a/devtools/client/webaudioeditor/test/doc_destroy-nodes.html
+++ b/devtools/client/webaudioeditor/test/doc_destroy-nodes.html
@@ -12,25 +12,25 @@
<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() {
- let ctx = new AudioContext();
- let osc = ctx.createOscillator();
- let gain = ctx.createGain();
+ let ctx = new AudioContext();
+ let osc = ctx.createOscillator();
+ let gain = ctx.createGain();
- for (let i = 0; i < 10; i++) {
- keepAlive.push(ctx.createBufferSource());
- }
+ for (let i = 0; i < 10; i++) {
+ keepAlive.push(ctx.createBufferSource());
+ }
- osc.connect(gain);
- gain.connect(ctx.destination);
- gain.gain.value = 0;
- osc.start();
+ osc.connect(gain);
+ gain.connect(ctx.destination);
+ gain.gain.value = 0;
+ osc.start();
})();
</script>
</body>
</html>
--- a/devtools/client/webaudioeditor/test/head.js
+++ b/devtools/client/webaudioeditor/test/head.js
@@ -113,17 +113,17 @@ function teardown(aTarget) {
//
// Takes a `front` object that is an event emitter, the number of
// programs that should be listened to and waited on, and an optional
// `onAdd` function that calls with the entire actors array on program link
function getN(front, eventName, count, spread) {
let actors = [];
info(`Waiting for ${count} ${eventName} events`);
- return new Promise((resolve, reject) => {
+ return new Promise((resolve) => {
front.on(eventName, function onEvent(...args) {
let actor = args[0];
if (actors.length !== count) {
actors.push(spread ? args : actor);
}
info(`Got ${actors.length} / ${count} ${eventName} events`);
if (actors.length === count) {
front.off(eventName, onEvent);
@@ -159,17 +159,17 @@ function getNSpread(front, eventName, co
* 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;
info(`Wait for graph rendered with ${nodeCount} nodes, ${edgeCount} edges`);
- return new Promise((resolve, reject) => {
+ return new Promise((resolve) => {
front.on(eventName, function onGraphRendered(nodes, edges, pEdges) {
let paramEdgesDone = paramEdgeCount != null ? paramEdgeCount === pEdges : true;
info(`Got graph rendered with ${nodes} / ${nodeCount} nodes, ` +
`${edges} / ${edgeCount} edges`);
if (nodes === nodeCount && edges === edgeCount && paramEdgesDone) {
front.off(eventName, onGraphRendered);
resolve();
}
--- a/devtools/client/webaudioeditor/views/inspector.js
+++ b/devtools/client/webaudioeditor/views/inspector.js
@@ -80,19 +80,18 @@ var InspectorView = {
this._currentNode = node || null;
// If no node selected, set the inspector back to "no AudioNode selected"
// view.
if (!node) {
$("#web-audio-editor-details-pane-empty").removeAttribute("hidden");
$("#web-audio-editor-tabs").setAttribute("hidden", "true");
window.emit(EVENTS.UI_INSPECTOR_NODE_SET, null);
- }
- // Otherwise load up the tabs view and hide the empty placeholder
- else {
+ } else {
+ // Otherwise load up the tabs view and hide the empty placeholder
$("#web-audio-editor-details-pane-empty").setAttribute("hidden", "true");
$("#web-audio-editor-tabs").removeAttribute("hidden");
this._buildToolbar();
window.emit(EVENTS.UI_INSPECTOR_NODE_SET, this._currentNode.id);
}
},
/**
--- a/devtools/client/webide/content/details.js
+++ b/devtools/client/webide/content/details.js
@@ -1,14 +1,13 @@
/* 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() {
document.addEventListener("visibilitychange", updateUI, true);
AppManager.on("app-manager-update", onAppManagerUpdate);
updateUI();
}, {capture: true, once: true});
@@ -112,11 +111,13 @@ function updateUI() {
li.textContent = w;
warningsNode.appendChild(li);
}
}
AppManager.update("details");
}
+// Used in details.xhtml.
+/* exported removeProject */
function removeProject() {
AppManager.removeSelectedProject();
}
--- a/devtools/client/webide/content/devicepreferences.js
+++ b/devtools/client/webide/content/devicepreferences.js
@@ -54,17 +54,19 @@ function CheckReset(event) {
function UpdateField(event) {
configView.updateField(event);
}
function SearchField(event) {
configView.search(event);
}
-var getAllPrefs; // Used by tests
+// Used by tests
+/* exported getAllPrefs */
+var getAllPrefs;
function BuildUI() {
configView.resetTable();
if (AppManager.connection &&
AppManager.connection.status == Connection.Status.CONNECTED &&
AppManager.preferenceFront) {
configView.front = AppManager.preferenceFront;
configView.kind = "Pref";
--- a/devtools/client/webide/content/newapp.js
+++ b/devtools/client/webide/content/newapp.js
@@ -1,16 +1,15 @@
/* 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 {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
-const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const Services = require("Services");
const {FileUtils} = require("resource://gre/modules/FileUtils.jsm");
const {AppProjects} = require("devtools/client/webide/modules/app-projects");
const {AppManager} = require("devtools/client/webide/modules/app-manager");
const {getJSON} = require("devtools/client/shared/getjson");
ChromeUtils.defineModuleGetter(this, "ZipUtils", "resource://gre/modules/ZipUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Downloads", "resource://gre/modules/Downloads.jsm");
@@ -62,18 +61,17 @@ function getTemplatesJSON() {
doOK();
}
}, (e) => {
failAndBail("Can't download app templates: " + e);
});
}
function failAndBail(msg) {
- let promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
- promptService.alert(window, "error", msg);
+ Services.prompt.alert(window, "error", msg);
window.close();
}
function canValidate() {
let projectNameNode = document.querySelector("#project-name");
let dialogNode = document.querySelector("dialog");
if (projectNameNode.value.length > 0) {
dialogNode.removeAttribute("buttondisabledaccept");
--- a/devtools/client/webide/content/project-panel.js
+++ b/devtools/client/webide/content/project-panel.js
@@ -1,11 +1,12 @@
/* 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/. */
+/* exported ProjectPanel */
var ProjectPanel = {
// TODO: Expand function to save toggle state.
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-panel.js
+++ b/devtools/client/webide/content/runtime-panel.js
@@ -1,11 +1,12 @@
/* 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/. */
+/* exported RuntimePanel */
var RuntimePanel = {
// TODO: Expand function to save toggle state.
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
@@ -47,17 +47,19 @@ function generateFields(json) {
tr.appendChild(td);
td = document.createElement("td");
td.textContent = json[name];
tr.appendChild(td);
table.appendChild(tr);
}
}
-var getDescriptionPromise; // Used by tests
+// Used by tests
+/* exported getDescriptionPromise */
+var getDescriptionPromise;
function BuildUI() {
let table = document.querySelector("table");
table.innerHTML = "";
if (AppManager.connection &&
AppManager.connection.status == Connection.Status.CONNECTED &&
AppManager.deviceFront) {
getDescriptionPromise = AppManager.deviceFront.getDescription()
.then(json => generateFields(json));
@@ -65,17 +67,16 @@ function BuildUI() {
CloseUI();
}
}
function CheckLockState() {
let adbCheckResult = document.querySelector("#adb-check > .yesno");
let devtoolsCheckResult = document.querySelector("#devtools-check > .yesno");
let flipCertPerfButton = document.querySelector("#devtools-check button");
- let adbRootButton = document.querySelector("#adb-check button");
let flipCertPerfAction = document.querySelector("#devtools-check > .action");
let adbRootAction = document.querySelector("#adb-check > .action");
let sYes = Strings.GetStringFromName("runtimedetails_checkyes");
let sNo = Strings.GetStringFromName("runtimedetails_checkno");
let sUnknown = Strings.GetStringFromName("runtimedetails_checkunknown");
let sNotUSB = Strings.GetStringFromName("runtimedetails_notUSBDevice");
--- a/devtools/client/webide/content/webide.js
+++ b/devtools/client/webide/content/webide.js
@@ -1,32 +1,34 @@
/* 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/. */
+// These files are loaded via webide.xul
+/* import-globals-from project-panel.js */
+/* import-globals-from runtime-panel.js */
+
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const {gDevTools} = require("devtools/client/framework/devtools");
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
const {Toolbox} = require("devtools/client/framework/toolbox");
const Services = require("Services");
const {AppProjects} = require("devtools/client/webide/modules/app-projects");
const {Connection} = require("devtools/shared/client/connection-manager");
const {AppManager} = require("devtools/client/webide/modules/app-manager");
const EventEmitter = require("devtools/shared/event-emitter");
const promise = require("promise");
const {GetAvailableAddons} = require("devtools/client/webide/modules/addons");
const {getJSON} = require("devtools/client/shared/getjson");
-const utils = require("devtools/client/webide/modules/utils");
const Telemetry = require("devtools/client/shared/telemetry");
const {RuntimeScanners} = require("devtools/client/webide/modules/runtimes");
const {showDoorhanger} = require("devtools/client/shared/doorhanger");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
-const HTML = "http://www.w3.org/1999/xhtml";
const HELP_URL = "https://developer.mozilla.org/docs/Tools/WebIDE/Troubleshooting";
const MAX_ZOOM = 1.4;
const MIN_ZOOM = 0.6;
[["AppManager", AppManager],
["AppProjects", AppProjects],
["Connection", Connection]].forEach(([key, value]) => {
@@ -430,17 +432,17 @@ var UI = {
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+):(.+)$/);
+ let [ , type, id] = this.lastConnectedRuntime.match(/^(\w+):(.+)$/);
type = type.toLowerCase();
// Local connection is mapped to AppManager.runtimeList.other array
if (type == "local") {
type = "other";
}
@@ -653,17 +655,17 @@ var UI = {
let pref = Services.prefs.getCharPref("devtools.webide.lastSelectedProject");
if (!pref) {
return;
}
let m = pref.match(/^(\w+):(.*)$/);
if (!m) {
return;
}
- let [_, type, project] = m;
+ let [ , type, project] = m;
if (type == "local") {
let lastProject = AppProjects.get(project);
if (lastProject) {
AppManager.selectedProject = lastProject;
}
}
--- a/devtools/client/webide/content/wifi-auth.js
+++ b/devtools/client/webide/content/wifi-auth.js
@@ -1,17 +1,16 @@
/* 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 { require } =
ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
-const Services = require("Services");
const QR = require("devtools/shared/qrcode/index");
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});
--- a/devtools/client/webide/modules/addons.js
+++ b/devtools/client/webide/modules/addons.js
@@ -1,17 +1,16 @@
/* 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 {AddonManager} = require("resource://gre/modules/AddonManager.jsm");
const Services = require("Services");
-const {getJSON} = require("devtools/client/shared/getjson");
const EventEmitter = require("devtools/shared/event-emitter");
var ADB_LINK = Services.prefs.getCharPref("devtools.webide.adbAddonURL");
var ADB_ADDON_ID = Services.prefs.getCharPref("devtools.webide.adbAddonID");
var platform = Services.appShell.hiddenDOMWindow.navigator.platform;
var OS = "";
if (platform.includes("Win")) {
--- a/devtools/client/webide/modules/app-manager.js
+++ b/devtools/client/webide/modules/app-manager.js
@@ -1,14 +1,12 @@
/* 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 {Cu} = require("chrome");
-
const {TargetFactory} = require("devtools/client/framework/target");
const Services = require("Services");
const {FileUtils} = require("resource://gre/modules/FileUtils.jsm");
const EventEmitter = require("devtools/shared/event-emitter");
const {OS} = require("resource://gre/modules/osfile.jsm");
const {AppProjects} = require("devtools/client/webide/modules/app-projects");
const TabStore = require("devtools/client/webide/modules/tab-store");
const {AppValidator} = require("devtools/client/webide/modules/app-validator");
@@ -574,18 +572,16 @@ var AppManager = exports.AppManager = {
// Validate project
await self.validateAndUpdateProject(project);
if (project.errorsCount > 0) {
self.reportError("error_cantInstallValidationErrors");
return;
}
- let installPromise;
-
if (project.type != "packaged" && project.type != "hosted") {
return Promise.reject("Don't know how to install project");
}
let response;
if (project.type == "packaged") {
let packageDir = project.location;
console.log("Installing app from " + packageDir);
--- a/devtools/client/webide/modules/app-projects.js
+++ b/devtools/client/webide/modules/app-projects.js
@@ -1,13 +1,13 @@
/* 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 {Cc, Ci, Cu, Cr} = require("chrome");
+const {Cc, Ci, Cr} = require("chrome");
const EventEmitter = require("devtools/shared/event-emitter");
const {generateUUID} = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
const {FileUtils} = require("resource://gre/modules/FileUtils.jsm");
/**
* IndexedDB wrapper that just save project objects
*
@@ -95,19 +95,19 @@ const IDB = {
resolve();
};
}
});
},
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);
+ let transaction = IDB._db.transaction(["projects"], "readwrite");
+ let objectStore = transaction.objectStore("projects");
+ let request = objectStore.put(project);
request.onerror = function(event) {
reject("Unable to update project to the AppProjects indexedDB: " +
this.error.name + " - " + this.error.message);
};
request.onsuccess = function() {
resolve();
};
});
--- a/devtools/client/webide/modules/app-validator.js
+++ b/devtools/client/webide/modules/app-validator.js
@@ -1,14 +1,14 @@
/* 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";
-var {Ci, Cu} = require("chrome");
+var {Ci} = require("chrome");
const {FileUtils} = require("resource://gre/modules/FileUtils.jsm");
const Services = require("Services");
var strings = Services.strings.createBundle("chrome://devtools/locale/app-manager.properties");
function AppValidator({ type, location }) {
this.type = type;
this.location = location;
--- a/devtools/client/webide/modules/config-view.js
+++ b/devtools/client/webide/modules/config-view.js
@@ -1,14 +1,12 @@
/* 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 {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) {
EventEmitter.decorate(this);
@@ -71,17 +69,17 @@ ConfigView.prototype = {
let row = this._doc.getElementById("row-" + key);
if (key.match(stringMatch)) {
row.classList.remove("hide");
} else if (row) {
row.classList.add("hide");
}
}
} else {
- var trs = this._doc.getElementById("device-fields").querySelectorAll("tr");
+ let trs = this._doc.getElementById("device-fields").querySelectorAll("tr");
for (let i = 0; i < trs.length; i++) {
trs[i].classList.remove("hide");
}
}
},
generateDisplay: function(json) {
@@ -159,17 +157,17 @@ ConfigView.prototype = {
table.appendChild(tr);
}
},
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++) {
+ for (let i = 0; i < trs.length; i++) {
table.removeChild(trs[i]);
}
return table;
},
_getCallType: function(type, name) {
let frontName = "get";
@@ -294,29 +292,26 @@ ConfigView.prototype = {
this._resetToDefault(btnId, input, event.target);
}
},
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;
}
switch (customValueType) {
case "boolean":
customTextEl.type = "checkbox";
- customText = customTextEl.checked;
break;
case "number":
- customText = parseInt(customText, 10) || 0;
customTextEl.type = "number";
break;
default:
customTextEl.type = "text";
break;
}
return customValueType;
--- a/devtools/client/webide/modules/project-list.js
+++ b/devtools/client/webide/modules/project-list.js
@@ -1,14 +1,12 @@
/* 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 {Cu} = require("chrome");
-
const Services = require("Services");
const {AppProjects} = require("devtools/client/webide/modules/app-projects");
const {AppManager} = require("devtools/client/webide/modules/app-manager");
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");
@@ -200,17 +198,17 @@ ProjectList.prototype = {
return Promise.resolve();
},
updateApps: function() {
let doc = this._doc;
let runtimeappsHeaderNode = doc.querySelector("#panel-header-runtimeapps");
let sortedApps = [];
- for (let [manifestURL, app] of AppManager.apps) {
+ for (let [/* manifestURL */, app] of AppManager.apps) {
sortedApps.push(app);
}
sortedApps = sortedApps.sort((a, b) => {
return a.manifest.name > b.manifest.name;
});
let mainProcess = AppManager.isMainProcessDebuggable();
if (AppManager.connected && (sortedApps.length > 0 || mainProcess)) {
runtimeappsHeaderNode.removeAttribute("hidden");
--- a/devtools/client/webide/modules/runtime-list.js
+++ b/devtools/client/webide/modules/runtime-list.js
@@ -1,22 +1,18 @@
/* 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 = require("Services");
const {AppManager} = require("devtools/client/webide/modules/app-manager");
const EventEmitter = require("devtools/shared/event-emitter");
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) {
EventEmitter.decorate(this);
this._doc = window.document;
this._UI = parentWindow.UI;
this._Cmds = parentWindow.Cmds;
--- a/devtools/client/webide/modules/runtimes.js
+++ b/devtools/client/webide/modules/runtimes.js
@@ -2,17 +2,16 @@
* 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 {Ci} = require("chrome");
const Services = require("Services");
const {Devices} = require("resource://devtools/shared/apps/Devices.jsm");
-const {Connection} = require("devtools/shared/client/connection-manager");
const {DebuggerServer} = require("devtools/server/main");
const discovery = require("devtools/shared/discovery/discovery");
const EventEmitter = require("devtools/shared/event-emitter");
const promise = require("promise");
loader.lazyRequireGetter(this, "AuthenticationResult",
"devtools/shared/security/auth", true);
loader.lazyRequireGetter(this, "DevToolsUtils",
"devtools/shared/DevToolsUtils");
--- a/devtools/client/webide/modules/tab-store.js
+++ b/devtools/client/webide/modules/tab-store.js
@@ -1,14 +1,12 @@
/* 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 { 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;
--- a/devtools/client/webide/modules/utils.js
+++ b/devtools/client/webide/modules/utils.js
@@ -1,13 +1,13 @@
/* 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 { Cc, Cu, Ci } = require("chrome");
+const { Cc, Ci } = require("chrome");
const { FileUtils } = require("resource://gre/modules/FileUtils.jsm");
const Services = require("Services");
const Strings = Services.strings.createBundle("chrome://devtools/locale/webide.properties");
function doesFileExist(location) {
let file = new FileUtils.File(location);
return file.exists();
}
--- a/devtools/client/webide/test/browser_tabs.js
+++ b/devtools/client/webide/test/browser_tabs.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URI = "http://example.com/browser/devtools/client/webide/test/doc_tabs.html";
function test() {
waitForExplicitFinish();
- requestCompleteLog();
+ SimpleTest.requestCompleteLog();
(async function() {
// Since we test the connections set below, destroy the server in case it
// was left open.
DebuggerServer.destroy();
DebuggerServer.init();
DebuggerServer.registerAllActors();
--- a/devtools/client/webide/test/device_front_shared.js
+++ b/devtools/client/webide/test/device_front_shared.js
@@ -1,11 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
+/* eslint no-unused-vars: ["error", {"args": "none", "vars": "local"}] */
+
"use strict";
var customName;
var customValue;
var customValueType;
var customBtn;
var newField;
var change;
@@ -166,17 +168,17 @@ function addNewFieldBoolean() {
if (newField) {
found = true;
is(newField.type, "checkbox", "Custom type is a checkbox");
is(newField.checked, true, "Custom boolean value is correctly true");
}
ok(found, "Found new boolean field line");
// Mouse event trigger
- var mouseClick = new MouseEvent("click", {
+ let mouseClick = new MouseEvent("click", {
canBubble: true,
cancelable: true,
view: doc.parent,
});
found = false;
customValueType.value = "boolean";
customValueType.dispatchEvent(change);
--- a/devtools/client/webide/test/head.js
+++ b/devtools/client/webide/test/head.js
@@ -39,18 +39,18 @@ registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.webide.lastConnectedRuntime");
});
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);
+ let win = Services.ww.openWindow(null, "chrome://webide/content/", "webide",
+ "chrome,centerscreen,resizable", null);
await new Promise(resolve => {
win.addEventListener("load", function() {
SimpleTest.requestCompleteLog();
SimpleTest.executeSoon(resolve);
}, {once: true});
});
--- a/devtools/client/webide/test/test_addons.html
+++ b/devtools/client/webide/test/test_addons.html
@@ -10,22 +10,23 @@
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
<script type="application/javascript" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<script type="application/javascript">
+ // XXX Bug 1072167 - When updating after migration, fix the no-undef issues.
+ /* eslint-disable no-undef */
+
window.onload = function() {
SimpleTest.waitForExplicitFinish();
- const {Devices} = ChromeUtils.import("resource://devtools/shared/apps/Devices.jsm");
-
- let adbAddonsInstalled;
+ const {Devices} = ChromeUtils.import("resource://devtools/shared/apps/Devices.jsm", {});
function uninstallADBFromUI(doc) {
return new Promise((resolve, reject) => {
Devices.on("addon-status-updated", function onUpdate() {
nextTick().then(() => {
let li = doc.querySelector('[status="uninstalled"][addon="adb"]');
if (li) {
Devices.off("addon-status-updated", onUpdate);
@@ -39,17 +40,16 @@
li.querySelector(".uninstall-button").click();
});
}
(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;
is(display, "none", "Warning about missing ADB hidden");
--- a/devtools/client/webide/test/test_app_validator.html
+++ b/devtools/client/webide/test/test_app_validator.html
@@ -16,37 +16,35 @@
<script type="application/javascript">
ChromeUtils.import("resource://testing-common/httpd.js");
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const {AppValidator} = require("devtools/client/webide/modules/app-validator");
const Services = require("Services");
const nsFile = Components.Constructor("@mozilla.org/file/local;1",
"nsIFile", "initWithPath");
- const cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Ci.nsIChromeRegistry);
const strings = Services.strings.createBundle("chrome://devtools/locale/app-manager.properties");
- let httpserver, origin;
+ let httpserver, fakeOrigin;
window.onload = function() {
SimpleTest.waitForExplicitFinish();
httpserver = new HttpServer();
httpserver.start(-1);
- origin = "http://localhost:" + httpserver.identity.primaryPort + "/";
+ fakeOrigin = "http://localhost:" + httpserver.identity.primaryPort + "/";
next();
};
function createHosted(path, manifestFile = "/manifest.webapp") {
let dirPath = getTestFilePath("validator/" + path);
httpserver.registerDirectory("/", nsFile(dirPath));
return new AppValidator({
type: "hosted",
- location: origin + manifestFile
+ location: fakeOrigin + manifestFile
});
}
function createPackaged(path) {
let dirPath = getTestFilePath("validator/" + path);
return new AppValidator({
type: "packaged",
location: dirPath
@@ -90,17 +88,17 @@
});
},
// Test a launch path that returns a 404
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[0], strings.formatStringFromName("validator.accessFailedLaunchPathBadHttpCode", [fakeOrigin + "wrong-path.html", 404], 2),
"with the right error message");
is(validator.warnings.length, 0, "but no warning");
next();
});
},
function() {
let validator = createPackaged("wrong-launch-path");
validator.validate().then(() => {
--- a/devtools/client/webide/test/test_device_preferences.html
+++ b/devtools/client/webide/test/test_device_preferences.html
@@ -10,16 +10,17 @@
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="device_front_shared.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head>
<body>
<script type="application/javascript">
+ /* import-globals-from device_front_shared.js */
window.onload = function() {
SimpleTest.waitForExplicitFinish();
(async function() {
DebuggerServer.init();
DebuggerServer.registerAllActors();
let win = await openWebIDE();
--- a/devtools/client/webide/test/test_manifestUpdate.html
+++ b/devtools/client/webide/test/test_manifestUpdate.html
@@ -49,17 +49,16 @@
project.manifest.name = "xxx";
// Write to disk
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");
// Make the manifest invalid on disk
delete json.name;
let Encoder = new TextEncoder();
--- a/devtools/client/webide/test/test_runtime.html
+++ b/devtools/client/webide/test/test_runtime.html
@@ -160,17 +160,17 @@
Services.prefs.setIntPref("devtools.webide.busyTimeout", 100);
// Click the infinite runtime
items[1].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
// Wait for error message since connection never completes
- let errorDeferred = new Promise(resolve => {
+ await new Promise(resolve => {
win.UI.reportError = errorName => {
if (errorName === "error_operationTimeout") {
resolve();
}
};
});
// Click the prolonged runtime
@@ -185,14 +185,16 @@
}
};
setTimeout(() => {
resolve();
}, 1000);
});
+ await noErrorDeferred;
+
SimpleTest.finish();
})();
};
</script>
</body>
</html>
--- a/devtools/client/webide/test/test_toolbox.html
+++ b/devtools/client/webide/test/test_toolbox.html
@@ -46,16 +46,18 @@
resolve);
});
docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
await win.UI._busyPromise;
+ await deferred;
+
is(Object.keys(DebuggerServer._connections).length, 1, "Connected");
await waitForUpdate(win, "runtime-global-actors");
ok(win.AppManager.isMainProcessDebuggable(), "Main process available");
// Select main process
SimpleTest.executeSoon(() => {