[toolbox] Detached remotable tools should update their target when the current browser tab changes

RESOLVED DUPLICATE of bug 820524

Status

()

Firefox
Developer Tools: Framework
P4
normal
RESOLVED DUPLICATE of bug 820524
5 years ago
4 years ago

People

(Reporter: Optimizer, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
STR:
1. Open Web Console in an attached Toolbox. (Ctrl Shift K)
2. Detach the toolbox
3. Switch to another tab
4. Open the debugger by switching to its tab in the toolbox
5. The debugger shows scripts from the current selected tab, and not the tab from which the toolbox was detached.

Updated

5 years ago
Blocks: 816946
Priority: -- → P1

Comment 1

5 years ago
No need to go through the "detach" process to see this bug. Just ensure the toolbox is detached by default.
(Reporter)

Comment 2

5 years ago
FWIW, this issue is only with Web Console and Debugger.
Assignee: nobody → jwalker
Component: Developer Tools → Developer Tools: Framework

Comment 3

5 years ago
I think the problem is all the references to gBrowser.selected(Tab|Browser) in DebuggerUI.jsm and HUDService.jsm:

> grep "selected\(Tab\|Browser\)" browser/devtools/{debugger,webconsole,inspector,styleeditor}/*
(Reporter)

Comment 4

5 years ago
Yes, because the client (the toolbox ui) does not specifically tell the server about the exact tab to select. Previously, this was always the selected tab (unless done by JS) when done through the corresponding tool. But noq, as the tool can be detached from the tab, so hen any new tool is opened, the server still takes the selected tab as the target.

I overcame this issue in Timeline by adding the linkedPanel id for the tab in the hello message to the server. The server then traverse through all tabs and finds the correct tab to attach as target for the Timeline.

Inspector and Style Editor directly take the toolbox.target.tab as they are not meant for RDP yet.
The problem is twofold. The first part stems from the fact that we haven't unified the debugger and console to use a single debugger client in the local/tab debugging case. There are still some TODOs left in the code to that effect. When each tool is selected it makes a new connection to the server, getting the selected tab at the time of the connection. This explains the fact that the tools get a different tab to work with.

The second part is that the console and the debugger cache the selected tab for the lifetime of the tool, since there was no need to retrieve it again in the pre-toolbox world. You can observe this by switching back and forth between the console's and the debugger's target tabs. This can be resolved by refetching the list of tabs when the toolbox receives focus again, after the user has switched tabs and goes back to the tools window.

I could work on this if Joe or someone else could take care of bug 820343.

Comment 6

5 years ago
Joe, are you working on this?
I'm happy for Past to take this, I expect he knows the code better.
Assignee: jwalker → past
(In reply to Panos Astithas [:past] from comment #5)
> The problem is twofold. The first part stems from the fact that we haven't
> unified the debugger and console to use a single debugger client in the
> local/tab debugging case. There are still some TODOs left in the code to
> that effect. When each tool is selected it makes a new connection to the
> server, getting the selected tab at the time of the connection. This
> explains the fact that the tools get a different tab to work with.

This part is bug 820524.

> The second part is that the console and the debugger cache the selected tab
> for the lifetime of the tool, since there was no need to retrieve it again
> in the pre-toolbox world. You can observe this by switching back and forth
> between the console's and the debugger's target tabs. This can be resolved
> by refetching the list of tabs when the toolbox receives focus again, after
> the user has switched tabs and goes back to the tools window.

I'll use this bug to fix this part.
Depends on: 820524
Summary: [toolbox] Opening a tool by switching to it in detached toolbox acts incorrectly → [toolbox] Detached remotable tools should update their target when the current browser tab changes
Going through my backlog, I looked again at this bug. The main problem identified here was fixed a long time ago in bug 820524, so I'm resetting priority to match reality.

Wondering what other developer tools do, I tried Chrome and Firebug. Chrome does exactly what we do, a detached toolbox doesn't change its target, while Firebug does something potentially more useful, but confusing as implemented: the detached toolbox follows the selected tab, but it's not enabled automatically, presenting an empty gray box with a button to enable it.

Doing what Firebug does is a lot of work for us, because we'll have to move tool state from the individual tool panels to a shared location, attached to the target. That is not necessarily a bad design decision, but I find the UX that it provides to be lacking. It's a very rare case in my experience to have multiple tabs open for debugging and wanting to switch among them. I've never heard from anyone else that they do that either. It's much more common for me to have a toolbox open for a tab I'm working on, and then decide to switch to the GMail tab or the IRCCloud tab for a bit, before resuming debugging in the first tab. If that interruption is long enough that I lose context of what I was doing, seeing the empty Firebug window only gives me the impulse to close it (I wouldn't go through my ~100 open tabs to see where it was opened), whereas our (or Chrome's) toolbox shows the URL on the title bar with the last open tool state intact. Re-attaching the toolbox to the tab again will also bring it to front, which is a fast way to get back to where I was.

For the reasons above I'm inclined to mark this bug as WONTFIX, but I'll leave it at P4 for now (patches accepted) in case others feel differently, or until we get a chance to discuss it.
Assignee: past → nobody
Priority: P1 → P4
I think this is so unlikely to get done that we should WONTFIX to save the repeated triage time.
(Reporter)

Comment 11

4 years ago
I also agree that this should be WONTFIX.
Firebug's behavior is very confusing indeed. Firstly, it makes tab switching so heavy as loading/unloading of devtools will be involved.
Also, in some cases, we might want both the undocked toolbox targeting tab 1 along with the tab 2 itself open side by side for some cases, which is (to my knowledge) impossible with firebug's way of doing things.

The base problem, as mentioned by Panos, is already fixed in another bug.

I am instead marking this bug as duplicate of bug 820524
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 820524
You need to log in before you can comment on or make changes to this bug.