mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Bug 1610562 - take into account multiple browsing contexts when getting a node from content DOM reference. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D60545 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
12e43d2102
commit
139344118f
2 changed files with 13 additions and 12 deletions
|
|
@ -730,8 +730,7 @@ DevTools.prototype = {
|
||||||
// new-node-front tells us when the node has been selected, whether the
|
// new-node-front tells us when the node has been selected, whether the
|
||||||
// browser is remote or not.
|
// browser is remote or not.
|
||||||
const onNewNode = inspector.selection.once("new-node-front");
|
const onNewNode = inspector.selection.once("new-node-front");
|
||||||
|
const nodeFront = await inspector.inspectorFront.getNodeActorFromContentDomReference(
|
||||||
const nodeFront = await inspector.walker.getNodeActorFromContentDomReference(
|
|
||||||
domReference
|
domReference
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -771,7 +770,7 @@ DevTools.prototype = {
|
||||||
startTime
|
startTime
|
||||||
);
|
);
|
||||||
const inspectorFront = await toolbox.target.getFront("inspector");
|
const inspectorFront = await toolbox.target.getFront("inspector");
|
||||||
const nodeFront = await inspectorFront.walker.getNodeActorFromContentDomReference(
|
const nodeFront = await inspectorFront.getNodeActorFromContentDomReference(
|
||||||
domReference
|
domReference
|
||||||
);
|
);
|
||||||
// Select the accessible object in the panel and wait for the event that
|
// Select the accessible object in the panel and wait for the event that
|
||||||
|
|
|
||||||
|
|
@ -168,22 +168,24 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) {
|
||||||
return this.walker.gripToNodeFront(grip);
|
return this.walker.gripToNodeFront(grip);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { contentDomReference } = grip;
|
return this.getNodeActorFromContentDomReference(grip.contentDomReference);
|
||||||
const { browsingContextId } = contentDomReference;
|
}
|
||||||
|
|
||||||
// If the grip lives in the same browsing context id than the current one, we can
|
async getNodeActorFromContentDomReference(contentDomReference) {
|
||||||
// directly use the current walker.
|
const { browsingContextId } = contentDomReference;
|
||||||
// TODO: When Bug 1578745 lands, we might want to force using `this.walker` as well
|
// If the contentDomReference lives in the same browsing context id than the
|
||||||
// when the new pref is set to false.
|
// current one, we can directly use the current walker.
|
||||||
|
// TODO: When Bug 1578745 lands, we might want to force using `this.walker`
|
||||||
|
// as well when the new pref is set to false.
|
||||||
if (this.targetFront.browsingContextID === browsingContextId) {
|
if (this.targetFront.browsingContextID === browsingContextId) {
|
||||||
return this.walker.getNodeActorFromContentDomReference(
|
return this.walker.getNodeActorFromContentDomReference(
|
||||||
contentDomReference
|
contentDomReference
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the contentDomReference has a different browsing context than the current one,
|
// If the contentDomReference has a different browsing context than the
|
||||||
// we are either in Fission or in the Multiprocess Browser Toolbox, so we need to
|
// current one, we are either in Fission or in the Multiprocess Browser
|
||||||
// retrieve the walker of the BrowsingContextTarget.
|
// Toolbox, so we need to retrieve the walker of the BrowsingContextTarget.
|
||||||
const descriptor = await this.targetFront.client.mainRoot.getBrowsingContextDescriptor(
|
const descriptor = await this.targetFront.client.mainRoot.getBrowsingContextDescriptor(
|
||||||
browsingContextId
|
browsingContextId
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue