Bug 1451659 - Automated ESLint fixes for devtools/client/framework/. r=jdescottes

MozReview-Commit-ID: 26jRtf8ZzTr

--HG--
extra : rebase_source : e70c7307b4d72a5e2572647d9628e8757e924a35
This commit is contained in:
Mark Banner 2018-04-04 22:10:09 +01:00
parent f1b05cb9f0
commit c07518ff8d
70 changed files with 214 additions and 221 deletions

View File

@ -48,7 +48,7 @@ function attachThread(toolbox) {
let autoBlackBox = false; let autoBlackBox = false;
let ignoreFrameEnvironment = false; let ignoreFrameEnvironment = false;
const newDebuggerEnabled = Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend"); const newDebuggerEnabled = Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend");
if(!newDebuggerEnabled) { if (!newDebuggerEnabled) {
useSourceMaps = Services.prefs.getBoolPref("devtools.debugger.source-maps-enabled"); useSourceMaps = Services.prefs.getBoolPref("devtools.debugger.source-maps-enabled");
autoBlackBox = Services.prefs.getBoolPref("devtools.debugger.auto-black-box"); autoBlackBox = Services.prefs.getBoolPref("devtools.debugger.auto-black-box");
} else { } else {
@ -103,7 +103,7 @@ function attachThread(toolbox) {
target.client.attachAddon(actor, res => { target.client.attachAddon(actor, res => {
target.client.attachThread(res.threadActor, handleResponse); target.client.attachThread(res.threadActor, handleResponse);
}); });
} else { } else {
// Attaching an old browser debugger or a content process. // Attaching an old browser debugger or a content process.
target.client.attachThread(chromeDebugger, handleResponse); target.client.attachThread(chromeDebugger, handleResponse);
} }

View File

@ -74,7 +74,7 @@ function createToolMenuElements(toolDefinition, doc) {
return; return;
} }
let oncommand = function (id, event) { let oncommand = function(id, event) {
let window = event.target.ownerDocument.defaultView; let window = event.target.ownerDocument.defaultView;
gDevToolsBrowser.selectToolCommand(window.gBrowser, id, window.performance.now()); gDevToolsBrowser.selectToolCommand(window.gBrowser, id, window.performance.now());
}.bind(null, id); }.bind(null, id);
@ -253,7 +253,7 @@ function removeTopLevelItems(doc) {
* @param {XULDocument} doc * @param {XULDocument} doc
* The document to which menus are to be added. * The document to which menus are to be added.
*/ */
exports.addMenus = function (doc) { exports.addMenus = function(doc) {
addTopLevelItems(doc); addTopLevelItems(doc);
addAllToolsToMenu(doc); addAllToolsToMenu(doc);
@ -265,7 +265,7 @@ exports.addMenus = function (doc) {
* @param {XULDocument} doc * @param {XULDocument} doc
* The document to which menus are to be removed. * The document to which menus are to be removed.
*/ */
exports.removeMenus = function (doc) { exports.removeMenus = function(doc) {
// We only remove top level entries. Per-tool entries are removed while // We only remove top level entries. Per-tool entries are removed while
// unregistering each tool. // unregistering each tool.
removeTopLevelItems(doc); removeTopLevelItems(doc);

View File

@ -22,7 +22,7 @@ var gConnectionTimeout;
* Once DOM is ready, we prefil the host/port inputs with * Once DOM is ready, we prefil the host/port inputs with
* pref-stored values. * pref-stored values.
*/ */
window.addEventListener("DOMContentLoaded", function () { window.addEventListener("DOMContentLoaded", function() {
let host = Services.prefs.getCharPref("devtools.debugger.remote-host"); let host = Services.prefs.getCharPref("devtools.debugger.remote-host");
let port = Services.prefs.getIntPref("devtools.debugger.remote-port"); let port = Services.prefs.getIntPref("devtools.debugger.remote-port");
@ -35,7 +35,7 @@ window.addEventListener("DOMContentLoaded", function () {
} }
let form = document.querySelector("#connection-form form"); let form = document.querySelector("#connection-form form");
form.addEventListener("submit", function () { form.addEventListener("submit", function() {
window.submit().catch(e => { window.submit().catch(e => {
console.error(e); console.error(e);
// Bug 921850: catch rare exception from DebuggerClient.socketConnect // Bug 921850: catch rare exception from DebuggerClient.socketConnect
@ -47,7 +47,7 @@ window.addEventListener("DOMContentLoaded", function () {
/** /**
* Called when the "connect" button is clicked. * Called when the "connect" button is clicked.
*/ */
var submit = async function () { var submit = async function() {
// Show the "connecting" screen // Show the "connecting" screen
document.body.classList.add("connecting"); document.body.classList.add("connecting");
@ -74,7 +74,7 @@ var submit = async function () {
/** /**
* Connection is ready. List actors and build buttons. * Connection is ready. List actors and build buttons.
*/ */
var onConnectionReady = async function ([aType, aTraits]) { var onConnectionReady = async function([aType, aTraits]) {
clearTimeout(gConnectionTimeout); clearTimeout(gConnectionTimeout);
let addons = []; let addons = [];
@ -83,7 +83,7 @@ var onConnectionReady = async function ([aType, aTraits]) {
if (!response.error && response.addons.length > 0) { if (!response.error && response.addons.length > 0) {
addons = response.addons; addons = response.addons;
} }
} catch(e) { } catch (e) {
// listAddons throws if the runtime doesn't support addons // listAddons throws if the runtime doesn't support addons
} }
@ -96,8 +96,7 @@ var onConnectionReady = async function ([aType, aTraits]) {
} }
buildAddonLink(addon, parent); buildAddonLink(addon, parent);
} }
} } else {
else {
// Hide the section when there are no add-ons // Hide the section when there are no add-ons
parent.previousElementSibling.remove(); parent.previousElementSibling.remove();
parent.remove(); parent.remove();
@ -126,7 +125,7 @@ var onConnectionReady = async function ([aType, aTraits]) {
// but in Fx>=39, chrome is debuggable via getProcess() and ChromeActor // but in Fx>=39, chrome is debuggable via getProcess() and ChromeActor
if (globals.consoleActor || gClient.mainRoot.traits.allowChromeProcess) { if (globals.consoleActor || gClient.mainRoot.traits.allowChromeProcess) {
let a = document.createElement("a"); let a = document.createElement("a");
a.onclick = function () { a.onclick = function() {
if (gClient.mainRoot.traits.allowChromeProcess) { if (gClient.mainRoot.traits.allowChromeProcess) {
gClient.getProcess() gClient.getProcess()
.then(aResponse => { .then(aResponse => {
@ -162,7 +161,7 @@ var onConnectionReady = async function ([aType, aTraits]) {
*/ */
function buildAddonLink(addon, parent) { function buildAddonLink(addon, parent) {
let a = document.createElement("a"); let a = document.createElement("a");
a.onclick = async function () { a.onclick = async function() {
const isTabActor = addon.isWebExtension; const isTabActor = addon.isWebExtension;
openToolbox(addon, true, "webconsole", isTabActor); openToolbox(addon, true, "webconsole", isTabActor);
}; };
@ -179,7 +178,7 @@ function buildAddonLink(addon, parent) {
*/ */
function buildTabLink(tab, parent, selected) { function buildTabLink(tab, parent, selected) {
let a = document.createElement("a"); let a = document.createElement("a");
a.onclick = function () { a.onclick = function() {
openToolbox(tab); openToolbox(tab);
}; };
@ -233,7 +232,7 @@ function openToolbox(form, chrome = false, tool = "webconsole", isTabActor) {
TargetFactory.forRemoteTab(options).then((target) => { TargetFactory.forRemoteTab(options).then((target) => {
let hostType = Toolbox.HostType.WINDOW; let hostType = Toolbox.HostType.WINDOW;
gDevTools.showToolbox(target, tool, hostType).then((toolbox) => { gDevTools.showToolbox(target, tool, hostType).then((toolbox) => {
toolbox.once("destroyed", function () { toolbox.once("destroyed", function() {
gClient.close(); gClient.close();
}); });
}, console.error); }, console.error);

View File

@ -93,7 +93,7 @@ this.gDevTools = {
get _tools() { get _tools() {
return devtools._tools; return devtools._tools;
}, },
*[Symbol.iterator ]() { * [Symbol.iterator ]() {
for (let toolbox of this._toolboxes) { for (let toolbox of this._toolboxes) {
yield toolbox; yield toolbox;
} }
@ -105,7 +105,6 @@ gDevToolsMethods.forEach(name => {
}; };
}); });
/** /**
* gDevToolsBrowser exposes functions to connect the gDevTools instance with a * gDevToolsBrowser exposes functions to connect the gDevTools instance with a
* Firefox instance. * Firefox instance.

View File

@ -36,7 +36,7 @@ function Menu({ id = null } = {}) {
* *
* @param {MenuItem} menuItem * @param {MenuItem} menuItem
*/ */
Menu.prototype.append = function (menuItem) { Menu.prototype.append = function(menuItem) {
this.menuitems.push(menuItem); this.menuitems.push(menuItem);
}; };
@ -46,7 +46,7 @@ Menu.prototype.append = function (menuItem) {
* @param {int} pos * @param {int} pos
* @param {MenuItem} menuItem * @param {MenuItem} menuItem
*/ */
Menu.prototype.insert = function (pos, menuItem) { Menu.prototype.insert = function(pos, menuItem) {
throw Error("Not implemented"); throw Error("Not implemented");
}; };
@ -62,7 +62,7 @@ Menu.prototype.insert = function (pos, menuItem) {
* @param Toolbox toolbox (non standard) * @param Toolbox toolbox (non standard)
* Needed so we in which window to inject XUL * Needed so we in which window to inject XUL
*/ */
Menu.prototype.popup = function (screenX, screenY, toolbox) { Menu.prototype.popup = function(screenX, screenY, toolbox) {
let doc = toolbox.doc; let doc = toolbox.doc;
let popupset = doc.querySelector("popupset"); let popupset = doc.querySelector("popupset");
// See bug 1285229, on Windows, opening the same popup multiple times in a // See bug 1285229, on Windows, opening the same popup multiple times in a
@ -100,7 +100,7 @@ Menu.prototype.popup = function (screenX, screenY, toolbox) {
popup.openPopupAtScreen(screenX, screenY, true); popup.openPopupAtScreen(screenX, screenY, true);
}; };
Menu.prototype._createMenuItems = function (parent) { Menu.prototype._createMenuItems = function(parent) {
let doc = parent.ownerDocument; let doc = parent.ownerDocument;
this.menuitems.forEach(item => { this.menuitems.forEach(item => {
if (!item.visible) { if (!item.visible) {

View File

@ -109,7 +109,7 @@ ToolSidebar.prototype = {
* true, this is already done automatically. If not, you may call this * true, this is already done automatically. If not, you may call this
* function at any time to add the menu. * function at any time to add the menu.
*/ */
addAllTabsMenu: function () { addAllTabsMenu: function() {
if (this._allTabsBtn) { if (this._allTabsBtn) {
return; return;
} }
@ -155,7 +155,7 @@ ToolSidebar.prototype = {
} }
}, },
removeAllTabsMenu: function () { removeAllTabsMenu: function() {
if (!this._allTabsBtn) { if (!this._allTabsBtn) {
return; return;
} }
@ -172,18 +172,18 @@ ToolSidebar.prototype = {
this._allTabsBtn = null; this._allTabsBtn = null;
}, },
_onTabBoxOverflow: function () { _onTabBoxOverflow: function() {
this._allTabsBtn.removeAttribute("hidden"); this._allTabsBtn.removeAttribute("hidden");
}, },
_onTabBoxUnderflow: function () { _onTabBoxUnderflow: function() {
this._allTabsBtn.setAttribute("hidden", "true"); this._allTabsBtn.setAttribute("hidden", "true");
}, },
/** /**
* Add an item in the allTabs menu for a given tab. * Add an item in the allTabs menu for a given tab.
*/ */
_addItemToAllTabsMenu: function (id, tab, options) { _addItemToAllTabsMenu: function(id, tab, options) {
if (!this._allTabsBtn) { if (!this._allTabsBtn) {
return; return;
} }
@ -228,7 +228,7 @@ ToolSidebar.prototype = {
* - {String} insertBefore By default, the new tab is appended at the end of the * - {String} insertBefore By default, the new tab is appended at the end of the
* tabbox, pass the ID of an existing tab to insert it before that tab instead. * tabbox, pass the ID of an existing tab to insert it before that tab instead.
*/ */
addTab: function (id, url, options = {}) { addTab: function(id, url, options = {}) {
let iframe = this._panelDoc.createElementNS(XULNS, "iframe"); let iframe = this._panelDoc.createElementNS(XULNS, "iframe");
iframe.className = "iframe-" + id; iframe.className = "iframe-" + id;
iframe.setAttribute("flex", "1"); iframe.setAttribute("flex", "1");
@ -304,7 +304,7 @@ ToolSidebar.prototype = {
/** /**
* Search for existing tabs in the markup that aren't know yet and add them. * Search for existing tabs in the markup that aren't know yet and add them.
*/ */
addExistingTabs: function () { addExistingTabs: function() {
let knownTabs = [...this._tabs.values()]; let knownTabs = [...this._tabs.values()];
for (let tab of this._tabbox.tabs.querySelectorAll("tab")) { for (let tab of this._tabbox.tabs.querySelectorAll("tab")) {
@ -363,7 +363,7 @@ ToolSidebar.prototype = {
* @param {Boolean} isVisible True to show the tab/tabpanel, False to hide it. * @param {Boolean} isVisible True to show the tab/tabpanel, False to hide it.
* @param {String} id The ID of the tab to be hidden. * @param {String} id The ID of the tab to be hidden.
*/ */
toggleTab: function (isVisible, id) { toggleTab: function(isVisible, id) {
// Toggle the tab. // Toggle the tab.
let tab = this.getTab(id); let tab = this.getTab(id);
if (!tab) { if (!tab) {
@ -380,7 +380,7 @@ ToolSidebar.prototype = {
/** /**
* Select a specific tab. * Select a specific tab.
*/ */
select: function (id) { select: function(id) {
let tab = this.getTab(id); let tab = this.getTab(id);
if (tab) { if (tab) {
this._tabbox.selectedTab = tab; this._tabbox.selectedTab = tab;
@ -393,7 +393,7 @@ ToolSidebar.prototype = {
* @param {String} id * @param {String} id
* The sidebar tab id to select. * The sidebar tab id to select.
*/ */
_selectTabSoon: function (id) { _selectTabSoon: function(id) {
this._panelDoc.defaultView.setTimeout(() => { this._panelDoc.defaultView.setTimeout(() => {
this.select(id); this.select(id);
}, 0); }, 0);
@ -402,7 +402,7 @@ ToolSidebar.prototype = {
/** /**
* Return the id of the selected tab. * Return the id of the selected tab.
*/ */
getCurrentTabID: function () { getCurrentTabID: function() {
let currentID = null; let currentID = null;
for (let [id, tab] of this._tabs) { for (let [id, tab] of this._tabs) {
if (this._tabbox.tabs.selectedItem == tab) { if (this._tabbox.tabs.selectedItem == tab) {
@ -418,7 +418,7 @@ ToolSidebar.prototype = {
* @param {String} id * @param {String} id
* @return {DOMNode} * @return {DOMNode}
*/ */
getTabPanel: function (id) { getTabPanel: function(id) {
// Search with and without the ID prefix as there might have been existing // Search with and without the ID prefix as there might have been existing
// tabpanels by the time the sidebar got created // tabpanels by the time the sidebar got created
return this._tabbox.tabpanels.querySelector("#" + this.TABPANEL_ID_PREFIX + id + ", #" + id); return this._tabbox.tabpanels.querySelector("#" + this.TABPANEL_ID_PREFIX + id + ", #" + id);
@ -429,7 +429,7 @@ ToolSidebar.prototype = {
* @param {String} id * @param {String} id
* @return {DOMNode} * @return {DOMNode}
*/ */
getTab: function (id) { getTab: function(id) {
// FIXME: A workaround for broken browser_net_raw_headers.js failure only in non-e10s mode // FIXME: A workaround for broken browser_net_raw_headers.js failure only in non-e10s mode
return this._tabs && this._tabs.get(id); return this._tabs && this._tabs.get(id);
}, },
@ -437,7 +437,7 @@ ToolSidebar.prototype = {
/** /**
* Event handler. * Event handler.
*/ */
handleEvent: function (event) { handleEvent: function(event) {
if (event.type !== "select" || this._destroyed) { if (event.type !== "select" || this._destroyed) {
return; return;
} }
@ -483,7 +483,7 @@ ToolSidebar.prototype = {
/** /**
* Toggle sidebar's visibility state. * Toggle sidebar's visibility state.
*/ */
toggle: function () { toggle: function() {
if (this._tabbox.hasAttribute("hidden")) { if (this._tabbox.hasAttribute("hidden")) {
this.show(); this.show();
} else { } else {
@ -497,7 +497,7 @@ ToolSidebar.prototype = {
* @param {String} id * @param {String} id
* The sidebar tab id to select. * The sidebar tab id to select.
*/ */
show: function (id) { show: function(id) {
if (this._width) { if (this._width) {
this._tabbox.width = this._width; this._tabbox.width = this._width;
} }
@ -521,7 +521,7 @@ ToolSidebar.prototype = {
/** /**
* Show the sidebar. * Show the sidebar.
*/ */
hide: function () { hide: function() {
Services.prefs.setIntPref("devtools.toolsidebar-width." + this._uid, this._tabbox.width); Services.prefs.setIntPref("devtools.toolsidebar-width." + this._uid, this._tabbox.width);
this._tabbox.setAttribute("hidden", "true"); this._tabbox.setAttribute("hidden", "true");
this._panelDoc.activeElement.blur(); this._panelDoc.activeElement.blur();
@ -532,7 +532,7 @@ ToolSidebar.prototype = {
/** /**
* Return the window containing the tab content. * Return the window containing the tab content.
*/ */
getWindowForTab: function (id) { getWindowForTab: function(id) {
if (!this._tabs.has(id)) { if (!this._tabs.has(id)) {
return null; return null;
} }

View File

@ -51,7 +51,7 @@ function SourceMapURLService(toolbox, sourceMapService) {
* Lazy initialization. Returns a promise that will resolve when all * Lazy initialization. Returns a promise that will resolve when all
* the relevant URLs have been registered. * the relevant URLs have been registered.
*/ */
SourceMapURLService.prototype._getLoadingPromise = function () { SourceMapURLService.prototype._getLoadingPromise = function() {
if (!this._loadingPromise) { if (!this._loadingPromise) {
let styleSheetsLoadingPromise = null; let styleSheetsLoadingPromise = null;
this._stylesheetsFront = this._toolbox.initStyleSheetsFront(); this._stylesheetsFront = this._toolbox.initStyleSheetsFront();
@ -84,7 +84,7 @@ SourceMapURLService.prototype._getLoadingPromise = function () {
/** /**
* Reset the service. This flushes the internal cache. * Reset the service. This flushes the internal cache.
*/ */
SourceMapURLService.prototype.reset = function () { SourceMapURLService.prototype.reset = function() {
this._sourceMapService.clearSourceMaps(); this._sourceMapService.clearSourceMaps();
this._urls.clear(); this._urls.clear();
this._subscriptions.clear(); this._subscriptions.clear();
@ -96,7 +96,7 @@ SourceMapURLService.prototype.reset = function () {
* flushing the cache. After this call the service will no longer * flushing the cache. After this call the service will no longer
* function. * function.
*/ */
SourceMapURLService.prototype.destroy = function () { SourceMapURLService.prototype.destroy = function() {
this.reset(); this.reset();
this._target.off("source-updated", this._onSourceUpdated); this._target.off("source-updated", this._onSourceUpdated);
this._target.off("will-navigate", this.reset); this._target.off("will-navigate", this.reset);
@ -110,7 +110,7 @@ SourceMapURLService.prototype.destroy = function () {
/** /**
* A helper function that is called when a new source is available. * A helper function that is called when a new source is available.
*/ */
SourceMapURLService.prototype._onSourceUpdated = function (sourceEvent) { SourceMapURLService.prototype._onSourceUpdated = function(sourceEvent) {
// Maybe we were shut down while waiting. // Maybe we were shut down while waiting.
if (!this._urls) { if (!this._urls) {
return; return;
@ -132,7 +132,7 @@ SourceMapURLService.prototype._onSourceUpdated = function (sourceEvent) {
* @param {StyleSheetActor} sheet * @param {StyleSheetActor} sheet
* The new style sheet's actor. * The new style sheet's actor.
*/ */
SourceMapURLService.prototype._onNewStyleSheet = function (sheet) { SourceMapURLService.prototype._onNewStyleSheet = function(sheet) {
// Maybe we were shut down while waiting. // Maybe we were shut down while waiting.
if (!this._urls) { if (!this._urls) {
return; return;
@ -154,7 +154,7 @@ SourceMapURLService.prototype._onNewStyleSheet = function (sheet) {
* @param {String} newUrl * @param {String} newUrl
* The URL of the pretty-printed source * The URL of the pretty-printed source
*/ */
SourceMapURLService.prototype.sourceMapChanged = function (id, newUrl) { SourceMapURLService.prototype.sourceMapChanged = function(id, newUrl) {
if (!this._urls) { if (!this._urls) {
return; return;
} }
@ -195,7 +195,7 @@ SourceMapURLService.prototype.sourceMapChanged = function (id, newUrl) {
* @return Promise * @return Promise
* A promise resolving either to the original location, or null. * A promise resolving either to the original location, or null.
*/ */
SourceMapURLService.prototype.originalPositionFor = async function (url, line, column) { SourceMapURLService.prototype.originalPositionFor = async function(url, line, column) {
// Ensure the sources are loaded before replying. // Ensure the sources are loaded before replying.
await this._getLoadingPromise(); await this._getLoadingPromise();
@ -230,7 +230,7 @@ SourceMapURLService.prototype.originalPositionFor = async function (url, line, c
* @param {Function} callback * @param {Function} callback
* The callback to call; @see subscribe * The callback to call; @see subscribe
*/ */
SourceMapURLService.prototype._callOneCallback = async function (subscriptionEntry, SourceMapURLService.prototype._callOneCallback = async function(subscriptionEntry,
callback) { callback) {
// If source maps are disabled, immediately call with just "false". // If source maps are disabled, immediately call with just "false".
if (!this._prefValue) { if (!this._prefValue) {
@ -275,7 +275,7 @@ SourceMapURLService.prototype._callOneCallback = async function (subscriptionEnt
* and the generated location should be used; in this * and the generated location should be used; in this
* case the remaining arguments should be ignored. * case the remaining arguments should be ignored.
*/ */
SourceMapURLService.prototype.subscribe = function (url, line, column, callback) { SourceMapURLService.prototype.subscribe = function(url, line, column, callback) {
if (!this._subscriptions) { if (!this._subscriptions) {
return; return;
} }
@ -312,7 +312,7 @@ SourceMapURLService.prototype.subscribe = function (url, line, column, callback)
* @param {Function} callback * @param {Function} callback
* The callback. * The callback.
*/ */
SourceMapURLService.prototype.unsubscribe = function (url, line, column, callback) { SourceMapURLService.prototype.unsubscribe = function(url, line, column, callback) {
if (!this._subscriptions) { if (!this._subscriptions) {
return; return;
} }
@ -334,7 +334,7 @@ SourceMapURLService.prototype.unsubscribe = function (url, line, column, callbac
* A helper function that is called when the source map pref changes. * A helper function that is called when the source map pref changes.
* This function notifies all subscribers of the state change. * This function notifies all subscribers of the state change.
*/ */
SourceMapURLService.prototype._onPrefChanged = function () { SourceMapURLService.prototype._onPrefChanged = function() {
if (!this._subscriptions) { if (!this._subscriptions) {
return; return;
} }

View File

@ -10,7 +10,7 @@ PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
// On debug test slave, it takes about 50s to run the test. // On debug test slave, it takes about 50s to run the test.
requestLongerTimeout(4); requestLongerTimeout(4);
add_task(async function () { add_task(async function() {
await new Promise(done => { await new Promise(done => {
let options = {"set": [ let options = {"set": [
["devtools.debugger.prompt-connection", false], ["devtools.debugger.prompt-connection", false],
@ -38,7 +38,7 @@ add_task(async function () {
// Be careful, this JS function is going to be executed in the addon toolbox, // Be careful, this JS function is going to be executed in the addon toolbox,
// which lives in another process. So do not try to use any scope variable! // which lives in another process. So do not try to use any scope variable!
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
let testScript = function () { let testScript = function() {
toolbox.selectTool("webconsole") toolbox.selectTool("webconsole")
.then(console => { .then(console => {
let { jsterm } = console.hud; let { jsterm } = console.hud;

View File

@ -48,7 +48,7 @@ add_task(async function runTest() {
// Debugger is going to fail and only display root folder (`/`) listing. // Debugger is going to fail and only display root folder (`/`) listing.
// But it won't try to fetch this url and use sandbox content as expected. // But it won't try to fetch this url and use sandbox content as expected.
let testUrl = `http://mozilla.org/browser-toolbox-test-${id}.js`; let testUrl = `http://mozilla.org/browser-toolbox-test-${id}.js`;
Cu.evalInSandbox("(" + function () { Cu.evalInSandbox("(" + function() {
this.plop = function plop() { this.plop = function plop() {
return 1; return 1;
}; };
@ -63,7 +63,7 @@ add_task(async function runTest() {
.getService(Ci.nsIEnvironment); .getService(Ci.nsIEnvironment);
// First inject a very minimal head, with simplest assertion methods // First inject a very minimal head, with simplest assertion methods
// and very common globals // and very common globals
let testHead = (function () { let testHead = (function() {
const info = msg => dump(msg + "\n"); const info = msg => dump(msg + "\n");
const is = (a, b, description) => { const is = (a, b, description) => {
let msg = "'" + JSON.stringify(a) + "' is equal to '" + JSON.stringify(b) + "'"; let msg = "'" + JSON.stringify(a) + "' is equal to '" + JSON.stringify(b) + "'";
@ -108,7 +108,7 @@ add_task(async function runTest() {
return Promise.resolve(true); return Promise.resolve(true);
} }
return new Promise(resolve => { return new Promise(resolve => {
setTimeout(function () { setTimeout(function() {
waitUntil(predicate, interval).then(() => resolve(true)); waitUntil(predicate, interval).then(() => resolve(true));
}, interval); }, interval);
}); });
@ -128,7 +128,7 @@ add_task(async function runTest() {
// toolbox process // toolbox process
let testScript = (await fetch(testScriptURL)).content; let testScript = (await fetch(testScriptURL)).content;
let source = let source =
"try { let testUrl = \""+testUrl+"\";" + testHead + debuggerHead + testScript + "} catch (e) {" + "try { let testUrl = \"" + testUrl + "\";" + testHead + debuggerHead + testScript + "} catch (e) {" +
" dump('Exception: '+ e + ' at ' + e.fileName + ':' + " + " dump('Exception: '+ e + ' at ' + e.fileName + ':' + " +
" e.lineNumber + '\\nStack: ' + e.stack + '\\n');" + " e.lineNumber + '\\nStack: ' + e.stack + '\\n');" +
"}"; "}";

View File

@ -22,7 +22,7 @@ function runTests1(tab) {
visibilityswitch: "devtools.test-tool.enabled", visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank", url: "about:blank",
label: "someLabel", label: "someLabel",
build: function (iframeWindow, toolbox) { build: function(iframeWindow, toolbox) {
let panel = createTestPanel(iframeWindow, toolbox); let panel = createTestPanel(iframeWindow, toolbox);
return panel.open(); return panel.open();
}, },
@ -59,7 +59,7 @@ function runTests1(tab) {
}); });
}); });
gDevTools.showToolbox(target, toolId1).then(function (toolbox) { gDevTools.showToolbox(target, toolId1).then(function(toolbox) {
is(toolbox.target, target, "toolbox target is correct"); is(toolbox.target, target, "toolbox target is correct");
is(toolbox.target.tab, gBrowser.selectedTab, "targeted tab is correct"); is(toolbox.target.tab, gBrowser.selectedTab, "targeted tab is correct");
@ -83,7 +83,7 @@ function runTests2() {
visibilityswitch: "devtools.test-tool.enabled", visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank", url: "about:blank",
label: "someLabel", label: "someLabel",
build: function (iframeWindow, toolbox) { build: function(iframeWindow, toolbox) {
return createTestPanel(iframeWindow, toolbox); return createTestPanel(iframeWindow, toolbox);
}, },
}; };
@ -127,7 +127,7 @@ function runTests2() {
}); });
}); });
gDevTools.showToolbox(target, toolId2).then(function (toolbox) { gDevTools.showToolbox(target, toolId2).then(function(toolbox) {
is(toolbox.target, target, "toolbox target is correct"); is(toolbox.target, target, "toolbox target is correct");
is(toolbox.target.tab, gBrowser.selectedTab, "targeted tab is correct"); is(toolbox.target.tab, gBrowser.selectedTab, "targeted tab is correct");
@ -139,7 +139,7 @@ function runTests2() {
}); });
} }
var continueTests = async function (toolbox, panel) { var continueTests = async function(toolbox, panel) {
ok(toolbox.getCurrentPanel(), "panel value is correct"); ok(toolbox.getCurrentPanel(), "panel value is correct");
is(toolbox.currentToolId, toolId2, "toolbox _currentToolId is correct"); is(toolbox.currentToolId, toolId2, "toolbox _currentToolId is correct");
@ -183,7 +183,7 @@ var continueTests = async function (toolbox, panel) {
}; };
function destroyToolbox(toolbox) { function destroyToolbox(toolbox) {
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);
ok(gDevTools._toolboxes.get(target) == null, "gDevTools doesn't know about target"); ok(gDevTools._toolboxes.get(target) == null, "gDevTools doesn't know about target");
ok(toolbox.target == null, "toolbox doesn't know about target."); ok(toolbox.target == null, "toolbox doesn't know about target.");

View File

@ -16,14 +16,14 @@ function runTests(aTab) {
isTargetSupported: () => true, isTargetSupported: () => true,
url: "about:blank", url: "about:blank",
label: "someLabel", label: "someLabel",
build: function (iframeWindow, toolbox) { build: function(iframeWindow, toolbox) {
let deferred = defer(); let deferred = defer();
executeSoon(() => { executeSoon(() => {
deferred.resolve({ deferred.resolve({
target: toolbox.target, target: toolbox.target,
toolbox: toolbox, toolbox: toolbox,
isReady: true, isReady: true,
destroy: function () {}, destroy: function() {},
}); });
}); });
return deferred.promise; return deferred.promise;
@ -35,7 +35,7 @@ function runTests(aTab) {
let collectedEvents = []; let collectedEvents = [];
let target = TargetFactory.forTab(aTab); let target = TargetFactory.forTab(aTab);
gDevTools.showToolbox(target, toolDefinition.id).then(function (toolbox) { gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
let panel = toolbox.getPanel(toolDefinition.id); let panel = toolbox.getPanel(toolDefinition.id);
ok(panel, "Tool open"); ok(panel, "Tool open");
@ -55,7 +55,7 @@ function runTests(aTab) {
collectedEvents.push("toolbox-" + toolDefinition.id + "-destroy"); collectedEvents.push("toolbox-" + toolDefinition.id + "-destroy");
}); });
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
is(collectedEvents.join(":"), is(collectedEvents.join(":"),
"toolbox-destroy:destroy:gDevTools-testTool-destroy:toolbox-testTool-destroy", "toolbox-destroy:destroy:gDevTools-testTool-destroy:toolbox-testTool-destroy",
"Found the right amount of collected events."); "Found the right amount of collected events.");
@ -63,7 +63,7 @@ function runTests(aTab) {
gDevTools.unregisterTool(toolDefinition.id); gDevTools.unregisterTool(toolDefinition.id);
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
executeSoon(function () { executeSoon(function() {
finish(); finish();
}); });
}); });

View File

@ -8,7 +8,7 @@
// Test that network requests originating from the toolbox don't get recorded in // Test that network requests originating from the toolbox don't get recorded in
// the network panel. // the network panel.
add_task(async function () { add_task(async function() {
// TODO: This test tries to verify the normal behavior of the netmonitor and // TODO: This test tries to verify the normal behavior of the netmonitor and
// therefore needs to avoid the explicit check for tests. Bug 1167188 will // therefore needs to avoid the explicit check for tests. Bug 1167188 will
// allow us to remove this workaround. // allow us to remove this workaround.

View File

@ -9,7 +9,7 @@
// Can probably make this a shared test that tests all of the tools global keybindings // Can probably make this a shared test that tests all of the tools global keybindings
const TEST_URL = "data:text/html,<html><head><title>Test for the " + const TEST_URL = "data:text/html,<html><head><title>Test for the " +
"highlighter keybindings</title></head><body>" + "highlighter keybindings</title></head><body>" +
"<h1>Keybindings!</h1></body></html>" "<h1>Keybindings!</h1></body></html>";
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser"); const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
let keysetMap = { }; let keysetMap = { };
@ -17,7 +17,7 @@ let keysetMap = { };
function buildDevtoolsKeysetMap(keyset) { function buildDevtoolsKeysetMap(keyset) {
[].forEach.call( [].forEach.call(
keyset.querySelectorAll("key"), keyset.querySelectorAll("key"),
function (key) { function(key) {
if (!key.getAttribute("key")) { if (!key.getAttribute("key")) {
return; return;
} }
@ -34,7 +34,7 @@ function buildDevtoolsKeysetMap(keyset) {
metaKey: modifiers.match("meta"), metaKey: modifiers.match("meta"),
accelKey: modifiers.match("accel") accelKey: modifiers.match("accel")
}, },
synthesizeKey: function () { synthesizeKey: function() {
EventUtils.synthesizeKey(this.key, this.modifierOpt); EventUtils.synthesizeKey(this.key, this.modifierOpt);
} }
}; };
@ -47,7 +47,7 @@ function setupKeyBindingsTest() {
} }
} }
add_task(async function () { add_task(async function() {
// Use the new debugger frontend because the old one swallows the netmonitor shortcut: // Use the new debugger frontend because the old one swallows the netmonitor shortcut:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1370442#c7 // https://bugzilla.mozilla.org/show_bug.cgi?id=1370442#c7
await SpecialPowers.pushPrefEnv({set: [ await SpecialPowers.pushPrefEnv({set: [

View File

@ -18,7 +18,7 @@ function getZoomValue() {
return parseFloat(Services.prefs.getCharPref("devtools.toolbox.zoomValue")); return parseFloat(Services.prefs.getCharPref("devtools.toolbox.zoomValue"));
} }
add_task(async function () { add_task(async function() {
info("Create a test tab and open the toolbox"); info("Create a test tab and open the toolbox");
let tab = await addTab(URL); let tab = await addTab(URL);
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -15,7 +15,7 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
const {LocalizationHelper} = require("devtools/shared/l10n"); const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
add_task(async function () { add_task(async function() {
info("Create a test tab and open the toolbox"); info("Create a test tab and open the toolbox");
let tab = await addTab(URL); let tab = await addTab(URL);
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -11,7 +11,7 @@ const URL = "data:text/html;charset=utf8,test page for menu api";
const Menu = require("devtools/client/framework/menu"); const Menu = require("devtools/client/framework/menu");
const MenuItem = require("devtools/client/framework/menu-item"); const MenuItem = require("devtools/client/framework/menu-item");
add_task(async function () { add_task(async function() {
info("Create a test tab and open the toolbox"); info("Create a test tab and open the toolbox");
let tab = await addTab(URL); let tab = await addTab(URL);
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -10,9 +10,9 @@ var toolbox, target;
var tempScope = {}; var tempScope = {};
function test() { function test() {
addTab("about:blank").then(function (aTab) { addTab("about:blank").then(function(aTab) {
target = TargetFactory.forTab(gBrowser.selectedTab); target = TargetFactory.forTab(gBrowser.selectedTab);
loadWebConsole(aTab).then(function () { loadWebConsole(aTab).then(function() {
console.log("loaded"); console.log("loaded");
}); });
}); });
@ -21,7 +21,7 @@ function test() {
function loadWebConsole(aTab) { function loadWebConsole(aTab) {
ok(gDevTools, "gDevTools exists"); ok(gDevTools, "gDevTools exists");
return gDevTools.showToolbox(target, "webconsole").then(function (aToolbox) { return gDevTools.showToolbox(target, "webconsole").then(function(aToolbox) {
toolbox = aToolbox; toolbox = aToolbox;
checkToolLoading(); checkToolLoading();
}); });
@ -31,15 +31,15 @@ function checkToolLoading() {
is(toolbox.currentToolId, "webconsole", "The web console is selected"); is(toolbox.currentToolId, "webconsole", "The web console is selected");
ok(toolbox.isReady, "toolbox is ready"); ok(toolbox.isReady, "toolbox is ready");
selectAndCheckById("jsdebugger").then(function () { selectAndCheckById("jsdebugger").then(function() {
selectAndCheckById("styleeditor").then(function () { selectAndCheckById("styleeditor").then(function() {
testToggle(); testToggle();
}); });
}); });
} }
function selectAndCheckById(id) { function selectAndCheckById(id) {
return toolbox.selectTool(id).then(function () { return toolbox.selectTool(id).then(function() {
let tab = toolbox.doc.getElementById("toolbox-tab-" + id); let tab = toolbox.doc.getElementById("toolbox-tab-" + id);
is(tab.classList.contains("selected"), true, "The " + id + " tab is selected"); is(tab.classList.contains("selected"), true, "The " + id + " tab is selected");
is(tab.getAttribute("aria-pressed"), "true", "The " + id + " tab is pressed"); is(tab.getAttribute("aria-pressed"), "true", "The " + id + " tab is pressed");
@ -50,7 +50,7 @@ function testToggle() {
toolbox.once("destroyed", () => { toolbox.once("destroyed", () => {
// Cannot reuse a target after it's destroyed. // Cannot reuse a target after it's destroyed.
target = TargetFactory.forTab(gBrowser.selectedTab); target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "styleeditor").then(function (aToolbox) { gDevTools.showToolbox(target, "styleeditor").then(function(aToolbox) {
toolbox = aToolbox; toolbox = aToolbox;
is(toolbox.currentToolId, "styleeditor", "The style editor is selected"); is(toolbox.currentToolId, "styleeditor", "The style editor is selected");
finishUp(); finishUp();
@ -61,7 +61,7 @@ function testToggle() {
} }
function finishUp() { function finishUp() {
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
toolbox = null; toolbox = null;
target = null; target = null;
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();

View File

@ -20,7 +20,7 @@ const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT}code_binary_search.js`; const JS_URL = `${URL_ROOT}code_binary_search.js`;
const COFFEE_URL = `${URL_ROOT}code_binary_search.coffee`; const COFFEE_URL = `${URL_ROOT}code_binary_search.coffee`;
add_task(async function () { add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true); await pushPref("devtools.debugger.new-debugger-frontend", true);
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger"); const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");

View File

@ -15,7 +15,7 @@ const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${URL_ROOT}code_binary_search_absolute.js`; const JS_URL = `${URL_ROOT}code_binary_search_absolute.js`;
const ORIGINAL_URL = `${URL_ROOT}code_binary_search.coffee`; const ORIGINAL_URL = `${URL_ROOT}code_binary_search.coffee`;
add_task(async function () { add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true); await pushPref("devtools.debugger.new-debugger-frontend", true);
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger"); const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");

View File

@ -28,7 +28,7 @@ const ORIGINAL_URL = "webpack:///code_cross_domain.js";
const GENERATED_LINE = 82; const GENERATED_LINE = 82;
const ORIGINAL_LINE = 12; const ORIGINAL_LINE = 12;
add_task(async function () { add_task(async function() {
const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole"); const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole");
const service = toolbox.sourceMapURLService; const service = toolbox.sourceMapURLService;

View File

@ -28,7 +28,7 @@ const ORIGINAL_URL = "webpack:///code_no_race.js";
const GENERATED_LINE = 84; const GENERATED_LINE = 84;
const ORIGINAL_LINE = 11; const ORIGINAL_LINE = 11;
add_task(async function () { add_task(async function() {
// Opening the debugger causes the source actors to be created. // Opening the debugger causes the source actors to be created.
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger"); const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");
// In bug 1391768, when the sourceMapURLService was created, it was // In bug 1391768, when the sourceMapURLService was created, it was

View File

@ -17,7 +17,7 @@ const PAGE_URL = `${TEST_ROOT}doc_empty-tab-01.html`;
const JS_URL = `${TEST_ROOT}code_inline_bundle.js`; const JS_URL = `${TEST_ROOT}code_inline_bundle.js`;
const ORIGINAL_URL = "webpack:///code_inline_original.js"; const ORIGINAL_URL = "webpack:///code_inline_original.js";
add_task(async function () { add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true); await pushPref("devtools.debugger.new-debugger-frontend", true);
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger"); const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");

View File

@ -28,7 +28,7 @@ const ORIGINAL_URL = "webpack:///code_no_race.js";
const GENERATED_LINE = 84; const GENERATED_LINE = 84;
const ORIGINAL_LINE = 11; const ORIGINAL_LINE = 11;
add_task(async function () { add_task(async function() {
// Start with the empty page, then navigate, so that we can properly // Start with the empty page, then navigate, so that we can properly
// listen for new sources arriving. // listen for new sources arriving.
const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole"); const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole");

View File

@ -15,7 +15,7 @@ const ORIGINAL_URL_2 = "webpack:///code_reload_2.js";
const GENERATED_LINE = 86; const GENERATED_LINE = 86;
const ORIGINAL_LINE = 13; const ORIGINAL_LINE = 13;
add_task(async function () { add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true); await pushPref("devtools.debugger.new-debugger-frontend", true);
// Start with the empty page, then navigate, so that we can properly // Start with the empty page, then navigate, so that we can properly

View File

@ -5,8 +5,7 @@
var target; var target;
function test() function test() {
{
waitForExplicitFinish(); waitForExplicitFinish();
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);

View File

@ -23,7 +23,7 @@ function assertIsTabTarget(target, url, chrome = false) {
is(target.isRemote, true); is(target.isRemote, true);
} }
add_task(async function () { add_task(async function() {
let tab = await addTab(TEST_URI); let tab = await addTab(TEST_URI);
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
let target; let target;

View File

@ -21,7 +21,7 @@ async function testTarget(client, target) {
let desc = await target.getActorDescription("webaudio"); let desc = await target.getActorDescription("webaudio");
is(desc.typeName, "webaudio", is(desc.typeName, "webaudio",
"target.getActorDescription() returns definition data for corresponding actor"); "target.getActorDescription() returns definition data for corresponding actor");
is(desc.events["start-context"]["type"], "startContext", is(desc.events["start-context"].type, "startContext",
"target.getActorDescription() returns event data for corresponding actor"); "target.getActorDescription() returns event data for corresponding actor");
desc = await target.getActorDescription("nope"); desc = await target.getActorDescription("nope");

View File

@ -15,7 +15,7 @@ function test() {
iframe = document.createElement("iframe"); iframe = document.createElement("iframe");
document.documentElement.appendChild(iframe); document.documentElement.appendChild(iframe);
addTab(TEST_URL).then(function (tab) { addTab(TEST_URL).then(function(tab) {
target = TargetFactory.forTab(tab); target = TargetFactory.forTab(tab);
let options = {customIframe: iframe}; let options = {customIframe: iframe};
gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options) gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options)
@ -24,7 +24,7 @@ function test() {
}); });
function onMessage(event) { function onMessage(event) {
if (typeof(event.data) !== "string") { if (typeof (event.data) !== "string") {
return; return;
} }
info("onMessage: " + event.data); info("onMessage: " + event.data);

View File

@ -7,16 +7,14 @@ const TEST_URL = "data:text/html,test for dynamically registering and unregister
var toolbox; var toolbox;
function test() function test() {
{
addTab(TEST_URL).then(tab => { addTab(TEST_URL).then(tab => {
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);
gDevTools.showToolbox(target).then(testRegister); gDevTools.showToolbox(target).then(testRegister);
}); });
} }
function testRegister(aToolbox) function testRegister(aToolbox) {
{
toolbox = aToolbox; toolbox = aToolbox;
gDevTools.once("tool-registered", toolRegistered); gDevTools.once("tool-registered", toolRegistered);
@ -25,12 +23,11 @@ function testRegister(aToolbox)
label: "Test Tool", label: "Test Tool",
inMenu: true, inMenu: true,
isTargetSupported: () => true, isTargetSupported: () => true,
build: function () {}, build: function() {},
}); });
} }
function toolRegistered(toolId) function toolRegistered(toolId) {
{
is(toolId, "test-tool", "tool-registered event handler sent tool id"); is(toolId, "test-tool", "tool-registered event handler sent tool id");
ok(gDevTools.getToolDefinitionMap().has(toolId), "tool added to map"); ok(gDevTools.getToolDefinitionMap().has(toolId), "tool added to map");
@ -61,15 +58,13 @@ function getAllBrowserWindows() {
return wins; return wins;
} }
function testUnregister() function testUnregister() {
{
gDevTools.once("tool-unregistered", toolUnregistered); gDevTools.once("tool-unregistered", toolUnregistered);
gDevTools.unregisterTool("test-tool"); gDevTools.unregisterTool("test-tool");
} }
function toolUnregistered(toolId) function toolUnregistered(toolId) {
{
is(toolId, "test-tool", "tool-unregistered event handler sent tool id"); is(toolId, "test-tool", "tool-unregistered event handler sent tool id");
ok(!gDevTools.getToolDefinitionMap().has(toolId), "tool removed from map"); ok(!gDevTools.getToolDefinitionMap().has(toolId), "tool removed from map");
@ -90,11 +85,10 @@ function toolUnregistered(toolId)
cleanup(); cleanup();
} }
function cleanup() function cleanup() {
{ toolbox.destroy().then(() => {
toolbox.destroy().then(() => {;
toolbox = null; toolbox = null;
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
finish(); finish();
}) });
} }

View File

@ -10,7 +10,7 @@ var toolbox = null;
const URL = "data:text/html;charset=utf8,test for getPanelWhenReady"; const URL = "data:text/html;charset=utf8,test for getPanelWhenReady";
add_task(async function () { add_task(async function() {
let tab = await addTab(URL); let tab = await addTab(URL);
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);
toolbox = await gDevTools.showToolbox(target); toolbox = await gDevTools.showToolbox(target);

View File

@ -10,7 +10,7 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
var toolbox = null; var toolbox = null;
function test() { function test() {
(async function () { (async function() {
const URL = "data:text/plain;charset=UTF-8,Nothing to see here, move along"; const URL = "data:text/plain;charset=UTF-8,Nothing to see here, move along";
const TOOL_ID_1 = "jsdebugger"; const TOOL_ID_1 = "jsdebugger";

View File

@ -10,7 +10,7 @@ const URL = "data:text/html;charset=utf8,test for host sizes";
var {Toolbox} = require("devtools/client/framework/toolbox"); var {Toolbox} = require("devtools/client/framework/toolbox");
add_task(async function () { add_task(async function() {
// Set size prefs to make the hosts way too big, so that the size has // Set size prefs to make the hosts way too big, so that the size has
// to be clamped to fit into the browser window. // to be clamped to fit into the browser window.
Services.prefs.setIntPref("devtools.toolbox.footer.height", 10000); Services.prefs.setIntPref("devtools.toolbox.footer.height", 10000);
@ -35,7 +35,7 @@ add_task(async function () {
await cleanup(toolbox); await cleanup(toolbox);
}); });
add_task(async function () { add_task(async function() {
// Set size prefs to something reasonable, so we can check to make sure // Set size prefs to something reasonable, so we can check to make sure
// they are being set properly. // they are being set properly.
Services.prefs.setIntPref("devtools.toolbox.footer.height", 100); Services.prefs.setIntPref("devtools.toolbox.footer.height", 100);

View File

@ -12,7 +12,7 @@ function getHostHistogram() {
return Services.telemetry.getHistogramById("DEVTOOLS_TOOLBOX_HOST"); return Services.telemetry.getHistogramById("DEVTOOLS_TOOLBOX_HOST");
} }
add_task(async function () { add_task(async function() {
// Reset it to make counting easier // Reset it to make counting easier
getHostHistogram().clear(); getHostHistogram().clear();

View File

@ -13,13 +13,15 @@ const TEST_URL =
function containsFocus(aDoc, aElm) { function containsFocus(aDoc, aElm) {
let elm = aDoc.activeElement; let elm = aDoc.activeElement;
while (elm) { while (elm) {
if (elm === aElm) { return true; } if (elm === aElm) {
return true;
}
elm = elm.parentNode; elm = elm.parentNode;
} }
return false; return false;
} }
add_task(async function () { add_task(async function() {
info("Create a test tab and open the toolbox"); info("Create a test tab and open the toolbox");
let toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole"); let toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole");
let doc = toolbox.doc; let doc = toolbox.doc;
@ -83,7 +85,7 @@ add_task(async function () {
}); });
// Test that moving the focus of tab button and selecting it. // Test that moving the focus of tab button and selecting it.
add_task(async function () { add_task(async function() {
info("Create a test tab and open the toolbox"); info("Create a test tab and open the toolbox");
let toolbox = await openNewTabAndToolbox(TEST_URL, "inspector"); let toolbox = await openNewTabAndToolbox(TEST_URL, "inspector");
let doc = toolbox.doc; let doc = toolbox.doc;

View File

@ -13,7 +13,7 @@ const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
const {PrefObserver} = require("devtools/client/shared/prefs"); const {PrefObserver} = require("devtools/client/shared/prefs");
add_task(async function () { add_task(async function() {
const URL = "data:text/html;charset=utf8,test for dynamically registering " + const URL = "data:text/html;charset=utf8,test for dynamically registering " +
"and unregistering tools"; "and unregistering tools";
registerNewTool(); registerNewTool();
@ -180,7 +180,7 @@ async function testMouseClick(node, prefValue) {
// We use executeSoon here to ensure that the element is in view and // We use executeSoon here to ensure that the element is in view and
// clickable. // clickable.
executeSoon(function () { executeSoon(function() {
info("Click event synthesized for pref " + pref); info("Click event synthesized for pref " + pref);
EventUtils.synthesizeMouseAtCenter(node, {}, panelWin); EventUtils.synthesizeMouseAtCenter(node, {}, panelWin);
}); });
@ -204,7 +204,6 @@ async function testToggleTools() {
.concat(gDevTools.getAdditionalTools()) .concat(gDevTools.getAdditionalTools())
.concat(toolbox.getAdditionalTools()); .concat(toolbox.getAdditionalTools());
for (let node of toolNodes) { for (let node of toolNodes) {
let id = node.getAttribute("id"); let id = node.getAttribute("id");
ok(toggleableTools.some(tool => tool.id === id), ok(toggleableTools.some(tool => tool.id === id),

View File

@ -147,7 +147,7 @@ function getBoolPref(key) {
} }
function cleanup() { function cleanup() {
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
for (let pref of modifiedPrefs) { for (let pref of modifiedPrefs) {
Services.prefs.clearUserPref(pref); Services.prefs.clearUserPref(pref);

View File

@ -11,7 +11,7 @@ requestLongerTimeout(2);
// are not toggled. // are not toggled.
loadHelperScript("helper_disable_cache.js"); loadHelperScript("helper_disable_cache.js");
add_task(async function () { add_task(async function() {
// Disable rcwn to make cache behavior deterministic. // Disable rcwn to make cache behavior deterministic.
await pushPref("network.http.rcwn.enabled", false); await pushPref("network.http.rcwn.enabled", false);

View File

@ -11,7 +11,7 @@ requestLongerTimeout(2);
// are toggled. // are toggled.
loadHelperScript("helper_disable_cache.js"); loadHelperScript("helper_disable_cache.js");
add_task(async function () { add_task(async function() {
// Disable rcwn to make cache behavior deterministic. // Disable rcwn to make cache behavior deterministic.
await pushPref("network.http.rcwn.enabled", false); await pushPref("network.http.rcwn.enabled", false);

View File

@ -19,7 +19,7 @@ function testSelectTool(toolbox) {
toolbox.selectTool("options"); toolbox.selectTool("options");
} }
let testToggleJS = async function (toolbox) { let testToggleJS = async function(toolbox) {
ok(true, "Toolbox selected via selectTool method"); ok(true, "Toolbox selected via selectTool method");
await testJSEnabled(); await testJSEnabled();
@ -47,7 +47,7 @@ async function testJSEnabled() {
// takes a while to become live. // takes a while to become live.
await waitForTick(); await waitForTick();
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function () { await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
let doc = content.document; let doc = content.document;
let output = doc.getElementById("output"); let output = doc.getElementById("output");
doc.querySelector("#logJSEnabled").click(); doc.querySelector("#logJSEnabled").click();
@ -58,7 +58,7 @@ async function testJSEnabled() {
async function testJSEnabledIframe() { async function testJSEnabledIframe() {
info("Testing that JS is enabled in the iframe"); info("Testing that JS is enabled in the iframe");
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function () { await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
let doc = content.document; let doc = content.document;
let iframe = doc.querySelector("iframe"); let iframe = doc.querySelector("iframe");
let iframeDoc = iframe.contentDocument; let iframeDoc = iframe.contentDocument;
@ -87,7 +87,7 @@ async function toggleJS(toolbox) {
async function testJSDisabled() { async function testJSDisabled() {
info("Testing that JS is disabled"); info("Testing that JS is disabled");
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function () { await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
let doc = content.document; let doc = content.document;
let output = doc.getElementById("output"); let output = doc.getElementById("output");
doc.querySelector("#logJSDisabled").click(); doc.querySelector("#logJSDisabled").click();
@ -100,7 +100,7 @@ async function testJSDisabled() {
async function testJSDisabledIframe() { async function testJSDisabledIframe() {
info("Testing that JS is disabled in the iframe"); info("Testing that JS is disabled in the iframe");
await ContentTask.spawn(gBrowser.selectedBrowser, {}, function () { await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
let doc = content.document; let doc = content.document;
let iframe = doc.querySelector("iframe"); let iframe = doc.querySelector("iframe");
let iframeDoc = iframe.contentDocument; let iframeDoc = iframe.contentDocument;
@ -112,7 +112,7 @@ async function testJSDisabledIframe() {
} }
function finishUp(toolbox) { function finishUp(toolbox) {
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
finish(); finish();
}); });

View File

@ -107,7 +107,7 @@ function start() {
.then(reload) .then(reload)
.then(register) .then(register)
.then(testRegisterFails) .then(testRegisterFails)
.catch(function (e) { .catch(function(e) {
ok(false, "Some test failed with error " + e); ok(false, "Some test failed with error " + e);
}).then(finishUp); }).then(finishUp);
} }

View File

@ -7,7 +7,7 @@
"use strict"; "use strict";
addMessageListener("devtools:sw-test:register", function (msg) { addMessageListener("devtools:sw-test:register", function(msg) {
content.navigator.serviceWorker.register("serviceworker.js") content.navigator.serviceWorker.register("serviceworker.js")
.then(swr => { .then(swr => {
sendAsyncMessage("devtools:sw-test:register", {success: true}); sendAsyncMessage("devtools:sw-test:register", {success: true});
@ -16,18 +16,18 @@ addMessageListener("devtools:sw-test:register", function (msg) {
}); });
}); });
addMessageListener("devtools:sw-test:unregister", function (msg) { addMessageListener("devtools:sw-test:unregister", function(msg) {
content.navigator.serviceWorker.getRegistration().then(swr => { content.navigator.serviceWorker.getRegistration().then(swr => {
swr.unregister().then(result => { swr.unregister().then(result => {
sendAsyncMessage("devtools:sw-test:unregister", sendAsyncMessage("devtools:sw-test:unregister",
{success: result ? true : false}); {success: !!result});
}); });
}); });
}); });
addMessageListener("devtools:sw-test:iframe:register-and-unregister", function (msg) { addMessageListener("devtools:sw-test:iframe:register-and-unregister", function(msg) {
var frame = content.document.createElement("iframe"); var frame = content.document.createElement("iframe");
frame.addEventListener("load", function () { frame.addEventListener("load", function() {
frame.contentWindow.navigator.serviceWorker.register("serviceworker.js") frame.contentWindow.navigator.serviceWorker.register("serviceworker.js")
.then(swr => { .then(swr => {
return swr.unregister(); return swr.unregister();

View File

@ -13,7 +13,7 @@ requestLongerTimeout(2);
const URL = "data:text/html;charset=utf-8,Toggling devtools quickly"; const URL = "data:text/html;charset=utf-8,Toggling devtools quickly";
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser"); const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
add_task(async function () { add_task(async function() {
// Make sure this test starts with the selectedTool pref cleared. Previous // Make sure this test starts with the selectedTool pref cleared. Previous
// tests select various tools, and that sets this pref. // tests select various tools, and that sets this pref.
Services.prefs.clearUserPref("devtools.toolbox.selectedTool"); Services.prefs.clearUserPref("devtools.toolbox.selectedTool");

View File

@ -24,10 +24,10 @@ function testBottomHost(aToolbox) {
// switch to another tab and test toolbox.raise() // switch to another tab and test toolbox.raise()
gBrowser.selectedTab = tab2; gBrowser.selectedTab = tab2;
executeSoon(function () { executeSoon(function() {
is(gBrowser.selectedTab, tab2, "Correct tab is selected before calling raise"); is(gBrowser.selectedTab, tab2, "Correct tab is selected before calling raise");
toolbox.raise(); toolbox.raise();
executeSoon(function () { executeSoon(function() {
is(gBrowser.selectedTab, tab1, "Correct tab was selected after calling raise"); is(gBrowser.selectedTab, tab1, "Correct tab was selected after calling raise");
toolbox.switchHost(Toolbox.HostType.WINDOW).then(testWindowHost).catch(console.error); toolbox.switchHost(Toolbox.HostType.WINDOW).then(testWindowHost).catch(console.error);
@ -69,7 +69,7 @@ function onFocus() {
function cleanup() { function cleanup() {
Services.prefs.setCharPref("devtools.toolbox.host", Toolbox.HostType.BOTTOM); Services.prefs.setCharPref("devtools.toolbox.host", Toolbox.HostType.BOTTOM);
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
toolbox = null; toolbox = null;
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();

View File

@ -5,7 +5,7 @@
const TEST_URL = "data:text/html,test for toolbox being ready"; const TEST_URL = "data:text/html,test for toolbox being ready";
add_task(async function () { add_task(async function() {
let tab = await addTab(TEST_URL); let tab = await addTab(TEST_URL);
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -7,7 +7,7 @@ const URL_1 = "about:robots";
const URL_2 = "data:text/html;charset=UTF-8," + const URL_2 = "data:text/html;charset=UTF-8," +
encodeURIComponent("<div id=\"remote-page\">foo</div>"); encodeURIComponent("<div id=\"remote-page\">foo</div>");
add_task(async function () { add_task(async function() {
info("Open a tab on a URL supporting only running in parent process"); info("Open a tab on a URL supporting only running in parent process");
let tab = await addTab(URL_1); let tab = await addTab(URL_1);
is(tab.linkedBrowser.currentURI.spec, URL_1, "We really are on the expected document"); is(tab.linkedBrowser.currentURI.spec, URL_1, "We really are on the expected document");

View File

@ -9,7 +9,7 @@ const PAGE_URL = "data:text/html;charset=utf-8,test select events";
requestLongerTimeout(2); requestLongerTimeout(2);
add_task(async function () { add_task(async function() {
let tab = await addTab(PAGE_URL); let tab = await addTab(PAGE_URL);
let toolbox = await openToolboxForTab(tab, "webconsole", "bottom"); let toolbox = await openToolboxForTab(tab, "webconsole", "bottom");
@ -82,7 +82,7 @@ add_task(async function () {
} }
}; };
toolbox.once("select", onSelect); toolbox.once("select", onSelect);
let p1 = toolbox.selectTool("inspector") let p1 = toolbox.selectTool("inspector");
let p2 = toolbox.selectTool("inspector"); let p2 = toolbox.selectTool("inspector");
// Check that both promises don't resolve too early // Check that both promises don't resolve too early
let checkSelectToolResolution = panel => { let checkSelectToolResolution = panel => {

View File

@ -15,17 +15,17 @@ const testToolDefinition = {
url: "about:blank", url: "about:blank",
label: "someLabel", label: "someLabel",
build: (iframeWindow, toolbox) => { build: (iframeWindow, toolbox) => {
return { return {
target: toolbox.target, target: toolbox.target,
toolbox: toolbox, toolbox: toolbox,
isReady: true, isReady: true,
destroy: () => {}, destroy: () => {},
panelDoc: iframeWindow.document panelDoc: iframeWindow.document
}; };
} }
}; };
add_task(async function () { add_task(async function() {
gDevTools.registerTool(testToolDefinition); gDevTools.registerTool(testToolDefinition);
let tab = await addTab("about:blank"); let tab = await addTab("about:blank");
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -7,7 +7,7 @@
const PAGE_URL = "data:text/html;charset=utf-8,<body><div></div></body>"; const PAGE_URL = "data:text/html;charset=utf-8,<body><div></div></body>";
add_task(async function () { add_task(async function() {
let tab = await addTab(PAGE_URL); let tab = await addTab(PAGE_URL);
let toolbox = await openToolboxForTab(tab, "inspector", "bottom"); let toolbox = await openToolboxForTab(tab, "inspector", "bottom");
let inspector = toolbox.getCurrentPanel(); let inspector = toolbox.getCurrentPanel();

View File

@ -21,14 +21,14 @@ function test() {
url: CHROME_URL_ROOT + "browser_toolbox_sidebar_toolURL.xul", url: CHROME_URL_ROOT + "browser_toolbox_sidebar_toolURL.xul",
label: "FAKE TOOL!!!", label: "FAKE TOOL!!!",
isTargetSupported: () => true, isTargetSupported: () => true,
build: function (iframeWindow, toolbox) { build: function(iframeWindow, toolbox) {
let deferred = defer(); let deferred = defer();
executeSoon(() => { executeSoon(() => {
deferred.resolve({ deferred.resolve({
target: toolbox.target, target: toolbox.target,
toolbox: toolbox, toolbox: toolbox,
isReady: true, isReady: true,
destroy: function () {}, destroy: function() {},
panelDoc: iframeWindow.document, panelDoc: iframeWindow.document,
}); });
}); });
@ -38,9 +38,9 @@ function test() {
gDevTools.registerTool(toolDefinition); gDevTools.registerTool(toolDefinition);
addTab("about:blank").then(function (aTab) { addTab("about:blank").then(function(aTab) {
let target = TargetFactory.forTab(aTab); let target = TargetFactory.forTab(aTab);
gDevTools.showToolbox(target, toolDefinition.id).then(function (toolbox) { gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
let panel = toolbox.getPanel(toolDefinition.id); let panel = toolbox.getPanel(toolDefinition.id);
panel.toolbox = toolbox; panel.toolbox = toolbox;
ok(true, "Tool open"); ok(true, "Tool open");
@ -48,29 +48,29 @@ function test() {
let tabbox = panel.panelDoc.getElementById("sidebar"); let tabbox = panel.panelDoc.getElementById("sidebar");
panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true); panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true);
panel.sidebar.on("new-tab-registered", function (id) { panel.sidebar.on("new-tab-registered", function(id) {
registeredTabs[id] = true; registeredTabs[id] = true;
}); });
panel.sidebar.once("tab1-ready", function () { panel.sidebar.once("tab1-ready", function() {
info("tab1-ready"); info("tab1-ready");
readyTabs.tab1 = true; readyTabs.tab1 = true;
allTabsReady(panel); allTabsReady(panel);
}); });
panel.sidebar.once("tab2-ready", function () { panel.sidebar.once("tab2-ready", function() {
info("tab2-ready"); info("tab2-ready");
readyTabs.tab2 = true; readyTabs.tab2 = true;
allTabsReady(panel); allTabsReady(panel);
}); });
panel.sidebar.once("tab3-ready", function () { panel.sidebar.once("tab3-ready", function() {
info("tab3-ready"); info("tab3-ready");
readyTabs.tab3 = true; readyTabs.tab3 = true;
allTabsReady(panel); allTabsReady(panel);
}); });
panel.sidebar.once("tab1-selected", function () { panel.sidebar.once("tab1-selected", function() {
info("tab1-selected"); info("tab1-selected");
tab1Selected = true; tab1Selected = true;
allTabsReady(panel); allTabsReady(panel);
@ -107,9 +107,9 @@ function test() {
is(panel.sidebar._tabbox.selectedPanel, panels[0], "First tab is selected"); is(panel.sidebar._tabbox.selectedPanel, panels[0], "First tab is selected");
is(panel.sidebar.getCurrentTabID(), "tab1", "getCurrentTabID() is correct"); is(panel.sidebar.getCurrentTabID(), "tab1", "getCurrentTabID() is correct");
panel.sidebar.once("tab1-unselected", function () { panel.sidebar.once("tab1-unselected", function() {
ok(true, "received 'unselected' event"); ok(true, "received 'unselected' event");
panel.sidebar.once("tab2-selected", function () { panel.sidebar.once("tab2-selected", function() {
ok(true, "received 'selected' event"); ok(true, "received 'selected' event");
tabs[1].focus(); tabs[1].focus();
is(panel.sidebar._panelDoc.activeElement, tabs[1], is(panel.sidebar._panelDoc.activeElement, tabs[1],
@ -127,7 +127,7 @@ function test() {
} }
function testRemoval(panel) { function testRemoval(panel) {
panel.sidebar.once("tab-unregistered", function (id) { panel.sidebar.once("tab-unregistered", function(id) {
info("tab-unregistered"); info("tab-unregistered");
registeredTabs[id] = false; registeredTabs[id] = false;
@ -148,7 +148,7 @@ function test() {
function testWidth(panel) { function testWidth(panel) {
let tabbox = panel.panelDoc.getElementById("sidebar"); let tabbox = panel.panelDoc.getElementById("sidebar");
tabbox.width = 420; tabbox.width = 420;
panel.sidebar.destroy().then(function () { panel.sidebar.destroy().then(function() {
tabbox.width = 0; tabbox.width = 0;
panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true); panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true);
panel.sidebar.show(); panel.sidebar.show();
@ -160,12 +160,12 @@ function test() {
function finishUp(panel) { function finishUp(panel) {
panel.sidebar.destroy(); panel.sidebar.destroy();
panel.toolbox.destroy().then(function () { panel.toolbox.destroy().then(function() {
gDevTools.unregisterTool(toolDefinition.id); gDevTools.unregisterTool(toolDefinition.id);
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
executeSoon(function () { executeSoon(function() {
finish(); finish();
}); });
}); });

View File

@ -16,14 +16,14 @@ function test() {
url: CHROME_URL_ROOT + "browser_toolbox_sidebar_events.xul", url: CHROME_URL_ROOT + "browser_toolbox_sidebar_events.xul",
label: "Test tool", label: "Test tool",
isTargetSupported: () => true, isTargetSupported: () => true,
build: function (iframeWindow, toolbox) { build: function(iframeWindow, toolbox) {
let deferred = defer(); let deferred = defer();
executeSoon(() => { executeSoon(() => {
deferred.resolve({ deferred.resolve({
target: toolbox.target, target: toolbox.target,
toolbox: toolbox, toolbox: toolbox,
isReady: true, isReady: true,
destroy: function () {}, destroy: function() {},
panelDoc: iframeWindow.document, panelDoc: iframeWindow.document,
}); });
}); });
@ -33,28 +33,28 @@ function test() {
gDevTools.registerTool(toolDefinition); gDevTools.registerTool(toolDefinition);
addTab("about:blank").then(function (aTab) { addTab("about:blank").then(function(aTab) {
let target = TargetFactory.forTab(aTab); let target = TargetFactory.forTab(aTab);
gDevTools.showToolbox(target, toolDefinition.id).then(function (toolbox) { gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
let panel = toolbox.getPanel(toolDefinition.id); let panel = toolbox.getPanel(toolDefinition.id);
ok(true, "Tool open"); ok(true, "Tool open");
panel.once("sidebar-created", function () { panel.once("sidebar-created", function() {
collectedEvents.push("sidebar-created"); collectedEvents.push("sidebar-created");
}); });
panel.once("sidebar-destroyed", function () { panel.once("sidebar-destroyed", function() {
collectedEvents.push("sidebar-destroyed"); collectedEvents.push("sidebar-destroyed");
}); });
let tabbox = panel.panelDoc.getElementById("sidebar"); let tabbox = panel.panelDoc.getElementById("sidebar");
panel.sidebar = new ToolSidebar(tabbox, panel, "testbug1072208", true); panel.sidebar = new ToolSidebar(tabbox, panel, "testbug1072208", true);
panel.sidebar.once("show", function () { panel.sidebar.once("show", function() {
collectedEvents.push("show"); collectedEvents.push("show");
}); });
panel.sidebar.once("hide", function () { panel.sidebar.once("hide", function() {
collectedEvents.push("hide"); collectedEvents.push("hide");
}); });
@ -72,11 +72,11 @@ function test() {
is(events, "sidebar-created:show:hide:sidebar-destroyed", is(events, "sidebar-created:show:hide:sidebar-destroyed",
"Found the right amount of collected events."); "Found the right amount of collected events.");
panel.toolbox.destroy().then(function () { panel.toolbox.destroy().then(function() {
gDevTools.unregisterTool(toolDefinition.id); gDevTools.unregisterTool(toolDefinition.id);
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
executeSoon(function () { executeSoon(function() {
finish(); finish();
}); });
}); });

View File

@ -25,7 +25,7 @@ const testToolDefinition = {
} }
}; };
add_task(async function () { add_task(async function() {
let tab = await addTab("about:blank"); let tab = await addTab("about:blank");
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -26,7 +26,7 @@ const testToolDefinition = {
} }
}; };
add_task(async function () { add_task(async function() {
let tab = await addTab("about:blank"); let tab = await addTab("about:blank");
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -20,7 +20,7 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
}); });
add_task(async function () { add_task(async function() {
let tab = await addTab(URL); let tab = await addTab(URL);
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);
gToolbox = await gDevTools.showToolbox(target, "jsdebugger"); gToolbox = await gDevTools.showToolbox(target, "jsdebugger");

View File

@ -12,7 +12,7 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
const {LocalizationHelper} = require("devtools/shared/l10n"); const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
add_task(async function () { add_task(async function() {
let tab = await addTab("about:blank"); let tab = await addTab("about:blank");
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);
await target.makeRemote(); await target.makeRemote();

View File

@ -7,7 +7,7 @@
// iframe while defining which document to debug by setting a `target` // iframe while defining which document to debug by setting a `target`
// attribute refering to the document to debug. // attribute refering to the document to debug.
add_task(async function () { add_task(async function() {
// iframe loads the document to debug // iframe loads the document to debug
let iframe = document.createElement("browser"); let iframe = document.createElement("browser");
iframe.setAttribute("type", "content"); iframe.setAttribute("type", "content");

View File

@ -63,7 +63,7 @@ add_task(async function automaticallyBindTexbox() {
url: `data:text/html;charset=utf8,<input /><input type='text' /> url: `data:text/html;charset=utf8,<input /><input type='text' />
<input type='search' /><textarea></textarea><input type='radio' />`, <input type='search' /><textarea></textarea><input type='radio' />`,
label: "Context menu works without tool intervention", label: "Context menu works without tool intervention",
build: function (iframeWindow, toolbox) { build: function(iframeWindow, toolbox) {
this.panel = createTestPanel(iframeWindow, toolbox); this.panel = createTestPanel(iframeWindow, toolbox);
return this.panel.open(); return this.panel.open();
}, },

View File

@ -12,7 +12,7 @@ const URL = "data:text/html;charset=utf-8,Toggling devtools using shortcuts";
var {Toolbox} = require("devtools/client/framework/toolbox"); var {Toolbox} = require("devtools/client/framework/toolbox");
add_task(async function () { add_task(async function() {
// Make sure this test starts with the selectedTool pref cleared. Previous // Make sure this test starts with the selectedTool pref cleared. Previous
// tests select various tools, and that sets this pref. // tests select various tools, and that sets this pref.
Services.prefs.clearUserPref("devtools.toolbox.selectedTool"); Services.prefs.clearUserPref("devtools.toolbox.selectedTool");

View File

@ -8,7 +8,7 @@
requestLongerTimeout(5); requestLongerTimeout(5);
function performChecks(target) { function performChecks(target) {
return (async function () { return (async function() {
let toolIds = gDevTools.getToolDefinitionArray() let toolIds = gDevTools.getToolDefinitionArray()
.filter(def => def.isTargetSupported(target)) .filter(def => def.isTargetSupported(target))
.map(def => def.id); .map(def => def.id);
@ -31,7 +31,7 @@ function performChecks(target) {
} }
function test() { function test() {
Task.spawn(async function () { Task.spawn(async function() {
toggleAllTools(true); toggleAllTools(true);
let tab = await addTab("about:blank"); let tab = await addTab("about:blank");
let target = TargetFactory.forTab(tab); let target = TargetFactory.forTab(tab);

View File

@ -38,7 +38,7 @@ requestLongerTimeout(2);
*/ */
function runTools(target) { function runTools(target) {
return (async function () { return (async function() {
let toolIds = gDevTools.getToolDefinitionArray() let toolIds = gDevTools.getToolDefinitionArray()
.filter(def => def.isTargetSupported(target)) .filter(def => def.isTargetSupported(target))
.map(def => def.id); .map(def => def.id);
@ -88,7 +88,7 @@ function getTarget(client) {
} }
function test() { function test() {
Task.spawn(async function () { Task.spawn(async function() {
toggleAllTools(true); toggleAllTools(true);
await addTab("about:blank"); await addTab("about:blank");

View File

@ -9,7 +9,7 @@
// toolbar starts to present an overflow. // toolbar starts to present an overflow.
let { Toolbox } = require("devtools/client/framework/toolbox"); let { Toolbox } = require("devtools/client/framework/toolbox");
add_task(async function () { add_task(async function() {
let tab = await addTab("about:blank"); let tab = await addTab("about:blank");
info("Open devtools on the Inspector in a separate window"); info("Open devtools on the Inspector in a separate window");

View File

@ -53,7 +53,7 @@ function toolboxRegister(aToolbox) {
label: "per-toolbox Test Tool", label: "per-toolbox Test Tool",
inMenu: true, inMenu: true,
isTargetSupported: () => true, isTargetSupported: () => true,
build: function () { build: function() {
info("per-toolbox tool has been built."); info("per-toolbox tool has been built.");
resolveToolInstanceBuild(); resolveToolInstanceBuild();
@ -132,7 +132,7 @@ function toolboxToolUnregistered() {
} }
function cleanup() { function cleanup() {
toolbox.destroy().then(() => {; toolbox.destroy().then(() => {
toolbox = null; toolbox = null;
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
finish(); finish();

View File

@ -12,7 +12,7 @@ function test() {
gDevTools.on("toolbox-created", onToolboxCreated); gDevTools.on("toolbox-created", onToolboxCreated);
on(DebuggerClient, "connect", onDebuggerClientConnect); on(DebuggerClient, "connect", onDebuggerClientConnect);
addTab("about:blank").then(function () { addTab("about:blank").then(function() {
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "webconsole").then(testResults); gDevTools.showToolbox(target, "webconsole").then(testResults);
}); });
@ -29,10 +29,10 @@ function cleanUp(toolbox) {
gDevTools.off("toolbox-created", onToolboxCreated); gDevTools.off("toolbox-created", onToolboxCreated);
off(DebuggerClient, "connect", onDebuggerClientConnect); off(DebuggerClient, "connect", onDebuggerClientConnect);
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
setTimeout(() => { setTimeout(() => {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
executeSoon(function () { executeSoon(function() {
finish(); finish();
}); });
}, 1000); }, 1000);

View File

@ -12,7 +12,7 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = []; var toolbox, toolIDs, toolShortcuts = [], idIndex, modifiedPrefs = [];
function test() { function test() {
addTab("about:blank").then(function () { addTab("about:blank").then(function() {
toolIDs = []; toolIDs = [];
for (let [id, definition] of gDevTools._tools) { for (let [id, definition] of gDevTools._tools) {
let shortcut = Startup.KeyShortcuts.filter(s => s.toolId == id)[0]; let shortcut = Startup.KeyShortcuts.filter(s => s.toolId == id)[0];
@ -78,7 +78,7 @@ function selectCB(id) {
} }
function tidyUp() { function tidyUp() {
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
for (let pref of modifiedPrefs) { for (let pref of modifiedPrefs) {

View File

@ -21,10 +21,12 @@ function test() {
let toolbox; let toolbox;
addTab(URL_1).then(function () { addTab(URL_1).then(function() {
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM) gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM)
.then(function (aToolbox) { toolbox = aToolbox; }) .then(function(aToolbox) {
toolbox = aToolbox;
})
.then(() => toolbox.selectTool(TOOL_ID_1)) .then(() => toolbox.selectTool(TOOL_ID_1))
// undock toolbox and check title // undock toolbox and check title
@ -45,7 +47,7 @@ function test() {
.then(checkTitle.bind(null, NAME_1, URL_1, "tool changed")) .then(checkTitle.bind(null, NAME_1, URL_1, "tool changed"))
// navigate to different local url and check title // navigate to different local url and check title
.then(function () { .then(function() {
let onTitleChanged = waitForTitleChange(toolbox); let onTitleChanged = waitForTitleChange(toolbox);
gBrowser.loadURI(URL_2); gBrowser.loadURI(URL_2);
return onTitleChanged; return onTitleChanged;
@ -62,17 +64,19 @@ function test() {
// destroy toolbox, create new one hosted in a window (with a // destroy toolbox, create new one hosted in a window (with a
// different tool id), and check title // different tool id), and check title
.then(function () { .then(function() {
// Give the tools a chance to handle the navigation event before // Give the tools a chance to handle the navigation event before
// destroying the toolbox. // destroying the toolbox.
executeSoon(function () { executeSoon(function() {
toolbox.destroy() toolbox.destroy()
.then(function () { .then(function() {
// After destroying the toolbox, a fresh target is required. // After destroying the toolbox, a fresh target is required.
target = TargetFactory.forTab(gBrowser.selectedTab); target = TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(target, null, Toolbox.HostType.WINDOW); return gDevTools.showToolbox(target, null, Toolbox.HostType.WINDOW);
}) })
.then(function (aToolbox) { toolbox = aToolbox; }) .then(function(aToolbox) {
toolbox = aToolbox;
})
.then(() => { .then(() => {
let onTitleChanged = waitForTitleChange(toolbox); let onTitleChanged = waitForTitleChange(toolbox);
toolbox.selectTool(TOOL_ID_1); toolbox.selectTool(TOOL_ID_1);
@ -83,7 +87,7 @@ function test() {
// clean up // clean up
.then(() => toolbox.destroy()) .then(() => toolbox.destroy())
.then(function () { .then(function() {
toolbox = null; toolbox = null;
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
Services.prefs.clearUserPref("devtools.toolbox.host"); Services.prefs.clearUserPref("devtools.toolbox.host");

View File

@ -17,7 +17,7 @@ const IFRAME_URL = URL_ROOT + "browser_toolbox_window_title_changes_page.html";
const {LocalizationHelper} = require("devtools/shared/l10n"); const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties"); const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
add_task(async function () { add_task(async function() {
Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true); Services.prefs.setBoolPref("devtools.command-button-frames.enabled", true);
await addTab(URL); await addTab(URL);

View File

@ -58,7 +58,7 @@ function getCurrentZoom() {
} }
function tidyUp() { function tidyUp() {
toolbox.destroy().then(function () { toolbox.destroy().then(function() {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
toolbox = null; toolbox = null;

View File

@ -102,7 +102,6 @@ function checkGetTabFailures() {
} }
) )
.then(checkSelectedTabActor); .then(checkSelectedTabActor);
} }
function checkSelectedTabActor() { function checkSelectedTabActor() {
@ -118,7 +117,7 @@ function checkSelectedTabActor() {
function closeSecondTab() { function closeSecondTab() {
// Close the second tab, currently selected // Close the second tab, currently selected
let container = gBrowser.tabContainer; let container = gBrowser.tabContainer;
container.addEventListener("TabClose", function () { container.addEventListener("TabClose", function() {
checkFirstTabActor(); checkFirstTabActor();
}, {once: true}); }, {once: true});
gBrowser.removeTab(gTab2); gBrowser.removeTab(gTab2);
@ -136,7 +135,7 @@ function checkFirstTabActor() {
function cleanup() { function cleanup() {
let container = gBrowser.tabContainer; let container = gBrowser.tabContainer;
container.addEventListener("TabClose", function () { container.addEventListener("TabClose", function() {
gClient.close().then(finish); gClient.close().then(finish);
}, {once: true}); }, {once: true});
gBrowser.removeTab(gTab1); gBrowser.removeTab(gTab1);

View File

@ -23,8 +23,7 @@ function toggleAllTools(state) {
} }
} }
function getChromeActors(callback) function getChromeActors(callback) {
{
let { DebuggerServer } = require("devtools/server/main"); let { DebuggerServer } = require("devtools/server/main");
let { DebuggerClient } = require("devtools/shared/client/debugger-client"); let { DebuggerClient } = require("devtools/shared/client/debugger-client");
@ -62,7 +61,7 @@ async function openScratchpadWindow() {
await once(win, "load"); await once(win, "load");
win.Scratchpad.addObserver({ win.Scratchpad.addObserver({
onReady: function () { onReady: function() {
win.Scratchpad.removeObserver(this); win.Scratchpad.removeObserver(this);
resolve(win); resolve(win);
} }
@ -109,9 +108,8 @@ function executeInContent(name, data = {}, objects = {}, expectResponse = true)
mm.sendAsyncMessage(name, data, objects); mm.sendAsyncMessage(name, data, objects);
if (expectResponse) { if (expectResponse) {
return waitForContentMessage(name); return waitForContentMessage(name);
} else {
return promise.resolve();
} }
return promise.resolve();
} }
/** /**
@ -207,7 +205,7 @@ function DevToolPanel(iframeWindow, toolbox) {
} }
DevToolPanel.prototype = { DevToolPanel.prototype = {
open: function () { open: function() {
let deferred = defer(); let deferred = defer();
executeSoon(() => { executeSoon(() => {
@ -237,7 +235,7 @@ DevToolPanel.prototype = {
_isReady: false, _isReady: false,
destroy: function () { destroy: function() {
return defer(null); return defer(null);
}, },
}; };

View File

@ -50,7 +50,7 @@ async function checkCacheEnabled(tabX, expected) {
await reloadTab(tabX); await reloadTab(tabX);
let oldGuid = await ContentTask.spawn(gBrowser.selectedBrowser, {}, function () { let oldGuid = await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
let doc = content.document; let doc = content.document;
let h1 = doc.querySelector("h1"); let h1 = doc.querySelector("h1");
return h1.textContent; return h1.textContent;
@ -58,7 +58,7 @@ async function checkCacheEnabled(tabX, expected) {
await reloadTab(tabX); await reloadTab(tabX);
let guid = await ContentTask.spawn(gBrowser.selectedBrowser, {}, function () { let guid = await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
let doc = content.document; let doc = content.document;
let h1 = doc.querySelector("h1"); let h1 = doc.querySelector("h1");
return h1.textContent; return h1.textContent;
@ -91,7 +91,7 @@ function reloadTab(tabX) {
let def = defer(); let def = defer();
let browser = gBrowser.selectedBrowser; let browser = gBrowser.selectedBrowser;
BrowserTestUtils.browserLoaded(browser).then(function () { BrowserTestUtils.browserLoaded(browser).then(function() {
info("Reloaded tab " + tabX.title); info("Reloaded tab " + tabX.title);
def.resolve(); def.resolve();
}); });

View File

@ -2,9 +2,9 @@
info(`START: ${new Error().lineNumber}`); info(`START: ${new Error().lineNumber}`);
(async function () { (async function() {
Services.prefs.clearUserPref("devtools.debugger.tabs") Services.prefs.clearUserPref("devtools.debugger.tabs");
Services.prefs.clearUserPref("devtools.debugger.pending-selected-location") Services.prefs.clearUserPref("devtools.debugger.pending-selected-location");
info("Waiting for debugger load"); info("Waiting for debugger load");
await toolbox.selectTool("jsdebugger"); await toolbox.selectTool("jsdebugger");