Display tabs grouped by window

ASSIGNED
Assigned to

Status

()

Firefox
Developer Tools: about:debugging
P2
normal
ASSIGNED
2 years ago
a year ago

People

(Reporter: ochameau, Assigned: bigben)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

2 years ago
So far, about:debugging is going to display tabs as a big linear list, ordered by windows and then by tab order in the browser.
It could be helpful to group them by top level window, but it requires improvement to the RootActor/BrowserTabList as listTabs doesn't return any information about windows.

Updated

2 years ago
Priority: -- → P2
(Using old-timer SQL vocabulary to make the bug title more precise.)
Summary: Display tabs sorted by window → Display tabs grouped by window
(Assignee)

Comment 2

a year ago
Created attachment 8780102 [details] [diff] [review]
Group tabs by window in about:debugging

Here's a patch proposal for this bug :)
It's a bit hacky and the UI definitely needs improvement (I guess we shouldn't display window IDs), but I need some feedback before moving forward.

I wasn't sure I would be able to get window information in RootActor/BrowserTabList listTabs, so I used windowEnumerator from about:debugging itself to match each tabActor with a window.
Attachment #8780102 - Flags: feedback?(poirot.alex)
(Assignee)

Updated

a year ago
Assignee: nobody → bchabod
Status: NEW → ASSIGNED
(Assignee)

Comment 3

a year ago
Created attachment 8780107 [details]
Patch demo
Works great! Thank you for addressing this.

(Not stealing Alex's request for feedback because I don't really understand how these `{window,tab}.outerWindowID`s are supposed work.)
(Reporter)

Comment 5

a year ago
(In reply to Benoit Chabod [:bigben] from comment #2)
> Created attachment 8780102 [details] [diff] [review]
> Group tabs by window in about:debugging
> 
> Here's a patch proposal for this bug :)
> It's a bit hacky and the UI definitely needs improvement (I guess we
> shouldn't display window IDs), but I need some feedback before moving
> forward.

First, in term of UI, I would make it so that, if there is only one window,
we omit displaying the big "Window #1" header.
The ID isn't really useful, but I don't see what we could say other than just "Window".
We may just say window 1, window 2, window 3 based on the natural order, which should reflect the OS order. Or use the z-index order, but that may be misleading.

> I wasn't sure I would be able to get window information in
> RootActor/BrowserTabList listTabs, so I used windowEnumerator from
> about:debugging itself to match each tabActor with a window.

That's not reasonable as it will break for remote devices.
You really have to tweak listTabs or come up with new requests to help doing that window sort.

For example, you could tweak TabActor.form to return helpful additional data:
http://searchfox.org/mozilla-central/source/devtools/server/actors/webbrowser.js#1091-1126
But given that this one is living in the child process, it doesn't have access to the top level window.
You may then modify BrowserTabActor.form which lives in the parent:
http://searchfox.org/mozilla-central/source/devtools/server/actors/webbrowser.js#2266-2278
  let topWindow = this._browser.ownerDocument.defaultView;
  form.topLevelOuterWindowID = topWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;

But the outerWindowID doesn't help you much sortering.
You may use another kind of id that you can sort:
  let topWindow = this._browser.ownerDocument.defaultView;
  let windowEnumerator = Services.ww.getWindowEnumerator();
  let index = 0, found = false;
  while (windowEnumerator.hasMoreElements()) {	
    let win = windowEnumerator.getNext();
    if (win == topWindow) {
      found = true;
      break;
    }
    index++;
  }
  if (found) {
    form.topLevelWindowIndex = index;
  }

You may also introduce some new helpers on the RootActor to list top level Windows, list them in explicit order, get their outer window IDs, other metadata...
(Reporter)

Updated

a year ago
Attachment #8780102 - Flags: feedback?(poirot.alex)
You need to log in before you can comment on or make changes to this bug.