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:
Yura Zenevich 2020-01-22 16:26:37 +00:00
Родитель 12e43d2102
Коммит 139344118f
2 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -730,8 +730,7 @@ DevTools.prototype = {
// new-node-front tells us when the node has been selected, whether the
// browser is remote or not.
const onNewNode = inspector.selection.once("new-node-front");
const nodeFront = await inspector.walker.getNodeActorFromContentDomReference(
const nodeFront = await inspector.inspectorFront.getNodeActorFromContentDomReference(
domReference
);
@ -771,7 +770,7 @@ DevTools.prototype = {
startTime
);
const inspectorFront = await toolbox.target.getFront("inspector");
const nodeFront = await inspectorFront.walker.getNodeActorFromContentDomReference(
const nodeFront = await inspectorFront.getNodeActorFromContentDomReference(
domReference
);
// 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);
}
const { contentDomReference } = grip;
const { browsingContextId } = contentDomReference;
return this.getNodeActorFromContentDomReference(grip.contentDomReference);
}
// If the grip lives in the same browsing context id than the 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.
async getNodeActorFromContentDomReference(contentDomReference) {
const { browsingContextId } = contentDomReference;
// If the contentDomReference lives in the same browsing context id than the
// 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) {
return this.walker.getNodeActorFromContentDomReference(
contentDomReference
);
}
// If the contentDomReference has a different browsing context than the current one,
// we are either in Fission or in the Multiprocess Browser Toolbox, so we need to
// retrieve the walker of the BrowsingContextTarget.
// If the contentDomReference has a different browsing context than the
// current one, we are either in Fission or in the Multiprocess Browser
// Toolbox, so we need to retrieve the walker of the BrowsingContextTarget.
const descriptor = await this.targetFront.client.mainRoot.getBrowsingContextDescriptor(
browsingContextId
);