| Index: third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| index 0ceb294c59525ae7a89873664d29373976394f87..afa0ab80e2ff54264c37b1db0c11bfd90bd30778 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| @@ -250,6 +250,7 @@ InspectorDOMAgent::InspectorDOMAgent(v8::Isolate* isolate, InspectedFrames* insp
|
| , m_documentNodeToIdMap(new NodeToIdMap())
|
| , m_lastNodeId(1)
|
| , m_suppressAttributeModifiedEvent(false)
|
| + , m_mayCrossIframeBoundary(false)
|
| , m_backendNodeIdToInspect(0)
|
| {
|
| }
|
| @@ -543,9 +544,14 @@ void InspectorDOMAgent::pushChildNodesToFrontend(int nodeId, int depth)
|
|
|
| depth--;
|
|
|
| + if (m_mayCrossIframeBoundary && node->isFrameOwnerElement()) {
|
| + int iframeDocumentId = nodeMap->get(toHTMLFrameOwnerElement(node)->contentDocument()->documentElement());
|
| + CHECK(iframeDocumentId);
|
| + pushChildNodesToFrontend(iframeDocumentId, depth);
|
| + }
|
| for (node = innerFirstChild(node); node; node = innerNextSibling(node)) {
|
| int childNodeId = nodeMap->get(node);
|
| - ASSERT(childNodeId);
|
| + CHECK(childNodeId);
|
| pushChildNodesToFrontend(childNodeId, depth);
|
| }
|
|
|
| @@ -613,8 +619,16 @@ void InspectorDOMAgent::requestChildNodes(ErrorString* errorString, int nodeId,
|
| *errorString = "Please provide a positive integer as a depth or -1 for entire subtree";
|
| return;
|
| }
|
| - if (sanitizedDepth == -1)
|
| + bool prevMayCrossIframeBoundary = m_mayCrossIframeBoundary;
|
| + if (sanitizedDepth == -1) {
|
| sanitizedDepth = INT_MAX;
|
| + m_mayCrossIframeBoundary = true;
|
| + } else {
|
| + m_mayCrossIframeBoundary = false;
|
| + }
|
| + // Cached results may not be valid if |m_mayCrossIframeBoundary| changes.
|
| + if (prevMayCrossIframeBoundary != m_mayCrossIframeBoundary)
|
| + m_childrenRequested.clear();
|
|
|
| pushChildNodesToFrontend(nodeId, sanitizedDepth);
|
| }
|
| @@ -1604,6 +1618,10 @@ std::unique_ptr<protocol::Array<protocol::DOM::Node>> InspectorDOMAgent::buildAr
|
| depth--;
|
| m_childrenRequested.add(bind(container, nodesMap));
|
|
|
| + if (m_mayCrossIframeBoundary && container->isFrameOwnerElement()) {
|
| + Node* iframeDocument = toHTMLFrameOwnerElement(container)->contentDocument()->documentElement();
|
| + children->addItem(buildObjectForNode(iframeDocument, depth, nodesMap));
|
| + }
|
| while (child) {
|
| children->addItem(buildObjectForNode(child, depth, nodesMap));
|
| child = innerNextSibling(child);
|
|
|