Skip to content

Commit 371ad09

Browse files
AleksanderBodurrialxhub
authored andcommitted
fix(devtools): ignore DOM Nodes from other frames when performing render tree detection (#57518)
Previously, if an application had DOM Nodes injected into it from other frames, DevTools would fail to parse component trees with the render tree strategy properly because of an instanceof Node check that the framework performs. Now we check for instanceof Node before even calling framework debug APIs on DOM nodes so that we can skip nodes that come from other frames entirely. PR Close #57518
1 parent 73ad6ea commit 371ad09

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • devtools/projects/ng-devtools-backend/src/lib/directive-forest

‎devtools/projects/ng-devtools-backend/src/lib/directive-forest/render-tree.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const extractViewTree = (
1919
getComponent: (element: Element) => {} | null,
2020
getDirectives: (node: Node) => {}[],
2121
): ComponentTreeNode[] => {
22+
// Ignore DOM Node if it came from a different frame. Use instanceof Node to check this.
23+
if (!(domNode instanceof Node)) {
24+
return result;
25+
}
26+
2227
const directives = getDirectives(domNode);
2328
if (!directives.length && !(domNode instanceof Element)) {
2429
return result;

0 commit comments

Comments
 (0)