mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1599962 - OBT should list remote <browser> elements when debugging non browser windows r=ochameau
Code change suggested by :Gijs to support non browser windows Differential Revision: https://phabricator.services.mozilla.com/D56349 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1b8752a702
commit
2dd4380765
@ -595,14 +595,28 @@ RootActor.prototype = {
|
||||
return { form: processDescriptor.form() };
|
||||
},
|
||||
|
||||
/**
|
||||
* Note that this method behaves differently when called for a top level
|
||||
* window.
|
||||
* For a top level window, it will ONLY return remote browser elements.
|
||||
* For any other window, it will return chidren elements, remote or not.
|
||||
*
|
||||
* Also important to note, this method only returns direct children, not the
|
||||
* complete browsing context tree.
|
||||
*/
|
||||
async _getChildBrowsingContexts(id) {
|
||||
// If we have the id of the parent, then we need to get the child
|
||||
// contexts in a special way. We have a method on the descriptor
|
||||
// to take care of this.
|
||||
const window = Services.wm.getMostRecentWindow(
|
||||
DebuggerServer.chromeWindowType
|
||||
);
|
||||
if (window && window.docShell.browsingContext.id === id) {
|
||||
const parentBrowsingContext = BrowsingContext.get(id);
|
||||
// If this is a parent-process window, and it's top-level (not embedded in a browser),
|
||||
// collect all the remote browsers in the window ourselves. getChildren() will not return
|
||||
// these contexts otherwise.
|
||||
if (
|
||||
parentBrowsingContext.window &&
|
||||
!parentBrowsingContext.embedderElement
|
||||
) {
|
||||
const { window } = parentBrowsingContext;
|
||||
return [
|
||||
...window.document.querySelectorAll(`browser[remote="true"]`),
|
||||
].map(browser => browser.browsingContext);
|
||||
@ -610,7 +624,6 @@ RootActor.prototype = {
|
||||
// for all other contexts, since we do not need to get contexts of
|
||||
// a different type, we can just get the children directly from
|
||||
// the BrowsingContext.
|
||||
const parentBrowsingContext = BrowsingContext.get(id);
|
||||
return parentBrowsingContext.getChildren();
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user