Title: [177441] trunk/Source/WebCore
Revision
177441
Author
[email protected]
Date
2014-12-17 02:14:32 -0800 (Wed, 17 Dec 2014)

Log Message

The SVGDocument of an SVGImage should not perform any additional actions when the SVGImage is being destroyed
https://bugs.webkit.org/show_bug.cgi?id=139644

Reviewed by Antti Koivisto.

When an SVGImage is destroyed, having its SVGDocument perform style recalc and dispatching events is not only
useless but can also cause problems, such as re-entrancy in StyleResolver::loadPendingResources.

No new tests required, existing tests cover this change.

* dom/Document.cpp:
(WebCore::Document::Document):
* dom/Document.h:
(WebCore::Document::isBeingDestroyed):
(WebCore::Document::setIsBeingDestroyed):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::closeURL):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::~SVGImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (177440 => 177441)


--- trunk/Source/WebCore/ChangeLog	2014-12-17 09:51:01 UTC (rev 177440)
+++ trunk/Source/WebCore/ChangeLog	2014-12-17 10:14:32 UTC (rev 177441)
@@ -1,3 +1,25 @@
+2014-12-17  Radu Stavila  <[email protected]>
+
+        The SVGDocument of an SVGImage should not perform any additional actions when the SVGImage is being destroyed
+        https://bugs.webkit.org/show_bug.cgi?id=139644
+
+        Reviewed by Antti Koivisto.
+
+        When an SVGImage is destroyed, having its SVGDocument perform style recalc and dispatching events is not only
+        useless but can also cause problems, such as re-entrancy in StyleResolver::loadPendingResources.
+
+        No new tests required, existing tests cover this change.
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        * dom/Document.h:
+        (WebCore::Document::isBeingDestroyed):
+        (WebCore::Document::setIsBeingDestroyed):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::closeURL):
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::~SVGImage):
+
 2014-12-17  Chris Dumez  <[email protected]>
 
         Drop useless 'clipToContents' argument for windowClipRect()

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (177440 => 177441)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2014-12-17 09:51:01 UTC (rev 177440)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2014-12-17 10:14:32 UTC (rev 177441)
@@ -539,10 +539,18 @@
 bool FrameLoader::closeURL()
 {
     history().saveDocumentState();
-    
-    // Should only send the pagehide event here if the current document exists and has not been placed in the page cache.    
+
     Document* currentDocument = m_frame.document();
-    stopLoading(currentDocument && !currentDocument->inPageCache() ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly);
+    UnloadEventPolicy unloadEventPolicy;
+    if (m_frame.page() && m_frame.page()->chrome().client().isSVGImageChromeClient()) {
+        // If this is the SVGDocument of an SVGImage, no need to dispatch events or recalcStyle.
+        unloadEventPolicy = UnloadEventPolicyNone;
+    } else {
+        // Should only send the pagehide event here if the current document exists and has not been placed in the page cache.
+        unloadEventPolicy = currentDocument && !currentDocument->inPageCache() ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly;
+    }
+
+    stopLoading(unloadEventPolicy);
     
     m_frame.editor().clearUndoRedoOperations();
     return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to