haikuwebkit/LayoutTests/webarchive/adopt-inline-styled-node-we...

68 lines
1.8 KiB
HTML
Raw Permalink Normal View History

WebCore: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed When moving Nodes between documents we weren't properly updating style declarations. Certain operations, such as creating webarchives, would tickle this bug. Tests: webarchive/adopt-attribute-styled-body-webarchive.html webarchive/adopt-attribute-styled-node-webarchive.html webarchive/adopt-inline-styled-node-webarchive.html * dom/Node.cpp: Add a debug-only mechanism to insure that anyone who overrides (did/will)MoveToNewOwnerDocument calls their parent-class implementation after they've done their own work. (WebCore::setWillMoveToNewOwnerDocumentWasCalled): (WebCore::setDidMoveToNewOwnerDocumentWasCalled): (WebCore::Node::setDocument): (WebCore::Node::willMoveToNewOwnerDocument): (WebCore::Node::didMoveToNewOwnerDocument): * dom/StyledElement.cpp: (WebCore::StyledElement::attributeChanged): Add a comment explaining why we don't need to walk the nameAttrMap to update style declarations. (WebCore::StyledElement::didMoveToNewOwnerDocument): Update the parent pointer for the inline style declaration. * dom/StyledElement.h: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::didMoveToNewOwnerDocument): Update the parent pointer for the link declaration. * html/HTMLBodyElement.h: LayoutTests: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-body-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-body-iframe.html: Added. * webarchive/resources/adopt-attribute-styled-body-second-window.html: Added. * webarchive/adopt-attribute-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-node-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-node-second-window.html: Added. * webarchive/adopt-inline-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-inline-styled-node-webarchive.html: Added. * webarchive/resources/adopt-inline-styled-node-second-window.html: Added. Canonical link: https://commits.webkit.org/35002@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-04-28 20:14:39 +00:00
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpDOMAsWebArchive();
testRunner.setCanOpenWindows();
testRunner.waitUntilDone();
WebCore: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed When moving Nodes between documents we weren't properly updating style declarations. Certain operations, such as creating webarchives, would tickle this bug. Tests: webarchive/adopt-attribute-styled-body-webarchive.html webarchive/adopt-attribute-styled-node-webarchive.html webarchive/adopt-inline-styled-node-webarchive.html * dom/Node.cpp: Add a debug-only mechanism to insure that anyone who overrides (did/will)MoveToNewOwnerDocument calls their parent-class implementation after they've done their own work. (WebCore::setWillMoveToNewOwnerDocumentWasCalled): (WebCore::setDidMoveToNewOwnerDocumentWasCalled): (WebCore::Node::setDocument): (WebCore::Node::willMoveToNewOwnerDocument): (WebCore::Node::didMoveToNewOwnerDocument): * dom/StyledElement.cpp: (WebCore::StyledElement::attributeChanged): Add a comment explaining why we don't need to walk the nameAttrMap to update style declarations. (WebCore::StyledElement::didMoveToNewOwnerDocument): Update the parent pointer for the inline style declaration. * dom/StyledElement.h: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::didMoveToNewOwnerDocument): Update the parent pointer for the link declaration. * html/HTMLBodyElement.h: LayoutTests: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-body-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-body-iframe.html: Added. * webarchive/resources/adopt-attribute-styled-body-second-window.html: Added. * webarchive/adopt-attribute-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-node-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-node-second-window.html: Added. * webarchive/adopt-inline-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-inline-styled-node-webarchive.html: Added. * webarchive/resources/adopt-inline-styled-node-second-window.html: Added. Canonical link: https://commits.webkit.org/35002@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-04-28 20:14:39 +00:00
}
var otherWindow = null;
function startTest()
{
otherWindow = window.open("resources/adopt-inline-styled-node-second-window.html", "TestWindow");
if (!otherWindow) {
alert("When running this test under Safari, popup blocking must be disabled.");
return;
}
tryAdoptNode();
}
function tryAdoptNode()
{
var otherSpan = otherWindow.document.getElementById("otherSpan");
if (!otherSpan) {
setTimeout("tryAdoptNode()", 10);
return;
}
var adoptedSpan = document.adoptNode(otherSpan);
document.getElementById("testSpan").appendChild(adoptedSpan);
otherWindow.close();
procedeAfterClosedWindow();
}
function procedeAfterClosedWindow()
{
if (!otherWindow.closed) {
setTimeout("procedeAfterClosedWindow()", 10);
return;
}
otherWindow = null;
if (window.GCController) {
GCController.collect();
if (window.testRunner)
testRunner.notifyDone();
WebCore: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed When moving Nodes between documents we weren't properly updating style declarations. Certain operations, such as creating webarchives, would tickle this bug. Tests: webarchive/adopt-attribute-styled-body-webarchive.html webarchive/adopt-attribute-styled-node-webarchive.html webarchive/adopt-inline-styled-node-webarchive.html * dom/Node.cpp: Add a debug-only mechanism to insure that anyone who overrides (did/will)MoveToNewOwnerDocument calls their parent-class implementation after they've done their own work. (WebCore::setWillMoveToNewOwnerDocumentWasCalled): (WebCore::setDidMoveToNewOwnerDocumentWasCalled): (WebCore::Node::setDocument): (WebCore::Node::willMoveToNewOwnerDocument): (WebCore::Node::didMoveToNewOwnerDocument): * dom/StyledElement.cpp: (WebCore::StyledElement::attributeChanged): Add a comment explaining why we don't need to walk the nameAttrMap to update style declarations. (WebCore::StyledElement::didMoveToNewOwnerDocument): Update the parent pointer for the inline style declaration. * dom/StyledElement.h: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::didMoveToNewOwnerDocument): Update the parent pointer for the link declaration. * html/HTMLBodyElement.h: LayoutTests: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-body-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-body-iframe.html: Added. * webarchive/resources/adopt-attribute-styled-body-second-window.html: Added. * webarchive/adopt-attribute-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-node-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-node-second-window.html: Added. * webarchive/adopt-inline-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-inline-styled-node-webarchive.html: Added. * webarchive/resources/adopt-inline-styled-node-second-window.html: Added. Canonical link: https://commits.webkit.org/35002@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-04-28 20:14:39 +00:00
else
alert("How strange - You have window.GCController, but no window.testRunner. How did this happen?");
WebCore: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed When moving Nodes between documents we weren't properly updating style declarations. Certain operations, such as creating webarchives, would tickle this bug. Tests: webarchive/adopt-attribute-styled-body-webarchive.html webarchive/adopt-attribute-styled-node-webarchive.html webarchive/adopt-inline-styled-node-webarchive.html * dom/Node.cpp: Add a debug-only mechanism to insure that anyone who overrides (did/will)MoveToNewOwnerDocument calls their parent-class implementation after they've done their own work. (WebCore::setWillMoveToNewOwnerDocumentWasCalled): (WebCore::setDidMoveToNewOwnerDocumentWasCalled): (WebCore::Node::setDocument): (WebCore::Node::willMoveToNewOwnerDocument): (WebCore::Node::didMoveToNewOwnerDocument): * dom/StyledElement.cpp: (WebCore::StyledElement::attributeChanged): Add a comment explaining why we don't need to walk the nameAttrMap to update style declarations. (WebCore::StyledElement::didMoveToNewOwnerDocument): Update the parent pointer for the inline style declaration. * dom/StyledElement.h: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::didMoveToNewOwnerDocument): Update the parent pointer for the link declaration. * html/HTMLBodyElement.h: LayoutTests: 2009-04-28 Brady Eidson <beidson@apple.com> Reviewed by Darin Adler <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-body-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-body-iframe.html: Added. * webarchive/resources/adopt-attribute-styled-body-second-window.html: Added. * webarchive/adopt-attribute-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-attribute-styled-node-webarchive.html: Added. * webarchive/resources/adopt-attribute-styled-node-second-window.html: Added. * webarchive/adopt-inline-styled-node-webarchive-expected.webarchive: Added. * webarchive/adopt-inline-styled-node-webarchive.html: Added. * webarchive/resources/adopt-inline-styled-node-second-window.html: Added. Canonical link: https://commits.webkit.org/35002@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2009-04-28 20:14:39 +00:00
}
else
alert("Now wait for garbage collection to have occured, then save the current page as a WebArchive.");
}
</script>
</head>
<body onload="startTest();">
<span id="testSpan">This test takes a node with inline style from a different document, moves it to this document, makes sure the other document has closed,
then makes a WebArchive from this document. The test passes if it doesn't crash. If running the test in Safari then garbage collection might get in the
way of fulling testing the bug. One should wait "awhile" before making the WebArchive.<br></span>
</body>
</html>