Skip to content
Permalink
Browse files
Web Inspector: subtree disapears from <iframe> after loading
https://bugs.webkit.org/show_bug.cgi?id=76552

Reviewed by Yury Semikhatsky.

Source/WebCore:

The problem was that content document subtree was not unbound upon iframe re-push.
Upon owner element refresh content document was not sent to the frontend
since backend assumed that front-end has already had the up-to-date version.

Test: inspector/elements/iframe-load-event.html

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::loadEventFired):

LayoutTests:

* inspector/elements/iframe-load-event-expected.txt: Added.
* inspector/elements/iframe-load-event.html: Added.
* inspector/elements/resources/iframe-load-event-iframe-1.html: Added.
* inspector/elements/resources/iframe-load-event-iframe-2.html: Added.
* inspector/elements/resources/iframe-load-event-iframe.js: Added.
(loadSecondIFrame):
(test.step1.nodeInserted):
(test.step1):
(test.step2):
(test):

Canonical link: https://commits.webkit.org/99957@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pavelfeldman committed Mar 29, 2012
1 parent 0d500ae commit 8cf6025e497140516365ae737e3fae88bd1c21d0
Showing 8 changed files with 128 additions and 14 deletions.
@@ -1,3 +1,21 @@
2012-03-29 Pavel Feldman <pfeldman@chromium.org>

Web Inspector: subtree disapears from <iframe> after loading
https://bugs.webkit.org/show_bug.cgi?id=76552

Reviewed by Yury Semikhatsky.

* inspector/elements/iframe-load-event-expected.txt: Added.
* inspector/elements/iframe-load-event.html: Added.
* inspector/elements/resources/iframe-load-event-iframe-1.html: Added.
* inspector/elements/resources/iframe-load-event-iframe-2.html: Added.
* inspector/elements/resources/iframe-load-event-iframe.js: Added.
(loadSecondIFrame):
(test.step1.nodeInserted):
(test.step1):
(test.step2):
(test):

2012-03-29 Joseph Pecoraro <pecoraro@apple.com>

<http://webkit.org/b/82558> Toggling <input type="range"> readonly or disabled state while active breaks all click events
@@ -0,0 +1,30 @@
Tests that iframe content is available after iframe's load event fired. See bug 76552.




After frame navigate
- <html>
- <head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script src="resources/iframe-load-event-iframe.js"></script>
</head>
- <body>
- <p>
"Tests that iframe content is available after iframe's load event fired. See "
<a href="http://webkit.org/b/76552">bug 76552</a>
"."
</p>
- <iframe id="myframe" src="resources/iframe-load-event-iframe-2.html" onload="runTest()">
- #document
- <html>
<head></head>
- <body>
<div id="iframe-2-element"></div>
</body>
</html>
</iframe>
</body>
</html>

@@ -0,0 +1,13 @@
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script src="resources/iframe-load-event-iframe.js"></script>
</head>
<body>
<p>
Tests that iframe content is available after iframe's load event fired. See <a href="http://webkit.org/b/76552">bug 76552</a>.
</p>
<iframe id="myframe" src="resources/iframe-load-event-iframe-1.html" onload="runTest()"></iframe>
</body>
</html>
@@ -0,0 +1,5 @@
<html>
<body>
<div id="iframe-1-element"></div>
</body>
</html>
@@ -0,0 +1,5 @@
<html>
<body>
<div id="iframe-2-element"></div>
</body>
</html>
@@ -0,0 +1,32 @@
function loadSecondIFrame()
{
document.getElementById("myframe").onload = null;
document.getElementById("myframe").src = "resources/iframe-load-event-iframe-2.html";
}

function test()
{
InspectorTest.expandElementsTree(step1);

function step1()
{
WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeInserted, nodeInserted);
InspectorTest.evaluateInPage("loadSecondIFrame()");

function nodeInserted(event)
{
var node = event.data;
if (node.getAttribute("id") === "myframe") {
InspectorTest.expandElementsTree(step2);
WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.NodeInserted, nodeInserted);
}
}
}

function step2()
{
InspectorTest.addResult("\n\nAfter frame navigate");
InspectorTest.dumpElementsTree();
InspectorTest.completeTest();
}
}
@@ -1,3 +1,19 @@
2012-03-29 Pavel Feldman <pfeldman@chromium.org>

Web Inspector: subtree disapears from <iframe> after loading
https://bugs.webkit.org/show_bug.cgi?id=76552

Reviewed by Yury Semikhatsky.

The problem was that content document subtree was not unbound upon iframe re-push.
Upon owner element refresh content document was not sent to the frontend
since backend assumed that front-end has already had the up-to-date version.

Test: inspector/elements/iframe-load-event.html

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::loadEventFired):

2012-03-29 Dana Jansens <danakj@chromium.org>

[chromium] Remove unneeded code+fixmes from CCOcclusionTracker
@@ -1371,20 +1371,15 @@ void InspectorDOMAgent::loadEventFired(Document* document)
if (!frameOwnerId)
return;

if (!m_childrenRequested.contains(frameOwnerId)) {
// No children are mapped yet -> only notify on changes of hasChildren.
m_frontend->childNodeCountUpdated(frameOwnerId, innerChildNodeCount(frameOwner));
} else {
// Re-add frame owner element together with its new children.
int parentId = m_documentNodeToIdMap.get(innerParentNode(frameOwner));
m_frontend->childNodeRemoved(parentId, frameOwnerId);
RefPtr<TypeBuilder::DOM::Node> value = buildObjectForNode(frameOwner, 0, &m_documentNodeToIdMap);
Node* previousSibling = innerPreviousSibling(frameOwner);
int prevId = previousSibling ? m_documentNodeToIdMap.get(previousSibling) : 0;
m_frontend->childNodeInserted(parentId, prevId, value.release());
// Invalidate children requested flag for the element.
m_childrenRequested.remove(m_childrenRequested.find(frameOwnerId));
}
// Re-add frame owner element together with its new children.
int parentId = m_documentNodeToIdMap.get(innerParentNode(frameOwner));
m_frontend->childNodeRemoved(parentId, frameOwnerId);
unbind(frameOwner, &m_documentNodeToIdMap);

RefPtr<TypeBuilder::DOM::Node> value = buildObjectForNode(frameOwner, 0, &m_documentNodeToIdMap);
Node* previousSibling = innerPreviousSibling(frameOwner);
int prevId = previousSibling ? m_documentNodeToIdMap.get(previousSibling) : 0;
m_frontend->childNodeInserted(parentId, prevId, value.release());
}

void InspectorDOMAgent::didInsertDOMNode(Node* node)

0 comments on commit 8cf6025

Please sign in to comment.