Title: [91965] trunk
Revision
91965
Author
[email protected]
Date
2011-07-28 17:38:32 -0700 (Thu, 28 Jul 2011)

Log Message

Unreviewed, rolling out r88601. (Requested by Sam Weinig).
http://trac.webkit.org/changeset/88601
https://bugs.webkit.org/show_bug.cgi?id=62230

Caused a regression, see https://bugs.webkit.org/show_bug.cgi?id=64378

Source/WebCore: 

* dom/StyledElement.cpp:
* dom/StyledElement.h:
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::parseMappedAttribute):
(WebCore::HTMLBodyElement::insertedIntoDocument):
(WebCore::HTMLBodyElement::didMoveToNewOwnerDocument):
* html/HTMLBodyElement.h:

LayoutTests: 

* fast/dom/body-link-decl-parent-crash-expected.txt: Removed.
* fast/dom/body-link-decl-parent-crash.html: Removed.
* fast/dom/styled-inline-style-decl-parent-crash-expected.txt: Removed.
* fast/dom/styled-inline-style-decl-parent-crash.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91964 => 91965)


--- trunk/LayoutTests/ChangeLog	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/LayoutTests/ChangeLog	2011-07-29 00:38:32 UTC (rev 91965)
@@ -1,3 +1,16 @@
+2011-07-28  Anders Carlsson  <[email protected]>
+
+        Unreviewed, rolling out r88601. (Requested by Sam Weinig).
+        http://trac.webkit.org/changeset/88601
+        https://bugs.webkit.org/show_bug.cgi?id=62230
+
+        Caused a regression, see https://bugs.webkit.org/show_bug.cgi?id=64378
+
+        * fast/dom/body-link-decl-parent-crash-expected.txt: Removed.
+        * fast/dom/body-link-decl-parent-crash.html: Removed.
+        * fast/dom/styled-inline-style-decl-parent-crash-expected.txt: Removed.
+        * fast/dom/styled-inline-style-decl-parent-crash.html: Removed.
+
 2011-07-28  Luke Zarko  <[email protected]>
 
         V8 should correctly serialize Boolean, Number and String objects.

Deleted: trunk/LayoutTests/fast/dom/body-link-decl-parent-crash-expected.txt (91964 => 91965)


--- trunk/LayoutTests/fast/dom/body-link-decl-parent-crash-expected.txt	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/LayoutTests/fast/dom/body-link-decl-parent-crash-expected.txt	2011-07-29 00:38:32 UTC (rev 91965)
@@ -1,5 +0,0 @@
-Test passes if it does not crash.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/body-link-decl-parent-crash.html (91964 => 91965)


--- trunk/LayoutTests/fast/dom/body-link-decl-parent-crash.html	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/LayoutTests/fast/dom/body-link-decl-parent-crash.html	2011-07-29 00:38:32 UTC (rev 91965)
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-</head>
-<body>
-Test passes if it does not crash.
-<div id="console"></div>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-
-iframe1 = document.createElement('iframe');
-document.body.appendChild(iframe1);
-document1 = iframe1.contentDocument.implementation.createHTMLDocument("document");
-var body1 = document1.body;
-document1.alinkColor = "blue";
-document1.body = document1.createElement('body');
-delete document1;
-gc();
-body1.vLink = 1;
-
-var successfullyParsed = true;
-</script>
-<script src=""
-</body>
-</html>

Deleted: trunk/LayoutTests/fast/dom/styled-inline-style-decl-parent-crash-expected.txt (91964 => 91965)


--- trunk/LayoutTests/fast/dom/styled-inline-style-decl-parent-crash-expected.txt	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/LayoutTests/fast/dom/styled-inline-style-decl-parent-crash-expected.txt	2011-07-29 00:38:32 UTC (rev 91965)
@@ -1,5 +0,0 @@
-Test passes if it does not crash.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/styled-inline-style-decl-parent-crash.html (91964 => 91965)


--- trunk/LayoutTests/fast/dom/styled-inline-style-decl-parent-crash.html	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/LayoutTests/fast/dom/styled-inline-style-decl-parent-crash.html	2011-07-29 00:38:32 UTC (rev 91965)
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src=""
-</head>
-<body>
-Test passes if it does not crash.
-<div id="console"></div>
-<script>
-if (window.layoutTestController)
-    layoutTestController.dumpAsText();
-
-iframe1 = document.createElement('iframe');
-document.body.appendChild(iframe1);
-document1 = iframe1.contentDocument.implementation.createHTMLDocument("document");
-var div1 = document1.createElement('div');
-document1.body.appendChild(div1);
-div1.style.color = "blue";
-document1.body.removeChild(div1);
-delete document1;
-gc();
-div1.style.color = "red";
-
-var successfullyParsed = true;
-</script>
-<script src=""
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (91964 => 91965)


--- trunk/Source/WebCore/ChangeLog	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/Source/WebCore/ChangeLog	2011-07-29 00:38:32 UTC (rev 91965)
@@ -1,3 +1,19 @@
+2011-07-28  Anders Carlsson  <[email protected]>
+
+        Unreviewed, rolling out r88601. (Requested by Sam Weinig).
+        http://trac.webkit.org/changeset/88601
+        https://bugs.webkit.org/show_bug.cgi?id=62230
+
+        Caused a regression, see https://bugs.webkit.org/show_bug.cgi?id=64378
+
+        * dom/StyledElement.cpp:
+        * dom/StyledElement.h:
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::parseMappedAttribute):
+        (WebCore::HTMLBodyElement::insertedIntoDocument):
+        (WebCore::HTMLBodyElement::didMoveToNewOwnerDocument):
+        * html/HTMLBodyElement.h:
+
 2011-07-28  Justin Schuh  <[email protected]>
 
         Simplify createCanonicalUUIDString implementation.

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (91964 => 91965)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2011-07-29 00:38:32 UTC (rev 91965)
@@ -450,22 +450,7 @@
         style->addSubresourceStyleURLs(urls);
 }
 
-void StyledElement::insertedIntoDocument()
-{
-    Element::insertedIntoDocument();
 
-    if (m_inlineStyleDecl)
-        m_inlineStyleDecl->setParent(document()->elementSheet());
-}
-
-void StyledElement::removedFromDocument()
-{
-    if (m_inlineStyleDecl)
-        m_inlineStyleDecl->setParent(0);
-
-    Element::removedFromDocument();
-}
-
 void StyledElement::didMoveToNewOwnerDocument()
 {
     if (m_inlineStyleDecl)

Modified: trunk/Source/WebCore/dom/StyledElement.h (91964 => 91965)


--- trunk/Source/WebCore/dom/StyledElement.h	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/Source/WebCore/dom/StyledElement.h	2011-07-29 00:38:32 UTC (rev 91965)
@@ -84,8 +84,6 @@
     // svgAttributeChanged (called when element.className.baseValue is set)
     void classAttributeChanged(const AtomicString& newClassString);
     
-    virtual void insertedIntoDocument();
-    virtual void removedFromDocument();
     virtual void didMoveToNewOwnerDocument();
 
 private:

Modified: trunk/Source/WebCore/html/HTMLBodyElement.cpp (91964 => 91965)


--- trunk/Source/WebCore/html/HTMLBodyElement.cpp	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/Source/WebCore/html/HTMLBodyElement.cpp	2011-07-29 00:38:32 UTC (rev 91965)
@@ -116,13 +116,6 @@
     } else if (attr->name() == vlinkAttr ||
                attr->name() == alinkAttr ||
                attr->name() == linkAttr) {
-        // This tells us that we are removed from document. If our document is later destroyed
-        // (not deleted since we hold a guardRef), our stylesheet list will be null causing a crash
-        // later in document()->styleSelector(). So, we bail out early because we shouldn't be
-        // modifying anything in that document. See webkit bug 62230.
-        if (m_linkDecl && !m_linkDecl->parent())
-            return;
-
         if (attr->isNull()) {
             if (attr->name() == linkAttr)
                 document()->resetLinkColor();
@@ -209,27 +202,8 @@
 
     if (document() && document()->page())
         document()->page()->updateViewportArguments();
-
-    if (m_linkDecl)
-        m_linkDecl->setParent(document()->elementSheet());
 }
 
-void HTMLBodyElement::removedFromDocument()
-{
-    if (m_linkDecl)
-        m_linkDecl->setParent(0);
-    
-    HTMLElement::removedFromDocument();
-}
-
-void HTMLBodyElement::didMoveToNewOwnerDocument()
-{
-    if (m_linkDecl)
-        m_linkDecl->setParent(document()->elementSheet());
-    
-    HTMLElement::didMoveToNewOwnerDocument();
-}
-
 bool HTMLBodyElement::isURLAttribute(Attribute *attr) const
 {
     return attr->name() == backgroundAttr;
@@ -371,4 +345,16 @@
     addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr)));
 }
 
+void HTMLBodyElement::didMoveToNewOwnerDocument()
+{
+    // When moving body elements between documents, we should have to reset the parent sheet for any
+    // link style declarations.  If we don't we might crash later.
+    // In practice I can't reproduce this theoretical problem.
+    // webarchive/adopt-attribute-styled-body-webarchive.html tries to make sure this crash won't surface.
+    if (m_linkDecl)
+        m_linkDecl->setParent(document()->elementSheet());
+    
+    HTMLElement::didMoveToNewOwnerDocument();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLBodyElement.h (91964 => 91965)


--- trunk/Source/WebCore/html/HTMLBodyElement.h	2011-07-29 00:26:00 UTC (rev 91964)
+++ trunk/Source/WebCore/html/HTMLBodyElement.h	2011-07-29 00:38:32 UTC (rev 91965)
@@ -74,8 +74,6 @@
     virtual void parseMappedAttribute(Attribute*);
 
     virtual void insertedIntoDocument();
-    virtual void removedFromDocument();
-    virtual void didMoveToNewOwnerDocument();
 
     void createLinkDecl();
     
@@ -93,6 +91,8 @@
     virtual int scrollWidth();
     
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
+    
+    virtual void didMoveToNewOwnerDocument();
 
     RefPtr<CSSMutableStyleDeclaration> m_linkDecl;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to