Bug 1447715 - Remove old-event-emitter usage from sourceeditor; r=gl.
MozReview-Commit-ID: 6o8I7TtPiFU
--- a/devtools/client/debugger/content/views/sources-view.js
+++ b/devtools/client/debugger/content/views/sources-view.js
@@ -1093,17 +1093,17 @@ SourcesView.prototype = extend(WidgetMet
_onStopBlackBoxing: Task.async(function* () {
this.actions.blackbox(getSelectedSource(this.getState()), false);
}),
/**
* The source editor's contextmenu handler.
* - Toggles "Add Conditional Breakpoint" and "Edit Conditional Breakpoint" items
*/
- _onEditorContextMenuOpen: function (message, ev, popup) {
+ _onEditorContextMenuOpen: function (ev, popup) {
let actor = this.selectedValue;
let line = this.DebuggerView.editor.getCursor().line + 1;
let location = { actor, line };
let breakpoint = getBreakpoint(this.getState(), location);
let addConditionalBreakpointMenuItem = popup.querySelector("#se-dbg-cMenu-addConditionalBreakpoint");
let editConditionalBreakpointMenuItem = popup.querySelector("#se-dbg-cMenu-editConditionalBreakpoint");
--- a/devtools/client/debugger/debugger-view.js
+++ b/devtools/client/debugger/debugger-view.js
@@ -269,17 +269,17 @@ var DebuggerView = {
});
this.editor.appendTo(document.getElementById("editor")).then(() => {
this.editor.extend(DebuggerEditor);
this._loadingText = L10N.getStr("loadingText");
callback();
});
- this.editor.on("gutterClick", (ev, line, button) => {
+ this.editor.on("gutterClick", (line, button) => {
// A right-click shouldn't do anything but keep track of where
// it was clicked.
if (button == 2) {
this.clickedLine = line;
}
else {
const source = queries.getSelectedSource(this.controller.getState());
if (source) {
--- a/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-editor.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_breakpoints-editor.js
@@ -62,33 +62,31 @@ function test() {
});
callInTab(gTab, "firstCall");
let breakpointsAdded = 0;
let breakpointsRemoved = 0;
let editorBreakpointChanges = 0;
- function onEditorBreakpointAddFirst(aEvent, aLine) {
+ function onEditorBreakpointAddFirst(aLine) {
editorBreakpointChanges++;
- ok(aEvent,
- "breakpoint1 added to the editor.");
+ info("breakpoint1 added to the editor.");
is(aLine, 5,
"Editor breakpoint line is correct.");
is(gEditor.getBreakpoints().length, 1,
"editor.getBreakpoints().length is correct.");
}
- function onEditorBreakpointRemoveFirst(aEvent, aLine) {
+ function onEditorBreakpointRemoveFirst(aLine) {
editorBreakpointChanges++;
- ok(aEvent,
- "breakpoint1 removed from the editor.");
+ info("breakpoint1 removed from the editor.");
is(aLine, 5,
"Editor breakpoint line is correct.");
is(gEditor.getBreakpoints().length, 0,
"editor.getBreakpoints().length is correct.");
}
function checkFirstBreakpoint(location) {
@@ -154,21 +152,20 @@ function test() {
is(queries.getSelectedSource(getState()).actor, gSources.values[1],
"The second source should be currently selected.");
// Remove the trap listener.
gEditor.off("breakpointAdded", onEditorBreakpointAddBackgroundTrap);
}
- function onEditorBreakpointAddSwitch(aEvent, aLine) {
+ function onEditorBreakpointAddSwitch(aLine) {
editorBreakpointChanges++;
- ok(aEvent,
- "breakpoint2 added to the editor.");
+ info("breakpoint2 added to the editor.");
is(aLine, 4,
"Editor breakpoint line is correct.");
is(gEditor.getBreakpoints().length, 1,
"editor.getBreakpoints().length is correct");
}
function onEditorTextChanged() {
@@ -202,21 +199,20 @@ function test() {
let coords = gEditor.getCoordsFromPosition({ line: 4, ch: 0 });
let rect = iframe.getBoundingClientRect();
let left = rect.left + 10;
let top = rect.top + coords.top + 4;
utils.sendMouseEventToWindow("mousedown", left, top, 0, 1, 0, false, 0, 0);
utils.sendMouseEventToWindow("mouseup", left, top, 0, 1, 0, false, 0, 0);
}
- function onEditorBreakpointRemoveSecond(aEvent, aLine) {
+ function onEditorBreakpointRemoveSecond(aLine) {
editorBreakpointChanges++;
- ok(aEvent,
- "breakpoint2 removed from the editor.");
+ info("breakpoint2 removed from the editor.");
is(aLine, 4,
"Editor breakpoint line is correct.");
is(gEditor.getBreakpoints().length, 0,
"editor.getBreakpoints().length is correct.");
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.AFTER_FRAMES_CLEARED).then(() => {
finalCheck();
--- a/devtools/client/sourceeditor/editor.js
+++ b/devtools/client/sourceeditor/editor.js
@@ -25,17 +25,17 @@ const VALID_KEYMAPS = new Set(["emacs",
const MAX_VERTICAL_OFFSET = 3;
// Match @Scratchpad/N:LINE[:COLUMN] or (LINE[:COLUMN]) anywhere at an end of
// line in text selection.
const RE_SCRATCHPAD_ERROR = /(?:@Scratchpad\/\d+:|\()(\d+):?(\d+)?(?:\)|\n)/;
const RE_JUMP_TO_LINE = /^(\d+):?(\d+)?/;
const Services = require("Services");
-const events = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
const { PrefObserver } = require("devtools/client/shared/prefs");
const { getClientCssProperties } = require("devtools/shared/fronts/css-properties");
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/sourceeditor.properties");
const {
@@ -203,17 +203,17 @@ function Editor(config) {
if (this.config.cssProperties) {
// Ensure that autocompletion has cssProperties if it's passed in via the options.
this.config.autocompleteOpts.cssProperties = this.config.cssProperties;
} else {
// Use a static client-side database of CSS values if none is provided.
this.config.cssProperties = getClientCssProperties();
}
- events.decorate(this);
+ EventEmitter.decorate(this);
}
Editor.prototype = {
container: null,
version: null,
config: null,
Doc: null,