Closed Bug 1519314 Opened 6 years ago Closed 5 years ago

Handling Enter differently when devtools.webconsole.input.editor is true


(DevTools :: Console, task, P1)

65 Branch


(firefox69 fixed)

Firefox 69
Tracking Status
firefox69 --- fixed


(Reporter: nchevobbe, Assigned: transfusion, Mentored)



(Keywords: good-first-bug, Whiteboard: [console-editor-mvp])


(1 file, 1 obsolete file)

When the preference is enabled, hitting Enter should create a new line.
Evaluation should be done with Ctrl + Enter (Cmd + Enter on OSX).

Priority: -- → P2
Attachment #9037901 - Attachment is obsolete: true

If someone wants to work on this, they should be able to grab which implements what we want.
Then, a test should be added to make sure that hitting Ctrl (or Cmd on OSX) + Enter does execute the input (and Enter does not) when in editor mode.

You can have the JsTerm in editor mode by running firefox with the following: ./mach run --devtools --setpref devtools.webconsole.input.editor=true

To write the test, you can also have a look at what was done in Bug 1519315.

Mentor: nchevobbe

Erik, as discussed on Slack, I assign you this patch. Feel free to ask any question, either here or on slack

Assignee: nobody → okemmadueric

Hello Eric, how is it going on? Is anything blocking you?

Flags: needinfo?(okemmadueric)

Yes, couldn't ascertain why the function is not executing and dev tool debugger couldn't help me

Flags: needinfo?(okemmadueric)

Could you do a screencast and post it here (or on Slack) so we can check what's going on?

Type: defect → enhancement

clearing assignee

Assignee: okemmadueric → nobody
Keywords: good-first-bug
Type: enhancement → task

Summary of the process I went through to fix this bug:

  • Modified JSTerm.js based on , added lines 953 to 963, as well as a couple lines below that to handle the case where codeMirror is not enabled with the legacy JSTerm.
  • To write the test, you can also have a look at what was done in Bug 1519315. Bug 1519315 is still open, however, Bug 1519313 was relatively similar and I added the mochitests based on that, 2 subtests where the editor is enabled, and 3 where disabled, each run once without codeMirror and once with, thus 10 subtests in total.

I have a question about EventUtils.sendKey and about the testing framework in general, I was looking for a reference to the current "window" since the 2nd argument is function sendKey(aKey, aWindow) {; I looked in other tests and found some usages like toolbox.getCurrentPanel(), however I didn't completely understand what a panel was and how I should get a reference to it, and since we openNewTabAndConsole, only test on the focus console and I saw other tests not including the 2nd argument I decided to leave it out.

Documentation was also a bit sparse especially about some properties on the hud, but through dxr I was able to understand how findMessages and related functions work.

Assignee: nobody → bryan.wyern1
Priority: P2 → P1
Pushed by
Enter should create a new line, Ctrl-Enter should execute the input when 'devtools.webconsole.input.editor' is true. r=nchevobbe
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
Blocks: 1557632
Whiteboard: [console-editor-mvp]
You need to log in before you can comment on or make changes to this bug.