--- a/devtools/client/debugger/debugger-view.js
+++ b/devtools/client/debugger/debugger-view.js
@@ -213,17 +213,17 @@ var DebuggerView = {
VariablesViewController.attach(this.Variables, {
getEnvironmentClient: aObject => gThreadClient.environment(aObject),
getObjectClient: aObject => {
return gThreadClient.pauseGrip(aObject);
}
});
// Relay events from the VariablesView.
- this.Variables.on("fetched", (aEvent, aType) => {
+ this.Variables.on("fetched", aType => {
switch (aType) {
case "scopes":
window.emit(EVENTS.FETCHED_SCOPES);
break;
case "variables":
window.emit(EVENTS.FETCHED_VARIABLES);
break;
case "properties":
--- a/devtools/client/debugger/views/variable-bubble-view.js
+++ b/devtools/client/debugger/views/variable-bubble-view.js
@@ -210,17 +210,17 @@ VariableBubbleView.prototype = {
}
}, {
getEnvironmentClient: aObject => gThreadClient.environment(aObject),
getObjectClient: aObject => gThreadClient.pauseGrip(aObject),
simpleValueEvalMacro: this._getSimpleValueEvalMacro(evalPrefix),
getterOrSetterEvalMacro: this._getGetterOrSetterEvalMacro(evalPrefix),
overrideValueEvalMacro: this._getOverrideValueEvalMacro(evalPrefix)
}, {
- fetched: (aEvent, aType) => {
+ fetched: aType => {
if (aType == "properties") {
window.emit(EVENTS.FETCHED_BUBBLE_PROPERTIES);
}
}
}, [{
label: L10N.getStr("addWatchExpressionButton"),
className: "dbg-expression-button",
command: () => {
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -809,17 +809,17 @@ Toolbox.prototype = {
button.isVisible = this._commandIsVisible(button);
EventEmitter.decorate(button);
return button;
},
_buildOptions: function () {
- let selectOptions = (name, event) => {
+ let selectOptions = event => {
// Flip back to the last used panel if we are already
// on the options panel.
if (this.currentToolId === "options" &&
gDevTools.getToolDefinition(this.lastUsedToolId)) {
this.selectTool(this.lastUsedToolId);
} else {
this.selectTool("options");
}
@@ -849,59 +849,59 @@ Toolbox.prototype = {
* The electron key shortcut.
* @param {Function} handler
* The callback that should be called when the provided key shortcut is pressed.
* @param {String} whichTool
* The tool the key belongs to. The corresponding handler will only be triggered
* if this tool is active.
*/
useKeyWithSplitConsole: function (key, handler, whichTool) {
- this.shortcuts.on(key, (name, event) => {
+ this.shortcuts.on(key, event => {
if (this.currentToolId === whichTool && this.isSplitConsoleFocused()) {
handler();
event.preventDefault();
}
});
},
_addReloadKeys: function () {
[
["reload", false],
["reload2", false],
["forceReload", true],
["forceReload2", true]
].forEach(([id, force]) => {
let key = L10N.getStr("toolbox." + id + ".key");
- this.shortcuts.on(key, (name, event) => {
+ this.shortcuts.on(key, event => {
this.reloadTarget(force);
// Prevent Firefox shortcuts from reloading the page
event.preventDefault();
});
});
},
_addHostListeners: function () {
this.shortcuts.on(L10N.getStr("toolbox.nextTool.key"),
- (name, event) => {
+ event => {
this.selectNextTool();
event.preventDefault();
});
this.shortcuts.on(L10N.getStr("toolbox.previousTool.key"),
- (name, event) => {
+ event => {
this.selectPreviousTool();
event.preventDefault();
});
this.shortcuts.on(L10N.getStr("toolbox.minimize.key"),
- (name, event) => {
+ event => {
this._toggleMinimizeMode();
event.preventDefault();
});
this.shortcuts.on(L10N.getStr("toolbox.toggleHost.key"),
- (name, event) => {
+ event => {
this.switchToPreviousHost();
event.preventDefault();
});
this.doc.addEventListener("keypress", this._splitConsoleOnKeypress);
this.doc.addEventListener("focus", this._onFocus, true);
this.win.addEventListener("unload", this.destroy);
this.win.addEventListener("message", this._onBrowserMessage, true);
@@ -2258,17 +2258,17 @@ Toolbox.prototype = {
handleKeyDownOnFramesButton: function (event) {
this.shortcuts.on(L10N.getStr("toolbox.showFrames.key"),
this.showFramesMenuOnKeyDown);
},
/**
* Show 'frames' menu on key down
*/
- showFramesMenuOnKeyDown: function (name, event) {
+ showFramesMenuOnKeyDown: function (event) {
if (event.target.id == "command-button-frames") {
this.showFramesMenu(event);
}
},
/**
* Select a frame by sending 'switchToFrame' packet to the backend.
*/
--- a/devtools/client/inspector/breadcrumbs.js
+++ b/devtools/client/inspector/breadcrumbs.js
@@ -573,29 +573,33 @@ HTMLBreadcrumbs.prototype = {
/**
* Handle a keyboard shortcut supported by the breadcrumbs widget.
*
* @param {String} name
* Name of the keyboard shortcut received.
* @param {DOMEvent} event
* Original event that triggered the shortcut.
*/
- handleShortcut: function (name, event) {
+ handleShortcut: function (event) {
if (!this.selection.isElementNode()) {
return;
}
event.preventDefault();
event.stopPropagation();
this.keyPromise = (this.keyPromise || promise.resolve(null)).then(() => {
let currentnode;
- if (name === "Left" && this.currentIndex != 0) {
+
+ const isLeft = event.code === "ArrowLeft";
+ const isRight = event.code === "ArrowRight";
+
+ if (isLeft && this.currentIndex != 0) {
currentnode = this.nodeHierarchy[this.currentIndex - 1];
- } else if (name === "Right" && this.currentIndex < this.nodeHierarchy.length - 1) {
+ } else if (isRight && this.currentIndex < this.nodeHierarchy.length - 1) {
currentnode = this.nodeHierarchy[this.currentIndex + 1];
} else {
return null;
}
this.outer.setAttribute("aria-activedescendant", currentnode.button.id);
return this.selection.setNodeFront(currentnode.node, "breadcrumbs");
});
--- a/devtools/client/inspector/computed/computed.js
+++ b/devtools/client/inspector/computed/computed.js
@@ -179,18 +179,18 @@ function CssComputedView(inspector, docu
this.element = doc.getElementById("computed-property-container");
this.boxModelWrapper = doc.getElementById("boxmodel-wrapper");
this.searchField = doc.getElementById("computed-searchbox");
this.searchClearButton = doc.getElementById("computed-searchinput-clear");
this.includeBrowserStylesCheckbox = doc.getElementById("browser-style-checkbox");
this.shortcuts = new KeyShortcuts({ window: this.styleWindow });
this._onShortcut = this._onShortcut.bind(this);
- this.shortcuts.on("CmdOrCtrl+F", this._onShortcut);
- this.shortcuts.on("Escape", this._onShortcut);
+ this.shortcuts.on("CmdOrCtrl+F", event => this._onShortcut("CmdOrCtrl+F", event));
+ this.shortcuts.on("Escape", event => this._onShortcut("Escape", event));
this.styleDocument.addEventListener("copy", this._onCopy);
this.styleDocument.addEventListener("mousedown", this.focusWindow);
this.element.addEventListener("click", this._onClick);
this.element.addEventListener("contextmenu", this._onContextMenu);
this.searchField.addEventListener("input", this._onFilterStyles);
this.searchClearButton.addEventListener("click", this._onClearSearch);
this.includeBrowserStylesCheckbox.addEventListener("input",
this._onIncludeBrowserStyles);
@@ -970,24 +970,24 @@ PropertyView.prototype = {
this.element.addEventListener("dblclick", this.onMatchedToggle);
// Make it keyboard navigable
this.element.setAttribute("tabindex", "0");
this.shortcuts = new KeyShortcuts({
window: this.tree.styleWindow,
target: this.element
});
- this.shortcuts.on("F1", (name, event) => {
+ this.shortcuts.on("F1", event => {
this.mdnLinkClick(event);
// Prevent opening the options panel
event.preventDefault();
event.stopPropagation();
});
- this.shortcuts.on("Return", (name, event) => this.onMatchedToggle(event));
- this.shortcuts.on("Space", (name, event) => this.onMatchedToggle(event));
+ this.shortcuts.on("Return", this.onMatchedToggle);
+ this.shortcuts.on("Space", this.onMatchedToggle);
let nameContainer = doc.createElementNS(HTML_NS, "span");
nameContainer.className = "computed-property-name-container";
this.element.appendChild(nameContainer);
// Build the twisty expand/collapse
this.matchedExpander = doc.createElementNS(HTML_NS, "div");
this.matchedExpander.className = "computed-expander theme-twisty";
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -386,17 +386,17 @@ Inspector.prototype = {
this.search = new InspectorSearch(this, this.searchBox, this.searchClearButton);
this.search.on("search-cleared", this._updateSearchResultsLabel);
this.search.on("search-result", this._updateSearchResultsLabel);
let shortcuts = new KeyShortcuts({
window: this.panelDoc.defaultView,
});
let key = INSPECTOR_L10N.getStr("inspector.searchHTML.key");
- shortcuts.on(key, (name, event) => {
+ shortcuts.on(key, event => {
// Prevent overriding same shortcut from the computed/rule views
if (event.target.closest("#sidebar-panel-ruleview") ||
event.target.closest("#sidebar-panel-computedview")) {
return;
}
event.preventDefault();
this.searchBox.focus();
});
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -685,23 +685,23 @@ MarkupView.prototype = {
this._onShortcut = this._onShortcut.bind(this);
// Process localizable keys
["markupView.hide.key",
"markupView.edit.key",
"markupView.scrollInto.key"].forEach(name => {
let key = INSPECTOR_L10N.getStr(name);
- shortcuts.on(key, (_, event) => this._onShortcut(name, event));
+ shortcuts.on(key, event => this._onShortcut(name, event));
});
// Process generic keys:
["Delete", "Backspace", "Home", "Left", "Right", "Up", "Down", "PageUp",
"PageDown", "Esc", "Enter", "Space"].forEach(key => {
- shortcuts.on(key, this._onShortcut);
+ shortcuts.on(key, event => this._onShortcut(key, event));
});
},
/**
* Key shortcut listener.
*/
_onShortcut(name, event) {
if (this._isInputOrTextarea(event.target)) {
--- a/devtools/client/inspector/rules/rules.js
+++ b/devtools/client/inspector/rules/rules.js
@@ -135,36 +135,39 @@ function CssRuleView(inspector, document
this.hoverCheckbox = doc.getElementById("pseudo-hover-toggle");
this.activeCheckbox = doc.getElementById("pseudo-active-toggle");
this.focusCheckbox = doc.getElementById("pseudo-focus-toggle");
this.searchClearButton.hidden = true;
this.shortcuts = new KeyShortcuts({ window: this.styleWindow });
this._onShortcut = this._onShortcut.bind(this);
- this.shortcuts.on("Escape", this._onShortcut);
- this.shortcuts.on("Return", this._onShortcut);
- this.shortcuts.on("Space", this._onShortcut);
- this.shortcuts.on("CmdOrCtrl+F", this._onShortcut);
+ this.shortcuts.on("Escape", event => this._onShortcut("Escape", event));
+ this.shortcuts.on("Return", event => this._onShortcut("Return", event));
+ this.shortcuts.on("Space", event => this._onShortcut("Space", event));
+ this.shortcuts.on("CmdOrCtrl+F", event => this._onShortcut("CmdOrCtrl+F", event));
this.element.addEventListener("copy", this._onCopy);
this.element.addEventListener("contextmenu", this._onContextMenu);
this.addRuleButton.addEventListener("click", this._onAddRule);
this.searchField.addEventListener("input", this._onFilterStyles);
this.searchClearButton.addEventListener("click", this._onClearSearch);
this.pseudoClassToggle.addEventListener("click", this._onTogglePseudoClassPanel);
this.classToggle.addEventListener("click", this._onToggleClassPanel);
this.hoverCheckbox.addEventListener("click", this._onTogglePseudoClass);
this.activeCheckbox.addEventListener("click", this._onTogglePseudoClass);
this.focusCheckbox.addEventListener("click", this._onTogglePseudoClass);
this._handlePrefChange = this._handlePrefChange.bind(this);
+ this._handleUAStylePrefChange = this._handleUAStylePrefChange.bind(this);
+ this._handleDefaultColorUnitPrefChange =
+ this._handleDefaultColorUnitPrefChange.bind(this);
this._prefObserver = new PrefObserver("devtools.");
- this._prefObserver.on(PREF_UA_STYLES, this._handlePrefChange);
- this._prefObserver.on(PREF_DEFAULT_COLOR_UNIT, this._handlePrefChange);
+ this._prefObserver.on(PREF_UA_STYLES, this._handleUAStylePrefChange);
+ this._prefObserver.on(PREF_DEFAULT_COLOR_UNIT, this._handleDefaultColorUnitPrefChange);
this.showUserAgentStyles = Services.prefs.getBoolPref(PREF_UA_STYLES);
// The popup will be attached to the toolbox document.
this.popup = new AutocompletePopup(inspector._toolbox.doc, {
autoSelect: true,
theme: "auto"
});
@@ -566,21 +569,26 @@ CssRuleView.prototype = {
* editor visible.
*/
get isEditing() {
return this.tooltips.isEditing ||
this.element.querySelectorAll(".styleinspector-propertyeditor")
.length > 0;
},
+ _handleUAStylePrefChange: function () {
+ this.showUserAgentStyles = Services.prefs.getBoolPref(PREF_UA_STYLES);
+ this._handlePrefChange(PREF_UA_STYLES);
+ },
+
+ _handleDefaultColorUnitPrefChange: function () {
+ this._handlePrefChange(PREF_DEFAULT_COLOR_UNIT);
+ },
+
_handlePrefChange: function (pref) {
- if (pref === PREF_UA_STYLES) {
- this.showUserAgentStyles = Services.prefs.getBoolPref(pref);
- }
-
// Reselect the currently selected element
let refreshOnPrefs = [PREF_UA_STYLES, PREF_DEFAULT_COLOR_UNIT];
if (refreshOnPrefs.indexOf(pref) > -1) {
this.selectElement(this._viewedElement, true);
}
},
/**
@@ -688,19 +696,22 @@ CssRuleView.prototype = {
return false;
},
destroy: function () {
this.isDestroyed = true;
this.clear();
this._dummyElement = null;
-
- this._prefObserver.off(PREF_UA_STYLES, this._handlePrefChange);
- this._prefObserver.off(PREF_DEFAULT_COLOR_UNIT, this._handlePrefChange);
+ // off handlers must have the same reference as their on handlers
+ this._prefObserver.off(PREF_UA_STYLES, this._handleUAStylePrefChange);
+ this._prefObserver.off(
+ PREF_DEFAULT_COLOR_UNIT,
+ this._handleDefaultColorUnitPrefChange
+ );
this._prefObserver.destroy();
this._outputParser = null;
// Remove context menu
if (this._contextmenu) {
this._contextmenu.destroy();
this._contextmenu = null;
--- a/devtools/client/inspector/rules/test/browser_rules_colorpicker-release-outside-frame.js
+++ b/devtools/client/inspector/rules/test/browser_rules_colorpicker-release-outside-frame.js
@@ -28,17 +28,17 @@ add_task(function* () {
yield onRuleViewChanged;
let value = yield change;
info(`Color changed to ${value} on mousedown.`);
// If the mousemove below fails to detect that the button is no longer pressed
// the spectrum will update and emit changed event synchronously after calling
// synthesizeMouse so this handler is executed before the test ends.
- spectrum.once("changed", (event, newValue) => {
+ spectrum.once("changed", newValue => {
is(newValue, value, "Value changed on mousemove without a button pressed.");
});
// Releasing the button pressed by mousedown above on top of a different frame
// does not make sense in this test as EventUtils doesn't preserve the context
// i.e. the buttons that were pressed down between events.
info("Moving mouse over color picker without any buttons pressed.");
--- a/devtools/client/netmonitor/src/components/StatisticsPanel.js
+++ b/devtools/client/netmonitor/src/components/StatisticsPanel.js
@@ -180,17 +180,17 @@ class StatisticsPanel extends Component
let string = getTimeWithDecimals(seconds);
return PluralForm.get(seconds,
L10N.getStr("charts.totalSecondsNonBlocking")).replace("#1", string);
},
},
sorted: true,
});
- chart.on("click", (_, { label }) => {
+ chart.on("click", ({ label }) => {
// Reset FilterButtons and enable one filter exclusively
this.props.closeStatistics();
this.props.enableRequestFilterTypeOnly(label);
});
let container = this.refs[id];
// Nuke all existing charts of the specified type.
--- a/devtools/client/performance/test/browser_perf-tree-abstract-01.js
+++ b/devtools/client/performance/test/browser_perf-tree-abstract-01.js
@@ -46,17 +46,17 @@ add_task(function* () {
"The root node's container is correct.");
// Expand the root and test the child items...
let receivedExpandEvent = once(treeRoot, "expand", { spreadArgs: true });
let receivedFocusEvent = once(treeRoot, "focus");
mousedown(treeRoot.target.querySelector(".arrow"));
- let [, eventItem] = yield receivedExpandEvent;
+ let [eventItem] = yield receivedExpandEvent;
is(eventItem, treeRoot,
"The 'expand' event target is correct (1).");
yield receivedFocusEvent;
is(document.commandDispatcher.focusedElement, treeRoot.target,
"The root node is now focused.");
let fooItem = treeRoot.getChild(0);
@@ -97,29 +97,29 @@ add_task(function* () {
is(barItem.container, container,
"The 'bar' node's container is correct.");
// Test clicking on the `foo` node...
receivedFocusEvent = once(treeRoot, "focus", { spreadArgs: true });
mousedown(fooItem.target);
- [, eventItem] = yield receivedFocusEvent;
+ [eventItem] = yield receivedFocusEvent;
is(eventItem, fooItem,
"The 'focus' event target is correct (2).");
is(document.commandDispatcher.focusedElement, fooItem.target,
"The 'foo' node is now focused.");
// Test double clicking on the `bar` node...
receivedExpandEvent = once(treeRoot, "expand", { spreadArgs: true });
receivedFocusEvent = once(treeRoot, "focus");
dblclick(barItem.target);
- [, eventItem] = yield receivedExpandEvent;
+ [eventItem] = yield receivedExpandEvent;
is(eventItem, barItem,
"The 'expand' event target is correct (3).");
yield receivedFocusEvent;
is(document.commandDispatcher.focusedElement, barItem.target,
"The 'foo' node is now focused.");
// A child item got expanded, test the descendants...
--- a/devtools/client/performance/test/browser_perf-tree-view-06.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-06.js
@@ -23,17 +23,17 @@ add_task(function* () {
let container = document.createElement("vbox");
treeRoot.attachTo(container);
let A = treeRoot.getChild();
let B = A.getChild();
let D = B.getChild();
let linkEvent = null;
- let handler = (_, e) => {
+ let handler = (e) => {
linkEvent = e;
};
treeRoot.on("link", handler);
// Fire right click.
rightMousedown(D.target.querySelector(".call-tree-url"));
--- a/devtools/client/performance/views/details-abstract-subview.js
+++ b/devtools/client/performance/views/details-abstract-subview.js
@@ -160,34 +160,34 @@ var DetailsSubview = {
this.render(OverviewView.getTimeInterval());
this.shouldUpdateWhenShown = false;
}
},
/**
* Fired when a preference in `devtools.performance.ui.` is changed.
*/
- _onPrefChanged: function (_, prefName) {
+ _onPrefChanged: function (_, prefName, prefValue) {
if (~this.observedPrefs.indexOf(prefName) && this._onObservedPrefChange) {
- this._onObservedPrefChange(_, prefName);
+ this._onObservedPrefChange(prefName);
}
// All detail views require a recording to be complete, so do not
// attempt to render if recording is in progress or does not exist.
let recording = PerformanceController.getCurrentRecording();
if (!recording || !recording.isCompleted()) {
return;
}
if (!~this.rerenderPrefs.indexOf(prefName)) {
return;
}
if (this._onRerenderPrefChanged) {
- this._onRerenderPrefChanged(_, prefName);
+ this._onRerenderPrefChanged(prefName);
}
if (DetailsView.isViewSelected(this) || this.canUpdateWhileHidden) {
this.render(OverviewView.getTimeInterval());
} else {
this.shouldUpdateWhenShown = true;
}
}
--- a/devtools/client/performance/views/details-js-call-tree.js
+++ b/devtools/client/performance/views/details-js-call-tree.js
@@ -76,17 +76,17 @@ var JsCallTreeView = extend(DetailsSubvi
showOptimizations: function () {
this.optimizationsElement.classList.remove("hidden");
},
hideOptimizations: function () {
this.optimizationsElement.classList.add("hidden");
},
- _onFocus: function (_, treeItem) {
+ _onFocus: function (treeItem) {
let showOptimizations = PerformanceController.getOption("show-jit-optimizations");
let frameNode = treeItem.frame;
let optimizationSites = frameNode && frameNode.hasOptimizations()
? frameNode.getOptimizations().optimizationSites
: [];
if (!showOptimizations || !frameNode || optimizationSites.length === 0) {
this.hideOptimizations();
--- a/devtools/client/performance/views/details-waterfall.js
+++ b/devtools/client/performance/views/details-waterfall.js
@@ -129,17 +129,17 @@ var WaterfallView = extend(DetailsSubvie
setNamedTimeout("waterfall-resize", WATERFALL_RESIZE_EVENTS_DRAIN, () => {
this.render(OverviewView.getTimeInterval());
});
},
/**
* Called whenever an observed pref is changed.
*/
- _onObservedPrefChange: function (_, prefName) {
+ _onObservedPrefChange: function (prefName) {
this._hiddenMarkers = PerformanceController.getPref("hidden-markers");
// Clear the cache as we'll need to recompute the collapsed
// marker model
this._cache = new WeakMap();
},
/**
--- a/devtools/client/performance/views/toolbar.js
+++ b/devtools/client/performance/views/toolbar.js
@@ -139,17 +139,17 @@ var ToolbarView = {
let hiddenMarkers = Array.map(checkedMenuItems, e => e.getAttribute("marker-type"));
PerformanceController.setPref("hidden-markers", hiddenMarkers);
},
/**
* Fired when a preference changes in the underlying OptionsView.
* Propogated by the PerformanceController.
*/
- _onPrefChanged: function (_, prefName) {
+ _onPrefChanged: function (prefName) {
let value = PerformanceController.getOption(prefName);
if (prefName === "experimental") {
this._toggleExperimentalUI(value);
}
this.emit(EVENTS.UI_PREF_CHANGED, prefName, value);
},
--- a/devtools/client/shared/autocomplete-popup.js
+++ b/devtools/client/shared/autocomplete-popup.js
@@ -3,17 +3,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const Services = require("Services");
const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {PrefObserver} = require("devtools/client/shared/prefs");
let itemIdCounter = 0;
/**
* Autocomplete popup UI implementation.
*
* @constructor
* @param {Document} toolboxDoc
--- a/devtools/client/shared/components/SearchBox.js
+++ b/devtools/client/shared/components/SearchBox.js
@@ -45,17 +45,17 @@ class SearchBox extends Component {
componentDidMount() {
if (!this.props.keyShortcut) {
return;
}
this.shortcuts = new KeyShortcuts({
window
});
- this.shortcuts.on(this.props.keyShortcut, (name, event) => {
+ this.shortcuts.on(this.props.keyShortcut, event => {
event.preventDefault();
this.refs.input.focus();
});
}
componentWillUnmount() {
if (this.shortcuts) {
this.shortcuts.destroy();
--- a/devtools/client/shared/developer-toolbar.js
+++ b/devtools/client/shared/developer-toolbar.js
@@ -23,17 +23,17 @@ loader.lazyGetter(this, "prefBranch", fu
});
loader.lazyRequireGetter(this, "gcliInit", "devtools/shared/gcli/commands/index");
loader.lazyRequireGetter(this, "util", "gcli/util/util");
loader.lazyRequireGetter(this, "ConsoleServiceListener", "devtools/server/actors/webconsole/listeners", true);
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
loader.lazyRequireGetter(this, "nodeConstants", "devtools/shared/dom-node-constants");
-loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/old-event-emitter");
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
/**
* A collection of utilities to help working with commands
*/
var CommandUtils = {
/**
* Caches requisitions created when calling executeOnTarget:
* Target => Requisition Promise
--- a/devtools/client/shared/inplace-editor.js
+++ b/devtools/client/shared/inplace-editor.js
@@ -39,17 +39,17 @@ const CONTENT_TYPES = {
// The limit of 500 autocomplete suggestions should not be reached but is kept
// for safety.
const MAX_POPUP_ENTRIES = 500;
const FOCUS_FORWARD = focusManager.MOVEFOCUS_FORWARD;
const FOCUS_BACKWARD = focusManager.MOVEFOCUS_BACKWARD;
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const { findMostRelevantCssPropertyIndex } = require("./suggestion-picker");
/**
* Helper to check if the provided key matches one of the expected keys.
* Keys will be prefixed with DOM_VK_ and should match a key in KeyCodes.
*
* @param {String} key
* the key to check (can be a keyCode).
--- a/devtools/client/shared/key-shortcuts.js
+++ b/devtools/client/shared/key-shortcuts.js
@@ -1,16 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Services = require("Services");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const isOSX = Services.appinfo.OS === "Darwin";
const {KeyCodes} = require("devtools/client/shared/keycodes");
// List of electron keys mapped to DOM API (DOM_VK_*) key code
const ElectronKeysMapping = {
"F1": "DOM_VK_F1",
"F2": "DOM_VK_F2",
"F3": "DOM_VK_F3",
--- a/devtools/client/shared/options-view.js
+++ b/devtools/client/shared/options-view.js
@@ -1,11 +1,11 @@
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const Services = require("Services");
const { Preferences } = require("resource://gre/modules/Preferences.jsm");
const OPTIONS_SHOWN_EVENT = "options-shown";
const OPTIONS_HIDDEN_EVENT = "options-hidden";
const PREF_CHANGE_EVENT = "pref-changed";
/**
* OptionsView constructor. Takes several options, all required:
@@ -90,17 +90,17 @@ OptionsView.prototype = {
return this.prefObserver.get(prefName);
},
/**
* Called when a preference is changed (either via clicking an option
* button or by changing it in about:config). Updates the checked status
* of the corresponding button.
*/
- _onPrefChange: function (_, prefName) {
+ _onPrefChange: function (prefName) {
let $el = this.$(`menuitem[data-pref="${prefName}"]`, this.menupopup);
let value = this.prefObserver.get(prefName);
// If options panel does not contain a menuitem for the
// pref, emit an event and do nothing.
if (!$el) {
this.emit(PREF_CHANGE_EVENT, prefName);
return;
--- a/devtools/client/shared/output-parser.js
+++ b/devtools/client/shared/output-parser.js
@@ -3,17 +3,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Services = require("Services");
const {angleUtils} = require("devtools/client/shared/css-angle");
const {colorUtils} = require("devtools/shared/css/color");
const {getCSSLexer} = require("devtools/shared/css/lexer");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {appendText} = require("devtools/client/inspector/shared/utils");
loader.lazyRequireGetter(this, "ANGLE_TAKING_FUNCTIONS",
"devtools/shared/css/properties-db", true);
loader.lazyRequireGetter(this, "BASIC_SHAPE_FUNCTIONS",
"devtools/shared/css/properties-db", true);
loader.lazyRequireGetter(this, "BEZIER_KEYWORDS",
"devtools/shared/css/properties-db", true);
--- a/devtools/client/shared/prefs.js
+++ b/devtools/client/shared/prefs.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Services = require("Services");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
/**
* Shortcuts for lazily accessing and setting various preferences.
* Usage:
* let prefs = new Prefs("root.path.to.branch", {
* myIntPref: ["Int", "leaf.path.to.my-int-pref"],
* myCharPref: ["Char", "leaf.path.to.my-char-pref"],
* myJsonPref: ["Json", "leaf.path.to.my-json-pref"],
@@ -18,17 +18,17 @@ const EventEmitter = require("devtools/s
* });
*
* Get/set:
* prefs.myCharPref = "foo";
* let aux = prefs.myCharPref;
*
* Observe:
* prefs.registerObserver();
- * prefs.on("pref-changed", (prefName, prefValue) => {
+ * prefs.on("pref-changed", (prefValue) => {
* ...
* });
*
* @param string prefsRoot
* The root path to the required preferences branch.
* @param object prefsBlueprint
* An object containing { accessorName: [prefType, prefName] } keys.
*/
--- a/devtools/client/shared/test/browser_key_shortcuts.js
+++ b/devtools/client/shared/test/browser_key_shortcuts.js
@@ -1,10 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
+ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
var isOSX = Services.appinfo.OS === "Darwin";
add_task(function* () {
let shortcuts = new KeyShortcuts({
window
@@ -29,88 +29,87 @@ add_task(function* () {
yield testTarget();
});
// Test helper to listen to the next key press for a given key,
// returning a promise to help using Tasks.
function once(shortcuts, key, listener) {
let called = false;
return new Promise(done => {
- let onShortcut = (key2, event) => {
+ let onShortcut = event => {
shortcuts.off(key, onShortcut);
ok(!called, "once listener called only once (i.e. off() works)");
- is(key, key2, "listener first argument match the key we listen");
called = true;
- listener(key2, event);
+ listener(event);
done();
};
shortcuts.on(key, onShortcut);
});
}
function* testSimple(shortcuts) {
info("Test simple key shortcuts");
- let onKey = once(shortcuts, "0", (key, event) => {
+ let onKey = once(shortcuts, "0", event => {
is(event.key, "0");
// Display another key press to ensure that once() correctly stop listening
EventUtils.synthesizeKey("0", {}, window);
});
EventUtils.synthesizeKey("0", {}, window);
yield onKey;
}
function* testNonLetterCharacter(shortcuts) {
info("Test non-naive character key shortcuts");
- let onKey = once(shortcuts, "[", (key, event) => {
+ let onKey = once(shortcuts, "[", event => {
is(event.key, "[");
});
EventUtils.synthesizeKey("[", {}, window);
yield onKey;
}
function* testFunctionKey(shortcuts) {
info("Test function key shortcuts");
- let onKey = once(shortcuts, "F12", (key, event) => {
+ let onKey = once(shortcuts, "F12", event => {
is(event.key, "F12");
});
EventUtils.synthesizeKey("F12", { keyCode: 123 }, window);
yield onKey;
}
// Plus is special. It's keycode is the one for "=". That's because it requires
// shift to be pressed and is behind "=" key. So it should be considered as a
// character key
function* testPlusCharacter(shortcuts) {
info("Test 'Plus' key shortcuts");
- let onKey = once(shortcuts, "Plus", (key, event) => {
+ let onKey = once(shortcuts, "Plus", event => {
is(event.key, "+");
});
EventUtils.synthesizeKey("+", { keyCode: 61, shiftKey: true }, window);
yield onKey;
}
// Test they listeners are not mixed up between shortcuts
function* testMixup(shortcuts) {
info("Test possible listener mixup");
let hitFirst = false, hitSecond = false;
- let onFirstKey = once(shortcuts, "0", (key, event) => {
+ let onFirstKey = once(shortcuts, "0", event => {
is(event.key, "0");
hitFirst = true;
});
- let onSecondKey = once(shortcuts, "Alt+A", (key, event) => {
+ let onSecondKey = once(shortcuts, "Alt+A", event => {
is(event.key, "a");
ok(event.altKey);
hitSecond = true;
});
// Dispatch the first shortcut and expect only this one to be notified
ok(!hitFirst, "First shortcut isn't notified before firing the key event");
EventUtils.synthesizeKey("0", {}, window);
@@ -129,32 +128,32 @@ function* testMixup(shortcuts) {
yield onSecondKey;
ok(hitSecond, "Got the second shortcut notified once it is actually fired");
}
// On azerty keyboard, digits are only available by pressing Shift/Capslock,
// but we accept them even if we omit doing that.
function* testLooseDigits(shortcuts) {
info("Test Loose digits");
- let onKey = once(shortcuts, "0", (key, event) => {
+ let onKey = once(shortcuts, "0", event => {
is(event.key, "Ã ");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(!event.shiftKey);
});
// Simulate a press on the "0" key, without shift pressed on a french
// keyboard
EventUtils.synthesizeKey(
"Ã ",
{ keyCode: 48 },
window);
yield onKey;
- onKey = once(shortcuts, "0", (key, event) => {
+ onKey = once(shortcuts, "0", event => {
is(event.key, "0");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(event.shiftKey);
});
// Simulate the same press with shift pressed
EventUtils.synthesizeKey(
@@ -164,17 +163,17 @@ function* testLooseDigits(shortcuts) {
yield onKey;
}
// Test that shortcuts is notified only when the modifiers match exactly
function* testExactModifiers(shortcuts) {
info("Test exact modifiers match");
let hit = false;
- let onKey = once(shortcuts, "Alt+A", (key, event) => {
+ let onKey = once(shortcuts, "Alt+A", event => {
is(event.key, "a");
ok(event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(!event.shiftKey);
hit = true;
});
@@ -210,30 +209,30 @@ function* testExactModifiers(shortcuts)
}
// Some keys are only accessible via shift and listener should also be called
// even if the key didn't explicitely requested Shift modifier.
// For example, `%` on french keyboards is only accessible via Shift.
// Same thing for `@` on US keybords.
function* testLooseShiftModifier(shortcuts) {
info("Test Loose shift modifier");
- let onKey = once(shortcuts, "%", (key, event) => {
+ let onKey = once(shortcuts, "%", event => {
is(event.key, "%");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(event.shiftKey);
});
EventUtils.synthesizeKey(
"%",
{ accelKey: false, altKey: false, ctrlKey: false, shiftKey: true},
window);
yield onKey;
- onKey = once(shortcuts, "@", (key, event) => {
+ onKey = once(shortcuts, "@", event => {
is(event.key, "@");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(event.shiftKey);
});
EventUtils.synthesizeKey(
"@",
@@ -241,25 +240,25 @@ function* testLooseShiftModifier(shortcu
window);
yield onKey;
}
// But Shift modifier is strict on all letter characters (a to Z)
function* testStrictLetterShiftModifier(shortcuts) {
info("Test strict shift modifier on letters");
let hitFirst = false;
- let onKey = once(shortcuts, "a", (key, event) => {
+ let onKey = once(shortcuts, "a", event => {
is(event.key, "a");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(!event.shiftKey);
hitFirst = true;
});
- let onShiftKey = once(shortcuts, "Shift+a", (key, event) => {
+ let onShiftKey = once(shortcuts, "Shift+a", event => {
is(event.key, "a");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(event.shiftKey);
});
EventUtils.synthesizeKey(
"a",
@@ -272,45 +271,45 @@ function* testStrictLetterShiftModifier(
"a",
{ shiftKey: false},
window);
yield onKey;
}
function* testAltModifier(shortcuts) {
info("Test Alt modifier");
- let onKey = once(shortcuts, "Alt+F1", (key, event) => {
+ let onKey = once(shortcuts, "Alt+F1", event => {
is(event.keyCode, window.KeyboardEvent.DOM_VK_F1);
ok(event.altKey);
ok(!event.ctrlKey);
ok(!event.metaKey);
ok(!event.shiftKey);
});
EventUtils.synthesizeKey(
"VK_F1",
{ altKey: true },
window);
yield onKey;
}
function* testCommandOrControlModifier(shortcuts) {
info("Test CommandOrControl modifier");
- let onKey = once(shortcuts, "CommandOrControl+F1", (key, event) => {
+ let onKey = once(shortcuts, "CommandOrControl+F1", event => {
is(event.keyCode, window.KeyboardEvent.DOM_VK_F1);
ok(!event.altKey);
if (isOSX) {
ok(!event.ctrlKey);
ok(event.metaKey);
} else {
ok(event.ctrlKey);
ok(!event.metaKey);
}
ok(!event.shiftKey);
});
- let onKeyAlias = once(shortcuts, "CmdOrCtrl+F1", (key, event) => {
+ let onKeyAlias = once(shortcuts, "CmdOrCtrl+F1", event => {
is(event.keyCode, window.KeyboardEvent.DOM_VK_F1);
ok(!event.altKey);
if (isOSX) {
ok(!event.ctrlKey);
ok(event.metaKey);
} else {
ok(event.ctrlKey);
ok(!event.metaKey);
@@ -329,24 +328,24 @@ function* testCommandOrControlModifier(s
window);
}
yield onKey;
yield onKeyAlias;
}
function* testCtrlModifier(shortcuts) {
info("Test Ctrl modifier");
- let onKey = once(shortcuts, "Ctrl+F1", (key, event) => {
+ let onKey = once(shortcuts, "Ctrl+F1", event => {
is(event.keyCode, window.KeyboardEvent.DOM_VK_F1);
ok(!event.altKey);
ok(event.ctrlKey);
ok(!event.metaKey);
ok(!event.shiftKey);
});
- let onKeyAlias = once(shortcuts, "Control+F1", (key, event) => {
+ let onKeyAlias = once(shortcuts, "Control+F1", event => {
is(event.keyCode, window.KeyboardEvent.DOM_VK_F1);
ok(!event.altKey);
ok(event.ctrlKey);
ok(!event.metaKey);
ok(!event.shiftKey);
});
EventUtils.synthesizeKey(
"VK_F1",
@@ -357,24 +356,24 @@ function* testCtrlModifier(shortcuts) {
}
function* testCmdShiftShortcut(shortcuts) {
if (!isOSX) {
// This test is OSX only (Bug 1300458).
return;
}
- let onCmdKey = once(shortcuts, "CmdOrCtrl+[", (key, event) => {
+ let onCmdKey = once(shortcuts, "CmdOrCtrl+[", event => {
is(event.key, "[");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(event.metaKey);
ok(!event.shiftKey);
});
- let onCmdShiftKey = once(shortcuts, "CmdOrCtrl+Shift+[", (key, event) => {
+ let onCmdShiftKey = once(shortcuts, "CmdOrCtrl+Shift+[", event => {
is(event.key, "[");
ok(!event.altKey);
ok(!event.ctrlKey);
ok(event.metaKey);
ok(event.shiftKey);
});
EventUtils.synthesizeKey(
@@ -397,17 +396,17 @@ function* testTarget() {
"input");
document.documentElement.appendChild(target);
target.focus();
let shortcuts = new KeyShortcuts({
window,
target
});
- let onKey = once(shortcuts, "0", (key, event) => {
+ let onKey = once(shortcuts, "0", event => {
is(event.key, "0");
is(event.target, target);
});
EventUtils.synthesizeKey("0", {}, window);
yield onKey;
target.remove();
--- a/devtools/client/shared/test/browser_options-view-01.js
+++ b/devtools/client/shared/test/browser_options-view-01.js
@@ -36,17 +36,17 @@ add_task(function* () {
function* testOptionsView(win) {
let events = [];
let options = createOptionsView(win);
yield options.initialize();
let $ = win.document.querySelector.bind(win.document);
- options.on("pref-changed", (_, pref) => events.push(pref));
+ options.on("pref-changed", pref => events.push(pref));
let ppEl = $("menuitem[data-pref='auto-pretty-print']");
let bbEl = $("menuitem[data-pref='auto-black-box']");
// Test default config
is(ppEl.getAttribute("checked"), "true", "`true` prefs are checked on start");
is(bbEl.getAttribute("checked"), "", "`false` prefs are unchecked on start");
--- a/devtools/client/shared/test/browser_spectrum.js
+++ b/devtools/client/shared/test/browser_spectrum.js
@@ -68,17 +68,17 @@ function testSettingAndGettingANewColor(
s.destroy();
}
function testChangingColorShouldEmitEvents(container) {
return new Promise(resolve => {
let s = new Spectrum(container, [255, 255, 255, 1]);
s.show();
- s.once("changed", (event, rgba, color) => {
+ s.once("changed", (rgba, color) => {
ok(true, "Changed event was emitted on color change");
is(rgba[0], 128, "New color is correct");
is(rgba[1], 64, "New color is correct");
is(rgba[2], 64, "New color is correct");
is(rgba[3], 1, "New color is correct");
is(`rgba(${rgba.join(", ")})`, color, "RGBA and css color correspond");
s.destroy();
--- a/devtools/client/shared/test/browser_theme.js
+++ b/devtools/client/shared/test/browser_theme.js
@@ -32,19 +32,17 @@ function testGetTheme() {
function testSetTheme() {
let originalTheme = getTheme();
// Put this in a variable rather than hardcoding it because the default
// changes between aurora and nightly
let otherTheme = originalTheme == "dark" ? "light" : "dark";
let prefObserver = new PrefObserver("devtools.");
- prefObserver.once("devtools.theme", pref => {
- is(pref, "devtools.theme",
- "A preference event triggered by setTheme has correct pref.");
+ prefObserver.once("devtools.theme", () => {
let newValue = Services.prefs.getCharPref("devtools.theme");
is(newValue, otherTheme,
"A preference event triggered by setTheme comes after the value is set.");
});
setTheme(otherTheme);
is(Services.prefs.getCharPref("devtools.theme"), otherTheme,
"setTheme() correctly sets another theme.");
setTheme(originalTheme);
--- a/devtools/client/shared/test/browser_toolbar_webconsole_errors_count.js
+++ b/devtools/client/shared/test/browser_toolbar_webconsole_errors_count.js
@@ -239,19 +239,19 @@ function test() {
// Get out of the toolbar event execution loop.
executeSoon(options.callback);
}
return result;
}
if (!check()) {
info("wait for: " + options.name);
- toolbar.on("errors-counter-updated", function onUpdate(event) {
+ toolbar.on("errors-counter-updated", function onUpdate() {
if (check()) {
- toolbar.off(event, onUpdate);
+ toolbar.off("errors-counter-updated", onUpdate);
}
});
}
}
function openWebConsole(tab, callback) {
let target = TargetFactory.forTab(tab);
gDevTools.showToolbox(target, "webconsole").then((toolbox) =>
--- a/devtools/client/shared/test/browser_treeWidget_keyboard_interaction.js
+++ b/devtools/client/shared/test/browser_treeWidget_keyboard_interaction.js
@@ -81,17 +81,17 @@ function click(node) {
}
/**
* Tests if pressing navigation keys on the tree items does the expected behavior
*/
async function testKeyboardInteraction(tree, win) {
info("Testing keyboard interaction with the tree");
let event;
- let pass = (e, d, a) => event.resolve([e, d, a]);
+ let pass = (d, a) => event.resolve([d, a]);
info("clicking on first top level item");
let node = tree.root.children.firstChild.firstChild;
event = defer();
// The select event handler will be called before the click event hasn't
// fully finished, so wait for both of them.
let clicked = once(node, "click");
tree.once("select", pass);
@@ -101,47 +101,47 @@ async function testKeyboardInteraction(t
// node should not have selected class
ok(!node.classList.contains("theme-selected"), "Node should not have selected class");
ok(!node.hasAttribute("expanded"), "Node is not expanded");
info("Pressing down key to select next item");
event = defer();
tree.once("select", pass);
EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
- let [name, data, attachment] = await event.promise;
- is(name, "select", "Select event was fired after pressing down");
- is(data[0], "level1", "Correct item was selected after pressing down");
+
+ let [data, attachment] = await event.promise;
+ is(data, "level1", "Correct item was selected after pressing down");
ok(!attachment, "null attachment was emitted");
ok(node.classList.contains("theme-selected"), "Node has selected class");
ok(node.hasAttribute("expanded"), "Node is expanded now");
info("Pressing down key again to select next item");
event = defer();
tree.once("select", pass);
EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
- [name, data, attachment] = await event.promise;
+ [data, attachment] = await event.promise;
is(data.length, 2, "Correct level item was selected after second down keypress");
is(data[0], "level1", "Correct parent level");
is(data[1], "level2", "Correct second level");
info("Pressing down key again to select next item");
event = defer();
tree.once("select", pass);
EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
- [name, data, attachment] = await event.promise;
+ [data, attachment] = await event.promise;
is(data.length, 3, "Correct level item was selected after third down keypress");
is(data[0], "level1", "Correct parent level");
is(data[1], "level2", "Correct second level");
is(data[2], "level3", "Correct third level");
info("Pressing down key again to select next item");
event = defer();
tree.once("select", pass);
EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
- [name, data, attachment] = await event.promise;
+ [data, attachment] = await event.promise;
is(data.length, 2, "Correct level item was selected after fourth down keypress");
is(data[0], "level1", "Correct parent level");
is(data[1], "level2-1", "Correct second level");
// pressing left to check expand collapse feature.
// This does not emit any event, so listening for keypress
tree.root.children.addEventListener("keydown", () => {
// executeSoon so that other listeners on the same method are executed first
@@ -160,30 +160,30 @@ async function testKeyboardInteraction(t
info("Pressing left key on collapsed item to select previous");
tree.once("select", pass);
event = defer();
// parent node should have no effect of this keypress
node = tree.root.children.firstChild.nextSibling.firstChild;
ok(node.hasAttribute("expanded"), "Parent is expanded");
EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
- [name, data] = await event.promise;
+ [data] = await event.promise;
is(data.length, 3, "Correct level item was selected after second left keypress");
is(data[0], "level1", "Correct parent level");
is(data[1], "level2", "Correct second level");
is(data[2], "level3", "Correct third level");
ok(node.hasAttribute("expanded"), "Parent is still expanded after left keypress");
// pressing down again
info("Pressing down key to select next item");
event = defer();
tree.once("select", pass);
EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
- [name, data, attachment] = await event.promise;
+ [data, attachment] = await event.promise;
is(data.length, 2, "Correct level item was selected after fifth down keypress");
is(data[0], "level1", "Correct parent level");
is(data[1], "level2-1", "Correct second level");
// collapsing the item to check expand feature.
tree.root.children.addEventListener("keydown", () => {
executeSoon(() => event.resolve(null));
--- a/devtools/client/shared/test/browser_treeWidget_mouse_interaction.js
+++ b/devtools/client/shared/test/browser_treeWidget_mouse_interaction.js
@@ -81,44 +81,44 @@ function click(node) {
}
/**
* Tests if clicking the tree items does the expected behavior
*/
function* testMouseInteraction(tree) {
info("Testing mouse interaction with the tree");
let event;
- let pass = (e, d, a) => event.resolve([e, d, a]);
+ let pass = (d, a) => event.resolve([d, a]);
ok(!tree.selectedItem, "Nothing should be selected beforehand");
tree.once("select", pass);
let node = tree.root.children.firstChild.firstChild;
info("clicking on first top level item");
event = defer();
ok(!node.classList.contains("theme-selected"),
"Node should not have selected class before clicking");
click(node);
- let [, data, attachment] = yield event.promise;
+ let [data, attachment] = yield event.promise;
ok(node.classList.contains("theme-selected"),
"Node has selected class after click");
is(data[0], "level1.2", "Correct tree path is emitted");
ok(attachment && attachment.foo, "Correct attachment is emitted");
is(attachment.foo, "bar", "Correct attachment value is emitted");
info("clicking second top level item with children to check if it expands");
let node2 = tree.root.children.firstChild.nextSibling.firstChild;
event = defer();
// node should not have selected class
ok(!node2.classList.contains("theme-selected"),
"New node should not have selected class before clicking");
ok(!node2.hasAttribute("expanded"), "New node is not expanded before clicking");
tree.once("select", pass);
click(node2);
- [, data, attachment] = yield event.promise;
+ [data, attachment] = yield event.promise;
ok(node2.classList.contains("theme-selected"),
"New node has selected class after clicking");
is(data[0], "level1", "Correct tree path is emitted for new node");
ok(!attachment, "null attachment should be emitted for new node");
ok(node2.hasAttribute("expanded"), "New node expanded after click");
ok(!node.classList.contains("theme-selected"),
"Old node should not have selected class after the click on new node");
--- a/devtools/client/shared/webpack/README.md
+++ b/devtools/client/shared/webpack/README.md
@@ -11,19 +11,19 @@ rewrite existing code, so it's understan
For example:
The following piece of code is using `lazyRequireGetter` that
is unknown to Webpack.
```
loader.lazyRequireGetter(this, "EventEmitter",
- "devtools/shared/old-event-emitter");
+ "devtools/shared/event-emitter");
```
-In order to properly bundle `devtools/shared/old-event-emitter` module
+In order to properly bundle `devtools/shared/event-emitter` module
the code needs to be translated into:
```
-let EventEmitter = require("devtools/shared/old-event-emitter");
+let EventEmitter = require("devtools/shared/event-emitter");
```
See more in `rewrite-lazy-require`
--- a/devtools/client/shared/widgets/AbstractTreeItem.jsm
+++ b/devtools/client/shared/widgets/AbstractTreeItem.jsm
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { require, loader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
const { KeyCodes } = require("devtools/client/shared/keycodes");
-loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/old-event-emitter");
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
this.EXPORTED_SYMBOLS = ["AbstractTreeItem"];
/**
* A very generic and low-level tree view implementation. It is not intended
* to be used alone, but as a base class that you can extend to build your
* own custom implementation.
*
--- a/devtools/client/shared/widgets/BreadcrumbsWidget.jsm
+++ b/devtools/client/shared/widgets/BreadcrumbsWidget.jsm
@@ -4,17 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const ENSURE_SELECTION_VISIBLE_DELAY = 50; // ms
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const { ViewHelpers, setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
this.EXPORTED_SYMBOLS = ["BreadcrumbsWidget"];
/**
* A breadcrumb-like list of items.
*
* Note: this widget should be used in tandem with the WidgetMethods in
* view-helpers.js.
--- a/devtools/client/shared/widgets/Chart.js
+++ b/devtools/client/shared/widgets/Chart.js
@@ -7,17 +7,17 @@ const NET_STRINGS_URI = "devtools/client
const SVG_NS = "http://www.w3.org/2000/svg";
const PI = Math.PI;
const TAU = PI * 2;
const EPSILON = 0.0000001;
const NAMED_SLICE_MIN_ANGLE = TAU / 8;
const NAMED_SLICE_TEXT_DISTANCE_RATIO = 1.9;
const HOVERED_SLICE_TRANSLATE_DISTANCE_RATIO = 20;
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const { LocalizationHelper } = require("devtools/shared/l10n");
const L10N = new LocalizationHelper(NET_STRINGS_URI);
/**
* A factory for creating charts.
* Example usage: let myChart = Chart.Pie(document, { ... });
*/
var Chart = {
@@ -114,47 +114,47 @@ function createPieTableChart(document,
let container = document.createElement("div");
container.className = "pie-table-chart-container";
container.appendChild(pie.node);
container.appendChild(table.node);
let proxy = new PieTableChart(container, pie, table);
- pie.on("click", (event, item) => {
- proxy.emit(event, item);
+ pie.on("click", (item) => {
+ proxy.emit("click", item);
});
- table.on("click", (event, item) => {
- proxy.emit(event, item);
+ table.on("click", (item) => {
+ proxy.emit("click", item);
});
- pie.on("mouseover", (event, item) => {
- proxy.emit(event, item);
+ pie.on("mouseover", (item) => {
+ proxy.emit("mouseover", item);
if (table.rows.has(item)) {
table.rows.get(item).setAttribute("focused", "");
}
});
- pie.on("mouseout", (event, item) => {
- proxy.emit(event, item);
+ pie.on("mouseout", (item) => {
+ proxy.emit("mouseout", item);
if (table.rows.has(item)) {
table.rows.get(item).removeAttribute("focused");
}
});
- table.on("mouseover", (event, item) => {
- proxy.emit(event, item);
+ table.on("mouseover", (item) => {
+ proxy.emit("mouseover", item);
if (pie.slices.has(item)) {
pie.slices.get(item).setAttribute("focused", "");
}
});
- table.on("mouseout", (event, item) => {
- proxy.emit(event, item);
+ table.on("mouseout", (item) => {
+ proxy.emit("mouseout", item);
if (pie.slices.has(item)) {
pie.slices.get(item).removeAttribute("focused");
}
});
return proxy;
}
--- a/devtools/client/shared/widgets/ColorWidget.js
+++ b/devtools/client/shared/widgets/ColorWidget.js
@@ -5,32 +5,32 @@
/**
* This file is a new working copy of Spectrum.js for the purposes of refreshing the color
* widget. It is hidden behind a pref("devtools.inspector.colorWidget.enabled").
*/
"use strict";
const {Task} = require("devtools/shared/task");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {colorUtils} = require("devtools/shared/css/color");
const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/inspector.properties");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const SAMPLE_TEXT = "Abc";
/**
* ColorWidget creates a color picker widget in any container you give it.
*
* Simple usage example:
*
* const {ColorWidget} = require("devtools/client/shared/widgets/ColorWidget");
* let s = new ColorWidget(containerElement, [255, 126, 255, 1]);
- * s.on("changed", (event, rgba, color) => {
+ * s.on("changed", (rgba, color) => {
* console.log("rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ", " +
* rgba[3] + ")");
* });
* s.show();
* s.destroy();
*
* Note that the color picker is hidden by default and you need to call show to
* make it appear. This 2 stages initialization helps in cases you are creating
--- a/devtools/client/shared/widgets/CubicBezierWidget.js
+++ b/devtools/client/shared/widgets/CubicBezierWidget.js
@@ -20,17 +20,17 @@
* DEALINGS IN THE SOFTWARE.
*/
// Based on www.cubic-bezier.com by Lea Verou
// See https://github.com/LeaVerou/cubic-bezier
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {
PREDEFINED,
PRESETS,
DEFAULT_PRESET_CATEGORY
} = require("devtools/client/shared/widgets/CubicBezierPresets");
const {getCSSLexer} = require("devtools/shared/css/lexer");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
@@ -385,17 +385,17 @@ CubicBezierWidget.prototype = {
let point = distP1 < distP2 ? this.p1 : this.p2;
point.style.left = x + "px";
point.style.top = y + "px";
this._updateFromPoints();
},
- _onNewCoordinates: function (event, coordinates) {
+ _onNewCoordinates: function (coordinates) {
this.coordinates = coordinates;
},
/**
* Get the current point coordinates and redraw the curve to match
*/
_updateFromPoints: function () {
// Get the new coordinates from the point's offsets
--- a/devtools/client/shared/widgets/FastListWidget.js
+++ b/devtools/client/shared/widgets/FastListWidget.js
@@ -1,16 +1,16 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
/**
* A list menu widget that attempts to be very fast.
*
* Note: this widget should be used in tandem with the WidgetMethods in
* view-helpers.js.
*
--- a/devtools/client/shared/widgets/FilterWidget.js
+++ b/devtools/client/shared/widgets/FilterWidget.js
@@ -4,17 +4,17 @@
"use strict";
/**
* This is a CSS Filter Editor widget used
* for Rule View's filter swatches
*/
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const { LocalizationHelper } = require("devtools/shared/l10n");
const STRINGS_URI = "devtools/client/locales/filterwidget.properties";
const L10N = new LocalizationHelper(STRINGS_URI);
const {cssTokenizer} = require("devtools/shared/css/parsing-utils");
--- a/devtools/client/shared/widgets/FlameGraph.js
+++ b/devtools/client/shared/widgets/FlameGraph.js
@@ -4,17 +4,17 @@
"use strict";
const { Task } = require("devtools/shared/task");
const { ViewHelpers, setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
const { ELLIPSIS } = require("devtools/shared/l10n");
loader.lazyRequireGetter(this, "defer", "devtools/shared/defer");
loader.lazyRequireGetter(this, "EventEmitter",
- "devtools/shared/old-event-emitter");
+ "devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "getColor",
"devtools/client/shared/theme", true);
loader.lazyRequireGetter(this, "CATEGORY_MAPPINGS",
"devtools/client/performance/modules/categories", true);
loader.lazyRequireGetter(this, "FrameUtils",
"devtools/client/performance/modules/logic/frame-utils");
--- a/devtools/client/shared/widgets/Graphs.js
+++ b/devtools/client/shared/widgets/Graphs.js
@@ -4,17 +4,17 @@
"use strict";
const { Task } = require("devtools/shared/task");
const { setNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
const { getCurrentZoom } = require("devtools/shared/layout/utils");
loader.lazyRequireGetter(this, "defer", "devtools/shared/defer");
loader.lazyRequireGetter(this, "EventEmitter",
- "devtools/shared/old-event-emitter");
+ "devtools/shared/event-emitter");
loader.lazyImporter(this, "DevToolsWorker",
"resource://devtools/shared/worker/worker.js");
const HTML_NS = "http://www.w3.org/1999/xhtml";
const GRAPH_SRC = "chrome://devtools/content/shared/widgets/graphs-frame.xhtml";
const WORKER_URL =
"resource://devtools/client/shared/widgets/GraphsWorker.js";
--- a/devtools/client/shared/widgets/SideMenuWidget.jsm
+++ b/devtools/client/shared/widgets/SideMenuWidget.jsm
@@ -3,17 +3,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const SHARED_STRINGS_URI = "devtools/client/locales/shared.properties";
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const { LocalizationHelper } = require("devtools/shared/l10n");
const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
this.EXPORTED_SYMBOLS = ["SideMenuWidget"];
/**
* Localization convenience methods.
*/
--- a/devtools/client/shared/widgets/Spectrum.js
+++ b/devtools/client/shared/widgets/Spectrum.js
@@ -1,25 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
/**
* Spectrum creates a color picker widget in any container you give it.
*
* Simple usage example:
*
* const {Spectrum} = require("devtools/client/shared/widgets/Spectrum");
* let s = new Spectrum(containerElement, [255, 126, 255, 1]);
- * s.on("changed", (event, rgba, color) => {
+ * s.on("changed", (rgba, color) => {
* console.log("rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ", " +
* rgba[3] + ")");
* });
* s.show();
* s.destroy();
*
* Note that the color picker is hidden by default and you need to call show to
* make it appear. This 2 stages initialization helps in cases you are creating
--- a/devtools/client/shared/widgets/TableWidget.js
+++ b/devtools/client/shared/widgets/TableWidget.js
@@ -1,14 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "setNamedTimeout",
"devtools/client/shared/widgets/view-helpers", true);
loader.lazyRequireGetter(this, "clearNamedTimeout",
"devtools/client/shared/widgets/view-helpers", true);
loader.lazyRequireGetter(this, "naturalSortCaseInsensitive",
"devtools/client/shared/natural-sort", true);
const {KeyCodes} = require("devtools/client/shared/keycodes");
@@ -101,17 +101,17 @@ function TableWidget(node, options = {})
}
if (initialColumns) {
this.setColumns(initialColumns, uniqueId);
} else if (this.emptyText) {
this.setPlaceholderText(this.emptyText);
}
- this.bindSelectedRow = (event, id) => {
+ this.bindSelectedRow = id => {
this.selectedRow = id;
};
this.on(EVENTS.ROW_SELECTED, this.bindSelectedRow);
this.onChange = this.onChange.bind(this);
this.onEditorDestroyed = this.onEditorDestroyed.bind(this);
this.onEditorTab = this.onEditorTab.bind(this);
this.onKeydown = this.onKeydown.bind(this);
@@ -245,17 +245,17 @@ TableWidget.prototype = {
let columns = this._parent.querySelectorAll(".table-widget-column");
return filter(columns);
},
/**
* Emit all cell edit events.
*/
- onChange: function (type, data) {
+ onChange: function (data) {
let changedField = data.change.field;
let colName = changedField.parentNode.id;
let column = this.columns.get(colName);
let uniqueId = column.table.uniqueId;
let itemIndex = column.cellNodes.indexOf(changedField);
let items = {};
for (let [name, col] of this.columns) {
@@ -308,17 +308,17 @@ TableWidget.prototype = {
// column it is currently sorted on. In addition to this, the table cell may
// have been edited and had to be recreated when the user has pressed tab or
// shift+tab. Both of these situations require us to recover our target,
// select the appropriate row and move the textbox on to the next cell.
if (editor.changePending) {
// We need to apply a change, which can mean that the position of cells
// within the table can change. Because of this we need to wait for
// EVENTS.ROW_EDIT and then move the textbox.
- this.once(EVENTS.ROW_EDIT, (e, uniqueId) => {
+ this.once(EVENTS.ROW_EDIT, uniqueId => {
let cell;
let cells;
let columnObj;
let cols = this.editableColumns;
let rowIndex = this.visibleSelectedIndex;
let colIndex = cols.indexOf(column);
let newIndex;
@@ -447,17 +447,17 @@ TableWidget.prototype = {
/**
* Reset the editable fields engine if the currently edited row is removed.
*
* @param {String} event
* The event name "event-removed."
* @param {Object} row
* The values from the removed row.
*/
- onRowRemoved: function (event, row) {
+ onRowRemoved: function (row) {
if (!this._editableFieldsEngine || !this._editableFieldsEngine.isEditing) {
return;
}
let removedKey = row[this.uniqueId];
let column = this.columns.get(this.uniqueId);
if (removedKey in column.items) {
@@ -1177,29 +1177,29 @@ Column.prototype = {
/**
* Called when the column is sorted by.
*
* @param {string} event
* The event name of the event. i.e. EVENTS.COLUMN_SORTED
* @param {string} column
* The id of the column being sorted by.
*/
- onColumnSorted: function (event, column) {
+ onColumnSorted: function (column) {
if (column != this.id) {
this.sorted = 0;
return;
} else if (this.sorted == 0 || this.sorted == 2) {
this.sorted = 1;
} else {
this.sorted = 2;
}
this.updateZebra();
},
- onTableFiltered: function (event, itemsToHide) {
+ onTableFiltered: function (itemsToHide) {
this._updateItems();
if (!this.cells) {
return;
}
for (let cell of this.cells) {
cell.hidden = false;
}
for (let id of itemsToHide) {
@@ -1213,17 +1213,17 @@ Column.prototype = {
* for a new row this method will be called once for each column. If a single
* cell is changed this method will be called just once.
*
* @param {string} event
* The event name of the event. i.e. EVENTS.ROW_UPDATED
* @param {string} id
* The unique id of the object associated with the row.
*/
- onRowUpdated: function (event, id) {
+ onRowUpdated: function (id) {
this._updateItems();
if (this.highlightUpdated && this.items[id] != null) {
if (this.table.scrollIntoViewOnUpdate) {
let cell = this.cells[this.items[id]];
// When a new row is created this method is called once for each column
// as each cell is updated. We can only scroll to cells if they are
@@ -1372,17 +1372,17 @@ Column.prototype = {
*
* @param {string} event
* The name of the event. i.e. EVENTS.HEADER_CONTEXT_MENU
* @param {string} id
* Id of the column to be toggled
* @param {string} checked
* true if the column is visible
*/
- toggleColumn: function (event, id, checked) {
+ toggleColumn: function (id, checked) {
if (arguments.length == 0) {
// Act like a toggling method when called with no params
id = this.id;
checked = this.wrapper.hasAttribute("hidden");
}
if (id != this.id) {
return;
}
--- a/devtools/client/shared/widgets/TreeWidget.js
+++ b/devtools/client/shared/widgets/TreeWidget.js
@@ -2,17 +2,17 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const HTML_NS = "http://www.w3.org/1999/xhtml";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {KeyCodes} = require("devtools/client/shared/keycodes");
/**
* A tree widget with keyboard navigation and collapsable structure.
*
* @param {nsIDOMNode} node
* The container element for the tree widget.
* @param {Object} options
--- a/devtools/client/shared/widgets/VariablesView.jsm
+++ b/devtools/client/shared/widgets/VariablesView.jsm
@@ -10,17 +10,17 @@ const LAZY_EMPTY_DELAY = 150; // ms
const SCROLL_PAGE_SIZE_DEFAULT = 0;
const PAGE_SIZE_SCROLL_HEIGHT_RATIO = 100;
const PAGE_SIZE_MAX_JUMPS = 30;
const SEARCH_ACTION_MAX_DELAY = 300; // ms
const ITEM_FLASH_DURATION = 300; // ms
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const Services = require("Services");
const { getSourceNames } = require("devtools/client/shared/source-utils");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const { extend } = require("devtools/shared/extend");
const { ViewHelpers, setNamedTimeout } =
require("devtools/client/shared/widgets/view-helpers");
--- a/devtools/client/shared/widgets/tooltip/HTMLTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/HTMLTooltip.js
@@ -1,17 +1,17 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {TooltipToggle} = require("devtools/client/shared/widgets/tooltip/TooltipToggle");
const {listenOnce} = require("devtools/shared/async-utils");
const {Task} = require("devtools/shared/task");
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const POSITION = {
--- a/devtools/client/shared/widgets/tooltip/InlineTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/InlineTooltip.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
/**
* The InlineTooltip can display widgets for the CSS Rules view in an
* inline container.
*
* @param {Document} doc
* The toolbox document to attach the InlineTooltip container.
*/
--- a/devtools/client/shared/widgets/tooltip/SwatchBasedEditorTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchBasedEditorTooltip.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip");
const InlineTooltip = require("devtools/client/shared/widgets/tooltip/InlineTooltip");
const INLINE_TOOLTIP_CLASS = "inline-tooltip-container";
/**
* Base class for all (color, gradient, ...)-swatch based value editors inside
@@ -43,26 +43,26 @@ class SwatchBasedEditorTooltip {
});
}
// By default, swatch-based editor tooltips revert value change on <esc> and
// commit value change on <enter>
this.shortcuts = new KeyShortcuts({
window: this.tooltip.topWindow
});
- this.shortcuts.on("Escape", (name, event) => {
+ this.shortcuts.on("Escape", event => {
if (!this.tooltip.isVisible()) {
return;
}
this.revert();
this.hide();
event.stopPropagation();
event.preventDefault();
});
- this.shortcuts.on("Return", (name, event) => {
+ this.shortcuts.on("Return", event => {
if (!this.tooltip.isVisible()) {
return;
}
this.commit();
this.hide();
event.stopPropagation();
event.preventDefault();
});
--- a/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js
@@ -133,17 +133,17 @@ class SwatchColorPickerTooltip extends S
eyeButton.addEventListener("click", this._openEyeDropper);
} else {
eyeButton.disabled = true;
eyeButton.title = L10N.getStr("eyedropper.disabled.title");
}
this.emit("ready");
}
- _onSpectrumColorChange(event, rgba, cssColor) {
+ _onSpectrumColorChange(rgba, cssColor) {
this._selectColor(cssColor);
}
_selectColor(color) {
if (this.activeSwatch) {
this.activeSwatch.style.backgroundColor = color;
this.activeSwatch.parentNode.dataset.color = color;
--- a/devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchCubicBezierTooltip.js
@@ -73,17 +73,17 @@ class SwatchCubicBezierTooltip extends S
widget.off("updated", this._onUpdate);
widget.cssCubicBezierValue = this.currentBezierValue.textContent;
widget.on("updated", this._onUpdate);
this.emit("ready");
});
}
}
- _onUpdate(event, bezier) {
+ _onUpdate(bezier) {
if (!this.activeSwatch) {
return;
}
this.currentBezierValue.textContent = bezier + "";
this.preview(bezier + "");
}
--- a/devtools/client/shared/widgets/tooltip/SwatchFilterTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/SwatchFilterTooltip.js
@@ -61,17 +61,17 @@ class SwatchFilterTooltip extends Swatch
this.widget.off("updated", this._onUpdate);
this.widget.on("updated", this._onUpdate);
this.widget.setCssValue(this.currentFilterValue.textContent);
this.widget.render();
this.emit("ready");
}
}
- _onUpdate(event, filters) {
+ _onUpdate(filters) {
if (!this.activeSwatch) {
return;
}
// Remove the old children and reparse the property value to
// recompute them.
while (this.currentFilterValue.firstChild) {
this.currentFilterValue.firstChild.remove();
--- a/devtools/client/shared/widgets/tooltip/Tooltip.js
+++ b/devtools/client/shared/widgets/tooltip/Tooltip.js
@@ -1,16 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const defer = require("devtools/shared/defer");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const {KeyCodes} = require("devtools/client/shared/keycodes");
const {TooltipToggle} = require("devtools/client/shared/widgets/tooltip/TooltipToggle");
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const ESCAPE_KEYCODE = KeyCodes.DOM_VK_ESCAPE;
const POPUP_EVENTS = ["shown", "hidden", "showing", "hiding"];
/**
--- a/devtools/client/shared/widgets/view-helpers.js
+++ b/devtools/client/shared/widgets/view-helpers.js
@@ -1488,17 +1488,17 @@ const WidgetMethods = exports.WidgetMeth
this._itemsByElement.delete(item._target);
},
/**
* The keyDown event listener for this container.
* @param string name
* @param KeyboardEvent event
*/
- _onWidgetKeyDown: function (name, event) {
+ _onWidgetKeyDown: function (event) {
// Prevent scrolling when pressing navigation keys.
ViewHelpers.preventScrolling(event);
switch (event.keyCode) {
case KeyCodes.DOM_VK_UP:
case KeyCodes.DOM_VK_LEFT:
this.focusPrevItem();
break;
@@ -1523,17 +1523,17 @@ const WidgetMethods = exports.WidgetMeth
}
},
/**
* The mousePress event listener for this container.
* @param string name
* @param MouseEvent event
*/
- _onWidgetMousePress: function (name, event) {
+ _onWidgetMousePress: function (event) {
if (event.button != 0 && !this.allowFocusOnRightClick) {
// Only allow left-click to trigger this event.
return;
}
let item = this.getItemForElement(event.target);
if (item) {
// The container is not empty and we clicked on an actual item.
--- a/devtools/client/shared/zoom-keys.js
+++ b/devtools/client/shared/zoom-keys.js
@@ -26,27 +26,27 @@ exports.register = function (window) {
let shortcuts = new KeyShortcuts({
window
});
let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
let contViewer = docShell.contentViewer;
let zoomValue = parseFloat(Services.prefs.getCharPref(ZOOM_PREF));
- let zoomIn = function (name, event) {
+ let zoomIn = function (event) {
setZoom(zoomValue + 0.1);
event.preventDefault();
};
- let zoomOut = function (name, event) {
+ let zoomOut = function (event) {
setZoom(zoomValue - 0.1);
event.preventDefault();
};
- let zoomReset = function (name, event) {
+ let zoomReset = function (event) {
setZoom(1);
event.preventDefault();
};
let setZoom = function (newValue) {
// cap zoom value
zoomValue = Math.max(newValue, MIN_ZOOM);
zoomValue = Math.min(zoomValue, MAX_ZOOM);
--- a/devtools/client/sourceeditor/editor.js
+++ b/devtools/client/sourceeditor/editor.js
@@ -1360,17 +1360,17 @@ Editor.prototype = {
if (OS === "Darwin") {
keys.push("replaceAllMac.key");
} else {
keys.push("replaceAll.key");
}
// Process generic keys:
keys.forEach(name => {
let key = L10N.getStr(name);
- shortcuts.on(key, (_, event) => this._onShortcut(name, event));
+ shortcuts.on(key, event => this._onShortcut(name, event));
});
},
/**
* Key shortcut listener.
*/
_onShortcut: function (name, event) {
if (!this._isInputOrTextarea(event.target)) {
return;
--- a/devtools/client/storage/ui.js
+++ b/devtools/client/storage/ui.js
@@ -130,17 +130,17 @@ function StorageUI(front, target, panelW
this.filterItems = this.filterItems.bind(this);
this.onPaneToggleButtonClicked = this.onPaneToggleButtonClicked.bind(this);
this.setupToolbar();
let shortcuts = new KeyShortcuts({
window: this._panelDoc.defaultView,
});
let key = L10N.getStr("storage.filter.key");
- shortcuts.on(key, (name, event) => {
+ shortcuts.on(key, event => {
event.preventDefault();
this.searchBox.focus();
});
this.front.listStores().then(storageTypes => {
this.populateStorageTree(storageTypes);
}).catch(e => {
if (!this._toolbox || this._toolbox._destroyer) {
@@ -322,17 +322,17 @@ StorageUI.prototype = {
makeFieldsEditable: function* (editableFields) {
if (editableFields && editableFields.length > 0) {
this.table.makeFieldsEditable(editableFields);
} else if (this.table._editableFieldsEngine) {
this.table._editableFieldsEngine.destroy();
}
},
- editItem: function (eventType, data) {
+ editItem: function (data) {
let front = this.getCurrentFront();
front.editItem(data);
},
/**
* Removes the given item from the storage table. Reselects the next item in
* the table and repopulates the sidebar with that item's data if the item
@@ -874,17 +874,17 @@ StorageUI.prototype = {
* from the storage details and populates the storage tree.
*
* @param {string} event
* The name of the event fired
* @param {array} item
* An array of ids which represent the location of the selected item in
* the storage tree
*/
- onHostSelect: function (event, item) {
+ onHostSelect: function (item) {
this.table.clear();
this.hideSidebar();
this.searchBox.value = "";
let [type, host] = item;
this.table.host = host;
this.table.datatype = type;
@@ -1174,18 +1174,18 @@ StorageUI.prototype = {
if (!showMenu) {
event.preventDefault();
}
},
/**
* Handles refreshing the selected storage
*/
- onRefreshTable: function (event) {
- this.onHostSelect(event, this.tree.selectedItem);
+ onRefreshTable: function () {
+ this.onHostSelect(this.tree.selectedItem);
},
/**
* Handles adding an item from the storage
*/
onAddItem: function () {
let front = this.getCurrentFront();
let [, host] = this.tree.selectedItem;
--- a/devtools/client/webconsole/jsterm.js
+++ b/devtools/client/webconsole/jsterm.js
@@ -768,17 +768,17 @@ JSTerm.prototype = {
this.hud._releaseObject(actor);
},
simpleValueEvalMacro: simpleValueEvalMacro,
overrideValueEvalMacro: overrideValueEvalMacro,
getterOrSetterEvalMacro: getterOrSetterEvalMacro,
});
// Relay events from the VariablesView.
- view.on("fetched", (event, type, variableObject) => {
+ view.on("fetched", (type, variableObject) => {
this.emit("variablesview-fetched", variableObject);
});
return view;
},
/**
* Update the variables view.
--- a/devtools/client/webconsole/new-webconsole.js
+++ b/devtools/client/webconsole/new-webconsole.js
@@ -229,17 +229,17 @@ NewWebConsoleFrame.prototype = {
},
_initShortcuts: function () {
let shortcuts = new KeyShortcuts({
window: this.window
});
shortcuts.on(l10n.getStr("webconsole.find.key"),
- (name, event) => {
+ event => {
this.filterBox.focus();
event.preventDefault();
});
let clearShortcut;
if (system.constants.platform === "macosx") {
clearShortcut = l10n.getStr("webconsole.clear.keyOSX");
} else {
@@ -249,17 +249,17 @@ NewWebConsoleFrame.prototype = {
shortcuts.on(clearShortcut, () => this.jsterm.clearOutput(true));
if (this.isBrowserConsole) {
shortcuts.on(l10n.getStr("webconsole.close.key"),
this.window.top.close.bind(this.window.top));
ZoomKeys.register(this.window);
} else if (Services.prefs.getBoolPref(PREF_SIDEBAR_ENABLED)) {
- shortcuts.on("Esc", (name, event) => {
+ shortcuts.on("Esc", event => {
if (!this.jsterm.autocompletePopup || !this.jsterm.autocompletePopup.isOpen) {
this.newConsoleOutput.dispatchSidebarClose();
}
});
}
},
/**
* Handler for page location changes.
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -631,17 +631,17 @@ WebConsoleFrame.prototype = {
},
_initShortcuts: function() {
var shortcuts = new KeyShortcuts({
window: this.window
});
shortcuts.on(l10n.getStr("webconsole.find.key"),
- (name, event) => {
+ event => {
this.filterBox.focus();
event.preventDefault();
});
let clearShortcut;
if (system.constants.platform === "macosx") {
clearShortcut = l10n.getStr("webconsole.clear.keyOSX");
} else {