The default bug view has changed. See this FAQ.
Bug 862558 (split-console)

Web Console should always be available / visible

RESOLVED FIXED in Firefox 28

Status

()

Firefox
Developer Tools: Framework
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: rc, Assigned: bgrins)

Tracking

unspecified
Firefox 28
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [parity-chrome])

Attachments

(3 attachments, 10 obsolete attachments)

308.92 KB, image/png
Details
179.12 KB, image/png
Details
20.41 KB, patch
pbro
: review+
Details | Diff | Splinter Review
(Reporter)

Description

4 years ago
Created attachment 738189 [details] [diff] [review]
patch WIP

The console is the go-to place for messages and errors and to enter and evaluate quick bits of JS. As such, it's often destructive to have to switch panels to go to the Web Console from the Inspector, the Debugger, or wherever.

We should make the console a special entity in the Toolbox.
(Reporter)

Comment 1

4 years ago
Created attachment 738191 [details]
screenshot OS X

A very rough first draft. I think the console would look better on the bottom or possibly in a left-side-bar when the toolbox is on the bottom. Button needs to have a checked state when toggled on. Opening the console via the keyboard shortcut breaks things, etc. Needs work!
Assignee: nobody → rcampbell
Status: NEW → ASSIGNED
(Reporter)

Updated

4 years ago
Attachment #738189 - Attachment is patch: true
woooot! \o/
Mmmmmmm!
Maybe also move the web console icon to the right, along with the other togglable tool icons?
(Reporter)

Comment 4

4 years ago
(In reply to Panos Astithas [:past] from comment #3)
> Mmmmmmm!
> Maybe also move the web console icon to the right, along with the other
> togglable tool icons?

I think the console's more important than that position implies. It's not just a "bonus feature".
(In reply to Rob Campbell [:rc] (:robcee) from comment #4)
> 
> I think the console's more important than that position implies. It's not
> just a "bonus feature".

I also think it should be on the left, but it look like an ordinary tab (with borders and everything) to make it more obvious that "this is a tool, not a toggle". Just adding toolbox-tab devtools-tab classes should probably do the trick.
(In reply to Victor Porof [:vp] from comment #5)
s/but it look/but look/
This looks good. I like how nice and simple the patch is.

Suggestions:

- why not let the web console tool button visible as it was? Just add the new icon alongside Scratchpad.

  - or add a new more-obvious icon in the toolbox tab. I think the JS console needs to be more obvious than Scratchpad and friends. (due to importance)

I like that Web Inspector keeps the Console as a first-class tool even if it has a toggle for showing the console while you are in any tool.

- make the web console 'float' above the others? Currently the webconsole iframe is placed above the toolbox... a lot of space is being used.

  - or split the toolbox height between the current tool and the web console itself, such that the overall toolbox height doesn't change.

This is what Chrome's web inspector does. Dragonfly shows a floating console above the tools.

- add some logic in webconsole.js to tell it is "floating" mode. In floating mode you can hide the web console filters toolbar and perhaps we can turn of net logging temporarily. We can show net logs only when you switch back to the normal web console.

Thanks for your work on this! Please let me know if I can help with anything.
(Reporter)

Comment 8

4 years ago
Created attachment 740267 [details] [diff] [review]
WIP 2

Moved the panel to the bottom of the toolbox. Added better button handling.
Attachment #738189 - Attachment is obsolete: true
(Reporter)

Comment 9

4 years ago
(In reply to Mihai Sucan [:msucan] from comment #7)
> Suggestions:
> 
> - why not let the web console tool button visible as it was? Just add the
> new icon alongside Scratchpad.

nope. Gotta stay on the left. See comment #4.

>   - or add a new more-obvious icon in the toolbox tab. I think the JS
> console needs to be more obvious than Scratchpad and friends. (due to
> importance)
> 
> I like that Web Inspector keeps the Console as a first-class tool even if it
> has a toggle for showing the console while you are in any tool.

Yes. It is a first-class tool.

> - make the web console 'float' above the others? Currently the webconsole
> iframe is placed above the toolbox... a lot of space is being used.

Ugh. No more extra positioning options! Do you remember the panels?

>   - or split the toolbox height between the current tool and the web console
> itself, such that the overall toolbox height doesn't change.

overall toolbox height doesn't change. This just splits the available space in two.

> This is what Chrome's web inspector does. Dragonfly shows a floating console
> above the tools.
> 
> - add some logic in webconsole.js to tell it is "floating" mode. In floating
> mode you can hide the web console filters toolbar and perhaps we can turn of
> net logging temporarily. We can show net logs only when you switch back to
> the normal web console.

I think this is a separate thing. I want to create some bugs to provide a more focused JS entry mode than we have now. We'll have to do some work to figure out what that means still.
(Reporter)

Comment 10

4 years ago
Created attachment 740279 [details] [diff] [review]
WIP 3

more button fiddling.
Attachment #740267 - Attachment is obsolete: true
(Reporter)

Updated

4 years ago
Duplicate of this bug: 866219
(Reporter)

Updated

4 years ago
Summary: Web Console should always be available → Web Console should always be available / visible
Whiteboard: [parity-chrome]
(Reporter)

Comment 12

4 years ago
copying this here for reference:

http://people.mozilla.com/~shorlander/files/devtools/creation/DevTools-BuildTab-01-%28Projects%29.png
(Reporter)

Comment 13

4 years ago
Created attachment 748893 [details] [diff] [review]
Web Console should always be available / visible
(Reporter)

Updated

4 years ago
Attachment #740279 - Attachment is obsolete: true
Duplicate of this bug: 870655
(Reporter)

Comment 15

4 years ago
dropping this since we're exploring different REPL ideas.
Assignee: rcampbell → nobody
Status: ASSIGNED → NEW
Duplicate of this bug: 883225

Updated

4 years ago
Duplicate of this bug: 882484
(Reporter)

Comment 18

4 years ago
reassigning myself to this. Going to try it again.
Assignee: nobody → rcampbell
(Reporter)

Updated

3 years ago
Assignee: rcampbell → nobody
(Assignee)

Updated

3 years ago
Blocks: 892195
(Assignee)

Comment 19

3 years ago
Created attachment 828841 [details] [diff] [review]
split-console-WIP1.patch

I've come up with an approach that I think will work.  We attach the webconsole to a special box in toolbox.xul, then basically show/hide the splitter and the above deck depending on the state.

Still need to clean up the code a little bit, add a button, and add some limits to the UI on the splitter, but if you open it up you can toggle display by pressing escape.
Assignee: nobody → bgrinstead
Attachment #748893 - Attachment is obsolete: true
Status: NEW → ASSIGNED
(Assignee)

Comment 20

3 years ago
Created attachment 828842 [details]
splitconsole-wip1.png

A screenshot of the console when it is split.  There is a slider to change the height, and if you are on the console tab it looks like it usually does.
(Assignee)

Comment 21

3 years ago
Created attachment 828859 [details] [diff] [review]
split-console-WIP2.patch

Updated the code and added comments, also waits to load the console until requested instead of loading it right away.

Still need to do some analysis of if there are places where the escape key has another meaning - need to make sure that the key event's propagation is still being stopped.  Checked the inplace editor on the inspector, and it seems fine.
Attachment #828842 - Attachment is obsolete: true
(Assignee)

Updated

3 years ago
Attachment #828842 - Attachment is obsolete: false
(Assignee)

Updated

3 years ago
Attachment #828841 - Attachment is obsolete: true
(Assignee)

Comment 22

3 years ago
Created attachment 828908 [details] [diff] [review]
split-console-WIP3.patch

Changes from WIP2: Hides split console and splitter from start in XUL, fixes typo, adds initial test.

Rob or Mihai, I'd like some feedback about this general approach I'm taking here before I spend too much more time on it.
Attachment #828859 - Attachment is obsolete: true
Attachment #828908 - Flags: feedback?(rcampbell)
(Reporter)

Comment 23

3 years ago
that's pretty much the approach I was going towards, with the difference in my second attempt I was going to use a horizontal layout when docked at the bottom (and then switch directions when docked on the side).

Should be easy to flip that. I find the vertical split takes up too much space and is kind of wasteful, though neither approach is ideal really. E.g., when using the split console in the debugger, would be nice to only have the one variables view.
(Reporter)

Comment 24

3 years ago
Comment on attachment 828908 [details] [diff] [review]
split-console-WIP3.patch

This looks good.

I can see the splitter when the Console's the selected tool at the top (an extra black pixel border and the mouse cursor changes on hover).

Might be worth trying as victor suggested and hiding the toolbar with just JS and Logging options enabled when in split mode.
Attachment #828908 - Flags: feedback?(rcampbell)
(Assignee)

Comment 25

3 years ago
Created attachment 829339 [details] [diff] [review]
split-console-WIP4.patch

Hides splitter when console is open, adds min-height to split console and deck, fixes weirdness with debugger watch expressions by allowing stopPropagation() on escape key to cancel the event.
Attachment #828908 - Attachment is obsolete: true
(Assignee)

Comment 26

3 years ago
Created attachment 830420 [details] [diff] [review]
split-console.patch

This patch implements the split console behavior.  It can be triggered on/off with the 'escape' key.

There are two things with the UI that this patch does *not* do:
1) It does not tell the console when it is split, meaning that the toolbar is never removed.  There is a question of too much vertical space being taken, but I think removing the toolbar adds UI complications (what if you don't have certain filters applied so you aren't seeing log statements while paused at a breakpoint, for instance).  Additionally, we have some new designs that limit the height of the toolbars (like this: https://people.mozilla.org/~shorlander/mockups/devTools/ux-refresh-2013/DarkTheme-Console-AllToggled@2x.png).
2) It doesn't add any new buttons to the UI.  I think we will eventually want to show a button, but the escape key is pretty well-known for this functionality.

We can discuss either of these things further, but here is the patch without them.

Tests are passing locally, here is a try push: https://tbpl.mozilla.org/?tree=Try&rev=0b2836f01ec0
Attachment #829339 - Attachment is obsolete: true
Attachment #830420 - Flags: review?(mihai.sucan)
Comment on attachment 830420 [details] [diff] [review]
split-console.patch

Review of attachment 830420 [details] [diff] [review]:
-----------------------------------------------------------------

Patch looks good. r+ on the following grounds:

- this is really nicely working: it puts the console at the bottom of the toolbox and it splits the existing toolbox height, without pushing the page / lowering the height of the page.

- the console toolbar is far from ideal in this UI, but it's not really as bad as I expected. This is really usable.

- the benefit of having the console always visible outweighs the problems we have now for which we are undecided on solutions yet.

- the implementation you have is sufficiently clean.

I would like:

- a button for this new split console.
- a smaller console toolbar when the console is displayed at the bottom.

A button should be easy to add, to the left of the Console tab, or add the button in the group of small buttons on the right, where scratchpad is.

A smaller console toolbar only needs a toolbar class, based on which you could lower paddings for the buttons and toolbar and filter input. I think we should hide the icons on the buttons of categories (net/js/css/etc...).

If you prefer to do these in separate patches/bugs, you can do that. Please open the bugs. We should also have those patches landed in the same milestone.

Thank you!
Attachment #830420 - Flags: review?(mihai.sucan) → review+

Comment 28

3 years ago
Comment on attachment 830420 [details] [diff] [review]
split-console.patch

For what it's worth…
Attachment #830420 - Flags: feedback+

Comment 29

3 years ago
(In reply to Mihai Sucan [:msucan] from comment #27)
> - a button for this new split console.

I think we can add that in a followup (because we need an icon, and icons takes time).

> - a smaller console toolbar when the console is displayed at the bottom.

To avoid too many CSS code… I'd prefer if we don't do that. At some point, we will redesign these toolbars, and they will be smaller (bug 915414).

> A button should be easy to add, to the left of the Console tab, or add the
> button in the group of small buttons on the right, where scratchpad is.

You mean "right"?

Comment 30

3 years ago
Does this play nicely if the console is disabled in the option panel? (I didn't check)
(Assignee)

Comment 31

3 years ago
(In reply to Paul Rouget [:paul] from comment #30)
> Does this play nicely if the console is disabled in the option panel? (I
> didn't check)

No, it ends up throwing errors and breaking lots of things.  Good catch, that's something I didn't test for - I'll make sure that is covered.

On a related note, who would disable the console anyway?  Can we *not* allow disabling of the main set of tools?  I'm guessing there may be some code that interacts between panels that will be tricky to test for in this case.  For instance, if right clicking on a DOM node in the console opens the element in the inspector, we need to first check if the inspector exists.  If it doesn't then we need to remove the context menu item.  If the inspector is then re-added, we need to show it in the context menu again.  IMO, the standard set of tools should be always-available.  Then again, I may be missing something.

Comment 32

3 years ago
I want to be able to hide the console tab and just use the split console.

And I agree that disabling some tools in the console might break some other tools.
(Assignee)

Comment 33

3 years ago
(In reply to Paul Rouget [:paul] from comment #32)
> I want to be able to hide the console tab and just use the split console.
> 
> And I agree that disabling some tools in the console might break some other
> tools.

So I have a small update for the patch that will cause it to not break when the console panel is removed / added: https://hg.mozilla.org/try/rev/4a9ab5a77408.

But I don't think we should try to support the split console while the "console" is is disabled from the option panel.  Being able to keep the split console around even when the console panel has been removed complicated things quite a bit with how the toolbox and gDevTools works, and would require some bigger rewriting.  Here are a couple of the issues I see after looking into this:

* On initial page load, the console will not be part of the set because of its visibilityswitch will be false.  So when you split console, it will pull open an empty panel.  This can't be worked around by setting visibilityswitch to true on console, since then the panel will be added to the tab bar as well.
* When toolUnregistered is called it detroys the instance and removes the panel from the DOM: https://mxr.mozilla.org/mozilla-central/source/browser/devtools/framework/toolbox.js#797.  We could keep the webconsole panel / frame around *if* the request is coming from an option change, but we should still be removing the elements if it is requested for cleanup.
* Right now the nice part about this feature is that the webconsole is a little special, but isn't *that* special compared to other tools.  Allowing it to open even when removed would require quite a few specific workarounds.

I still believe that giving people options to disable these core tools is option-overload.  It presents users with options that are unlikely to ever be used intentionally.  There are a core set of tools that we should be providing to all users, and the console is probably at the top of this list.
(Assignee)

Updated

3 years ago
Depends on: 938172
(Assignee)

Comment 34

3 years ago
Instead up uploading a new patch to fix compatibility with disabled console, I am working on Bug 938172.
(Assignee)

Updated

3 years ago
Blocks: 938616
(Assignee)

Comment 35

3 years ago
(In reply to Mihai Sucan [:msucan] from comment #27)
> Comment on attachment 830420 [details] [diff] [review]
> split-console.patch
> 
> Review of attachment 830420 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Patch looks good. r+ on the following grounds:
> 
> - this is really nicely working: it puts the console at the bottom of the
> toolbox and it splits the existing toolbox height, without pushing the page
> / lowering the height of the page.
> 
> - the console toolbar is far from ideal in this UI, but it's not really as
> bad as I expected. This is really usable.
> 
> - the benefit of having the console always visible outweighs the problems we
> have now for which we are undecided on solutions yet.
> 
> - the implementation you have is sufficiently clean.
> 
> I would like:
> 
> - a button for this new split console.
> - a smaller console toolbar when the console is displayed at the bottom.
> 
> A button should be easy to add, to the left of the Console tab, or add the
> button in the group of small buttons on the right, where scratchpad is.
> 
> A smaller console toolbar only needs a toolbar class, based on which you
> could lower paddings for the buttons and toolbar and filter input. I think
> we should hide the icons on the buttons of categories (net/js/css/etc...).
> 
> If you prefer to do these in separate patches/bugs, you can do that. Please
> open the bugs. We should also have those patches landed in the same
> milestone.
> 
> Thank you!

I've opened Bug 938616 to land in the same release, and will work with Darrin on these updates.
(Assignee)

Comment 36

3 years ago
https://hg.mozilla.org/integration/fx-team/rev/2887e3a300ed
https://tbpl.mozilla.org/?tree=Fx-Team&rev=2887e3a300ed
Whiteboard: [parity-chrome] → [parity-chrome][fixed-in-fx-team]
Backed out in  https://hg.mozilla.org/integration/fx-team/rev/4cca85b2241d for breaking a browser-chrome test: https://tbpl.mozilla.org/php/getParsedLog.php?id=30721837&tree=Fx-Team
(Assignee)

Comment 38

3 years ago
(In reply to Wes Kocher (:KWierso) from comment #37)
> Backed out in  https://hg.mozilla.org/integration/fx-team/rev/4cca85b2241d
> for breaking a browser-chrome test:
> https://tbpl.mozilla.org/php/getParsedLog.php?id=30721837&tree=Fx-Team

Oops, looks like a test from Bug 889638 was failing.  Fixed and pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=d1b317eb105f.
(Assignee)

Comment 39

3 years ago
Created attachment 8334475 [details] [diff] [review]
split-console.patch

Patrick,
Can you have a look at the changes I made to Tooltip.js?  I needed to stopPropagation on the escape key, but only when there was an active swatch.

Try push: https://tbpl.mozilla.org/?tree=Try&rev=4c49238099b2
Attachment #830420 - Attachment is obsolete: true
Attachment #8334475 - Flags: review?(pbrosset)
I haven't seen anything problematic in the code, but since this is mostly a UI change, I'm currently building with this patch and will test before R+ing.
Comment on attachment 8334475 [details] [diff] [review]
split-console.patch

Review of attachment 8334475 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me. As said above, I'll run a few manual tests.

::: browser/devtools/shared/widgets/Tooltip.js
@@ +513,5 @@
> +  this._onTooltipKeypress = (eventName, code, event) => {
> +    if (this.activeSwatch) {
> +      if (code === ESCAPE_KEYCODE) {
> +        this.revert();
> +        event.stopPropagation();

So this is for the case when you press escape to close the colorpicker, to avoid opening the webconsole.
That change is fine with me.
In fact, I added the attribute ignorekeys="true" on the XUL panel in tooltip.js in order to be able to control the behavior when keys are pressed, but that means that the XUL panel itself isn't blocking keypresses anymore so we should stop their propagation ourselves (in `this._onKeyPress`).

::: browser/devtools/webconsole/test/browser_webconsole_split.js
@@ +20,5 @@
> +  {
> +    info("About to check console loads even when non-webconsole panel is open");
> +
> +    openPanel("inspector").then(() => {
> +      toolbox.on("webconsole-ready", () => {

Out of curiosity, how is the webconsole loaded even when the panel isn't open? I haven't seen anything in your patch that loads it. Was this already the case?
(Assignee)

Comment 42

3 years ago
Created attachment 8334496 [details] [diff] [review]
split-console.patch

(In reply to Patrick Brosset from comment #41)
> Comment on attachment 8334475 [details] [diff] [review]
> split-console.patch
> 
> Review of attachment 8334475 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Looks good to me. As said above, I'll run a few manual tests.
> 
> ::: browser/devtools/shared/widgets/Tooltip.js
> @@ +513,5 @@
> > +  this._onTooltipKeypress = (eventName, code, event) => {
> > +    if (this.activeSwatch) {
> > +      if (code === ESCAPE_KEYCODE) {
> > +        this.revert();
> > +        event.stopPropagation();
> 
> So this is for the case when you press escape to close the colorpicker, to
> avoid opening the webconsole.
> That change is fine with me.
> In fact, I added the attribute ignorekeys="true" on the XUL panel in
> tooltip.js in order to be able to control the behavior when keys are
> pressed, but that means that the XUL panel itself isn't blocking keypresses
> anymore so we should stop their propagation ourselves (in
> `this._onKeyPress`).

I've updated the patch to stop propagation in _onKeyPress - which I agree will be better so we don't bump into this with new tooltips.

> 
> ::: browser/devtools/webconsole/test/browser_webconsole_split.js
> @@ +20,5 @@
> > +  {
> > +    info("About to check console loads even when non-webconsole panel is open");
> > +
> > +    openPanel("inspector").then(() => {
> > +      toolbox.on("webconsole-ready", () => {
> 
> Out of curiosity, how is the webconsole loaded even when the panel isn't
> open? I haven't seen anything in your patch that loads it. Was this already
> the case?

It loads when loadTool is called (this is usually initiated by selectTool, but in the case of the split console it is initiated by toggleSplitConsole).
Attachment #8334475 - Attachment is obsolete: true
Attachment #8334475 - Flags: review?(pbrosset)
Attachment #8334496 - Flags: review?(pbrosset)
(Assignee)

Updated

3 years ago
Whiteboard: [parity-chrome][fixed-in-fx-team] → [parity-chrome]
Comment on attachment 8334496 [details] [diff] [review]
split-console.patch

Review of attachment 8334496 [details] [diff] [review]:
-----------------------------------------------------------------

Looking good!
Attachment #8334496 - Flags: review?(pbrosset) → review+
(Assignee)

Comment 44

3 years ago
(In reply to Patrick Brosset from comment #43)
> Comment on attachment 8334496 [details] [diff] [review]
> split-console.patch
> 
> Review of attachment 8334496 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Looking good!

Try push: https://tbpl.mozilla.org/?tree=Try&rev=60b04f9edf9b
(Assignee)

Comment 45

3 years ago
https://hg.mozilla.org/integration/fx-team/rev/7eaa1a0d3fe1
https://tbpl.mozilla.org/?tree=Fx-Team&rev=7eaa1a0d3fe1
Whiteboard: [parity-chrome] → [parity-chrome][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/7eaa1a0d3fe1
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [parity-chrome][fixed-in-fx-team] → [parity-chrome]
Target Milestone: --- → Firefox 28
Is there any other automation needed for this?
Flags: needinfo?

Comment 48

3 years ago
Hi anyone, I want to know the pressing Esc key will toggle "split console" on other panels is a feature? or a bug? I feel this is annoying and anomaly.
(In reply to YF (Yang) from comment #48)
> Hi anyone, I want to know the pressing Esc key will toggle "split console"
> on other panels is a feature? or a bug? I feel this is annoying and anomaly.
This is a feature, it's pretty useful to be able to get access to the console from any panel. Some usecases are: 
- in the inspector, you might need the console to get properties about the node currently selector (typing $0)
- in the debugger, you might want to evaluate some code when paused at a breakpoint
I guess using the console while on a different panel is less common, but very useful nonetheless.
If I'm not mistaken, other devtools do this too.

This feature was added in FF28 and announced here: https://hacks.mozilla.org/2013/12/split-console-pretty-print-minified-js-and-more-firefox-developer-tools-episode-28/
Flags: needinfo?

Comment 50

3 years ago
(In reply to Patrick Brosset [:pbrosset] [:patrick] from comment #49)
Okay, thanks for the reply.

But if I open the Developer Tools - Network panel, trying to load a large or slow pages, and try press Esc key to abort the loading, this feature would be triggered.
Perhaps this should not be happened?
I see your usecase, but I don't see how we could detect that you want to stop the loading rather than opening the split console. And since we want to have the split console consistently on all panels, we have to have this listener there too.
The only way I see is for you to make sure that the content window is focused, rather than the devtools frame, this way, when pressing ESC, the devtools won't be getting the event at all.

Comment 52

3 years ago
(In reply to Patrick Brosset [:pbrosset] [:patrick] from comment #51)
Well, although it is not perfect (the focus initial in devtools, and this behavior is normal in the previous version).
Thanks again.
Alias: split-console
You need to log in before you can comment on or make changes to this bug.