Title: [163386] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
163386
Author
[email protected]
Date
2014-02-04 10:04:45 -0800 (Tue, 04 Feb 2014)

Log Message

Partially revert r162947 so that Document::topDocument() again Walk over the chain of
owner Elements. This fixes the crashes related to creating and accessing the AXObjectCache
of documents that were introduced in that revision, which determined the top document by
returning the Document of the main frame. This fails badly when the frame in question is cached.

Patch by Zan Dobersek <[email protected]> on 2014-02-04

* dom/Document.cpp:
(WebCore::Document::topDocument):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (163385 => 163386)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2014-02-04 18:00:11 UTC (rev 163385)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2014-02-04 18:04:45 UTC (rev 163386)
@@ -1,3 +1,13 @@
+2014-02-04  Zan Dobersek  <[email protected]>
+
+        Partially revert r162947 so that Document::topDocument() again Walk over the chain of
+        owner Elements. This fixes the crashes related to creating and accessing the AXObjectCache
+        of documents that were introduced in that revision, which determined the top document by
+        returning the Document of the main frame. This fails badly when the frame in question is cached.
+
+        * dom/Document.cpp:
+        (WebCore::Document::topDocument):
+
 2014-01-31  Anders Carlsson  <[email protected]>
 
         Don't allocate a new XMLHttpRequestStaticData every time staticData() is called

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp (163385 => 163386)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp	2014-02-04 18:00:11 UTC (rev 163385)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/dom/Document.cpp	2014-02-04 18:04:45 UTC (rev 163386)
@@ -4313,11 +4313,10 @@
 
 Document& Document::topDocument() const
 {
-    if (!m_frame)
-        return const_cast<Document&>(*this);
-    // This should always be non-null.
-    Document* mainFrameDocument = m_frame->mainFrame().document();
-    return mainFrameDocument ? *mainFrameDocument : const_cast<Document&>(*this);
+    Document* document = const_cast<Document*>(this);
+    while (Element* element = document->ownerElement())
+        document = &element->document();
+    return *document;
 }
 
 PassRefPtr<Attr> Document::createAttribute(const String& name, ExceptionCode& ec)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to