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

View File

@ -74,7 +74,7 @@ function createToolMenuElements(toolDefinition, doc) {
return;
}
let oncommand = function (id, event) {
let oncommand = function(id, event) {
let window = event.target.ownerDocument.defaultView;
gDevToolsBrowser.selectToolCommand(window.gBrowser, id, window.performance.now());
}.bind(null, id);
@ -253,7 +253,7 @@ function removeTopLevelItems(doc) {
* @param {XULDocument} doc
* The document to which menus are to be added.
*/
exports.addMenus = function (doc) {
exports.addMenus = function(doc) {
addTopLevelItems(doc);
addAllToolsToMenu(doc);
@ -265,7 +265,7 @@ exports.addMenus = function (doc) {
* @param {XULDocument} doc
* 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
// unregistering each tool.
removeTopLevelItems(doc);

View File

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

View File

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

View File

@ -36,7 +36,7 @@ function Menu({ id = null } = {}) {
*
* @param {MenuItem} menuItem
*/
Menu.prototype.append = function (menuItem) {
Menu.prototype.append = function(menuItem) {
this.menuitems.push(menuItem);
};
@ -46,7 +46,7 @@ Menu.prototype.append = function (menuItem) {
* @param {int} pos
* @param {MenuItem} menuItem
*/
Menu.prototype.insert = function (pos, menuItem) {
Menu.prototype.insert = function(pos, menuItem) {
throw Error("Not implemented");
};
@ -62,7 +62,7 @@ Menu.prototype.insert = function (pos, menuItem) {
* @param Toolbox toolbox (non standard)
* 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 popupset = doc.querySelector("popupset");
// 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);
};
Menu.prototype._createMenuItems = function (parent) {
Menu.prototype._createMenuItems = function(parent) {
let doc = parent.ownerDocument;
this.menuitems.forEach(item => {
if (!item.visible) {

View File

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

View File

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

View File

@ -10,7 +10,7 @@ PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
// On debug test slave, it takes about 50s to run the test.
requestLongerTimeout(4);
add_task(async function () {
add_task(async function() {
await new Promise(done => {
let options = {"set": [
["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,
// 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 testScript = function () {
let testScript = function() {
toolbox.selectTool("webconsole")
.then(console => {
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.
// 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`;
Cu.evalInSandbox("(" + function () {
Cu.evalInSandbox("(" + function() {
this.plop = function plop() {
return 1;
};
@ -63,7 +63,7 @@ add_task(async function runTest() {
.getService(Ci.nsIEnvironment);
// First inject a very minimal head, with simplest assertion methods
// and very common globals
let testHead = (function () {
let testHead = (function() {
const info = msg => dump(msg + "\n");
const is = (a, b, description) => {
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 new Promise(resolve => {
setTimeout(function () {
setTimeout(function() {
waitUntil(predicate, interval).then(() => resolve(true));
}, interval);
});
@ -128,7 +128,7 @@ add_task(async function runTest() {
// toolbox process
let testScript = (await fetch(testScriptURL)).content;
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 + ':' + " +
" e.lineNumber + '\\nStack: ' + e.stack + '\\n');" +
"}";

View File

@ -22,7 +22,7 @@ function runTests1(tab) {
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
label: "someLabel",
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
let panel = createTestPanel(iframeWindow, toolbox);
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.tab, gBrowser.selectedTab, "targeted tab is correct");
@ -83,7 +83,7 @@ function runTests2() {
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
label: "someLabel",
build: function (iframeWindow, toolbox) {
build: function(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.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");
is(toolbox.currentToolId, toolId2, "toolbox _currentToolId is correct");
@ -183,7 +183,7 @@ var continueTests = async function (toolbox, panel) {
};
function destroyToolbox(toolbox) {
toolbox.destroy().then(function () {
toolbox.destroy().then(function() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
ok(gDevTools._toolboxes.get(target) == null, "gDevTools 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,
url: "about:blank",
label: "someLabel",
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
let deferred = defer();
executeSoon(() => {
deferred.resolve({
target: toolbox.target,
toolbox: toolbox,
isReady: true,
destroy: function () {},
destroy: function() {},
});
});
return deferred.promise;
@ -35,7 +35,7 @@ function runTests(aTab) {
let collectedEvents = [];
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);
ok(panel, "Tool open");
@ -55,7 +55,7 @@ function runTests(aTab) {
collectedEvents.push("toolbox-" + toolDefinition.id + "-destroy");
});
toolbox.destroy().then(function () {
toolbox.destroy().then(function() {
is(collectedEvents.join(":"),
"toolbox-destroy:destroy:gDevTools-testTool-destroy:toolbox-testTool-destroy",
"Found the right amount of collected events.");
@ -63,7 +63,7 @@ function runTests(aTab) {
gDevTools.unregisterTool(toolDefinition.id);
gBrowser.removeCurrentTab();
executeSoon(function () {
executeSoon(function() {
finish();
});
});

View File

@ -8,7 +8,7 @@
// Test that network requests originating from the toolbox don't get recorded in
// the network panel.
add_task(async function () {
add_task(async function() {
// 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
// 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
const TEST_URL = "data:text/html,<html><head><title>Test for the " +
"highlighter keybindings</title></head><body>" +
"<h1>Keybindings!</h1></body></html>"
"<h1>Keybindings!</h1></body></html>";
const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
let keysetMap = { };
@ -17,7 +17,7 @@ let keysetMap = { };
function buildDevtoolsKeysetMap(keyset) {
[].forEach.call(
keyset.querySelectorAll("key"),
function (key) {
function(key) {
if (!key.getAttribute("key")) {
return;
}
@ -34,7 +34,7 @@ function buildDevtoolsKeysetMap(keyset) {
metaKey: modifiers.match("meta"),
accelKey: modifiers.match("accel")
},
synthesizeKey: function () {
synthesizeKey: function() {
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:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1370442#c7
await SpecialPowers.pushPrefEnv({set: [

View File

@ -18,7 +18,7 @@ function getZoomValue() {
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");
let tab = await addTab(URL);
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 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");
let tab = await addTab(URL);
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 MenuItem = require("devtools/client/framework/menu-item");
add_task(async function () {
add_task(async function() {
info("Create a test tab and open the toolbox");
let tab = await addTab(URL);
let target = TargetFactory.forTab(tab);

View File

@ -10,9 +10,9 @@ var toolbox, target;
var tempScope = {};
function test() {
addTab("about:blank").then(function (aTab) {
addTab("about:blank").then(function(aTab) {
target = TargetFactory.forTab(gBrowser.selectedTab);
loadWebConsole(aTab).then(function () {
loadWebConsole(aTab).then(function() {
console.log("loaded");
});
});
@ -21,7 +21,7 @@ function test() {
function loadWebConsole(aTab) {
ok(gDevTools, "gDevTools exists");
return gDevTools.showToolbox(target, "webconsole").then(function (aToolbox) {
return gDevTools.showToolbox(target, "webconsole").then(function(aToolbox) {
toolbox = aToolbox;
checkToolLoading();
});
@ -31,15 +31,15 @@ function checkToolLoading() {
is(toolbox.currentToolId, "webconsole", "The web console is selected");
ok(toolbox.isReady, "toolbox is ready");
selectAndCheckById("jsdebugger").then(function () {
selectAndCheckById("styleeditor").then(function () {
selectAndCheckById("jsdebugger").then(function() {
selectAndCheckById("styleeditor").then(function() {
testToggle();
});
});
}
function selectAndCheckById(id) {
return toolbox.selectTool(id).then(function () {
return toolbox.selectTool(id).then(function() {
let tab = toolbox.doc.getElementById("toolbox-tab-" + id);
is(tab.classList.contains("selected"), true, "The " + id + " tab is selected");
is(tab.getAttribute("aria-pressed"), "true", "The " + id + " tab is pressed");
@ -50,7 +50,7 @@ function testToggle() {
toolbox.once("destroyed", () => {
// Cannot reuse a target after it's destroyed.
target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "styleeditor").then(function (aToolbox) {
gDevTools.showToolbox(target, "styleeditor").then(function(aToolbox) {
toolbox = aToolbox;
is(toolbox.currentToolId, "styleeditor", "The style editor is selected");
finishUp();
@ -61,7 +61,7 @@ function testToggle() {
}
function finishUp() {
toolbox.destroy().then(function () {
toolbox.destroy().then(function() {
toolbox = null;
target = null;
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 COFFEE_URL = `${URL_ROOT}code_binary_search.coffee`;
add_task(async function () {
add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true);
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 ORIGINAL_URL = `${URL_ROOT}code_binary_search.coffee`;
add_task(async function () {
add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true);
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 ORIGINAL_LINE = 12;
add_task(async function () {
add_task(async function() {
const toolbox = await openNewTabAndToolbox(PAGE_URL, "webconsole");
const service = toolbox.sourceMapURLService;

View File

@ -28,7 +28,7 @@ const ORIGINAL_URL = "webpack:///code_no_race.js";
const GENERATED_LINE = 84;
const ORIGINAL_LINE = 11;
add_task(async function () {
add_task(async function() {
// Opening the debugger causes the source actors to be created.
const toolbox = await openNewTabAndToolbox(PAGE_URL, "jsdebugger");
// 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 ORIGINAL_URL = "webpack:///code_inline_original.js";
add_task(async function () {
add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true);
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 ORIGINAL_LINE = 11;
add_task(async function () {
add_task(async function() {
// Start with the empty page, then navigate, so that we can properly
// listen for new sources arriving.
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 ORIGINAL_LINE = 13;
add_task(async function () {
add_task(async function() {
await pushPref("devtools.debugger.new-debugger-frontend", true);
// Start with the empty page, then navigate, so that we can properly

View File

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

View File

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

View File

@ -21,7 +21,7 @@ async function testTarget(client, target) {
let desc = await target.getActorDescription("webaudio");
is(desc.typeName, "webaudio",
"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");
desc = await target.getActorDescription("nope");

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ var {Toolbox} = require("devtools/client/framework/toolbox");
var toolbox = null;
function test() {
(async function () {
(async function() {
const URL = "data:text/plain;charset=UTF-8,Nothing to see here, move along";
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");
add_task(async function () {
add_task(async function() {
// Set size prefs to make the hosts way too big, so that the size has
// to be clamped to fit into the browser window.
Services.prefs.setIntPref("devtools.toolbox.footer.height", 10000);
@ -35,7 +35,7 @@ add_task(async function () {
await cleanup(toolbox);
});
add_task(async function () {
add_task(async function() {
// Set size prefs to something reasonable, so we can check to make sure
// they are being set properly.
Services.prefs.setIntPref("devtools.toolbox.footer.height", 100);

View File

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

View File

@ -13,13 +13,15 @@ const TEST_URL =
function containsFocus(aDoc, aElm) {
let elm = aDoc.activeElement;
while (elm) {
if (elm === aElm) { return true; }
if (elm === aElm) {
return true;
}
elm = elm.parentNode;
}
return false;
}
add_task(async function () {
add_task(async function() {
info("Create a test tab and open the toolbox");
let toolbox = await openNewTabAndToolbox(TEST_URL, "webconsole");
let doc = toolbox.doc;
@ -83,7 +85,7 @@ add_task(async function () {
});
// 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");
let toolbox = await openNewTabAndToolbox(TEST_URL, "inspector");
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 {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 " +
"and unregistering tools";
registerNewTool();
@ -180,7 +180,7 @@ async function testMouseClick(node, prefValue) {
// We use executeSoon here to ensure that the element is in view and
// clickable.
executeSoon(function () {
executeSoon(function() {
info("Click event synthesized for pref " + pref);
EventUtils.synthesizeMouseAtCenter(node, {}, panelWin);
});
@ -204,7 +204,6 @@ async function testToggleTools() {
.concat(gDevTools.getAdditionalTools())
.concat(toolbox.getAdditionalTools());
for (let node of toolNodes) {
let id = node.getAttribute("id");
ok(toggleableTools.some(tool => tool.id === id),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
"use strict";
addMessageListener("devtools:sw-test:register", function (msg) {
addMessageListener("devtools:sw-test:register", function(msg) {
content.navigator.serviceWorker.register("serviceworker.js")
.then(swr => {
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 => {
swr.unregister().then(result => {
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");
frame.addEventListener("load", function () {
frame.addEventListener("load", function() {
frame.contentWindow.navigator.serviceWorker.register("serviceworker.js")
.then(swr => {
return swr.unregister();

View File

@ -13,7 +13,7 @@ requestLongerTimeout(2);
const URL = "data:text/html;charset=utf-8,Toggling devtools quickly";
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
// tests select various tools, and that sets this pref.
Services.prefs.clearUserPref("devtools.toolbox.selectedTool");

View File

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

View File

@ -5,7 +5,7 @@
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 target = TargetFactory.forTab(tab);

View File

@ -7,7 +7,7 @@ const URL_1 = "about:robots";
const URL_2 = "data:text/html;charset=UTF-8," +
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");
let tab = await addTab(URL_1);
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);
add_task(async function () {
add_task(async function() {
let tab = await addTab(PAGE_URL);
let toolbox = await openToolboxForTab(tab, "webconsole", "bottom");
@ -82,7 +82,7 @@ add_task(async function () {
}
};
toolbox.once("select", onSelect);
let p1 = toolbox.selectTool("inspector")
let p1 = toolbox.selectTool("inspector");
let p2 = toolbox.selectTool("inspector");
// Check that both promises don't resolve too early
let checkSelectToolResolution = panel => {

View File

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

View File

@ -7,7 +7,7 @@
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 toolbox = await openToolboxForTab(tab, "inspector", "bottom");
let inspector = toolbox.getCurrentPanel();

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend");
});
add_task(async function () {
add_task(async function() {
let tab = await addTab(URL);
let target = TargetFactory.forTab(tab);
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 L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
add_task(async function () {
add_task(async function() {
let tab = await addTab("about:blank");
let target = TargetFactory.forTab(tab);
await target.makeRemote();

View File

@ -7,7 +7,7 @@
// iframe while defining which document to debug by setting a `target`
// attribute refering to the document to debug.
add_task(async function () {
add_task(async function() {
// iframe loads the document to debug
let iframe = document.createElement("browser");
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' />
<input type='search' /><textarea></textarea><input type='radio' />`,
label: "Context menu works without tool intervention",
build: function (iframeWindow, toolbox) {
build: function(iframeWindow, toolbox) {
this.panel = createTestPanel(iframeWindow, toolbox);
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");
add_task(async function () {
add_task(async function() {
// Make sure this test starts with the selectedTool pref cleared. Previous
// tests select various tools, and that sets this pref.
Services.prefs.clearUserPref("devtools.toolbox.selectedTool");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -102,7 +102,6 @@ function checkGetTabFailures() {
}
)
.then(checkSelectedTabActor);
}
function checkSelectedTabActor() {
@ -118,7 +117,7 @@ function checkSelectedTabActor() {
function closeSecondTab() {
// Close the second tab, currently selected
let container = gBrowser.tabContainer;
container.addEventListener("TabClose", function () {
container.addEventListener("TabClose", function() {
checkFirstTabActor();
}, {once: true});
gBrowser.removeTab(gTab2);
@ -136,7 +135,7 @@ function checkFirstTabActor() {
function cleanup() {
let container = gBrowser.tabContainer;
container.addEventListener("TabClose", function () {
container.addEventListener("TabClose", function() {
gClient.close().then(finish);
}, {once: true});
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 { DebuggerClient } = require("devtools/shared/client/debugger-client");
@ -62,7 +61,7 @@ async function openScratchpadWindow() {
await once(win, "load");
win.Scratchpad.addObserver({
onReady: function () {
onReady: function() {
win.Scratchpad.removeObserver(this);
resolve(win);
}
@ -109,9 +108,8 @@ function executeInContent(name, data = {}, objects = {}, expectResponse = true)
mm.sendAsyncMessage(name, data, objects);
if (expectResponse) {
return waitForContentMessage(name);
} else {
return promise.resolve();
}
return promise.resolve();
}
/**
@ -207,7 +205,7 @@ function DevToolPanel(iframeWindow, toolbox) {
}
DevToolPanel.prototype = {
open: function () {
open: function() {
let deferred = defer();
executeSoon(() => {
@ -237,7 +235,7 @@ DevToolPanel.prototype = {
_isReady: false,
destroy: function () {
destroy: function() {
return defer(null);
},
};

View File

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

View File

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