[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jschuh at chromium.org
jschuh at chromium.org
Wed Dec 22 13:05:00 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 32370f5c64d1169b7f90300f3a62be72ca80202a
Author: jschuh at chromium.org <jschuh at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 6 21:00:51 2010 +0000
2010-09-06 Justin Schuh <jschuh at chromium.org>
Reviewed by Nikolas Zimmermann.
Make SVG PendingResources use RefPtr
https://bugs.webkit.org/show_bug.cgi?id=43587
Convert SVGDocumentExtensions::m_pendingResources to use a RefPtr for
pending elements instead of a raw pointer so that pending elements can't
be freed prematurely.
Test: svg/custom/use-invalid-pattern.svg
* rendering/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::registerResource):
* svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::addPendingResource):
(WebCore::SVGDocumentExtensions::removePendingResource):
* svg/SVGDocumentExtensions.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::insertedIntoDocument):
2010-09-06 Justin Schuh <jschuh at chromium.org>
Reviewed by Nikolas Zimmermann.
Test that an invalid pending resource pattern doesn't crash
https://bugs.webkit.org/show_bug.cgi?id=43587
* platform/mac-snowleopard/svg: Added.
* platform/mac-snowleopard/svg/custom: Added.
* platform/mac-snowleopard/svg/custom/use-invalid-pattern-expected.txt: Added.
* svg/custom/use-invalid-pattern.svg: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6f5f91a..adbcc72 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-06 Justin Schuh <jschuh at chromium.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Test that an invalid pending resource pattern doesn't crash
+ https://bugs.webkit.org/show_bug.cgi?id=43587
+
+ * platform/mac-snowleopard/svg: Added.
+ * platform/mac-snowleopard/svg/custom: Added.
+ * platform/mac-snowleopard/svg/custom/use-invalid-pattern-expected.txt: Added.
+ * svg/custom/use-invalid-pattern.svg: Added.
+
2010-09-06 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
diff --git a/LayoutTests/platform/mac-snowleopard/svg/custom/use-invalid-pattern-expected.txt b/LayoutTests/platform/mac-snowleopard/svg/custom/use-invalid-pattern-expected.txt
new file mode 100644
index 0000000..3718571
--- /dev/null
+++ b/LayoutTests/platform/mac-snowleopard/svg/custom/use-invalid-pattern-expected.txt
@@ -0,0 +1,7 @@
+This page contains the following errors:
+
+error on line 11 at column 7: Opening and ending tag mismatch: use line 0 and svg
+Below is a rendering of the page up to the first error.
+
+This should not crash, but display an error document.
+
diff --git a/LayoutTests/svg/custom/use-invalid-pattern.svg b/LayoutTests/svg/custom/use-invalid-pattern.svg
new file mode 100644
index 0000000..c2e9575
--- /dev/null
+++ b/LayoutTests/svg/custom/use-invalid-pattern.svg
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ </script>
+ <text y="20">This should not crash, but display an error document.</text>
+ <g id="crash">
+ <pattern xlink:href="#crash"></pattern>
+ </g>
+ <use xlink:href="#crash">
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8f13822..1f34067 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-06 Justin Schuh <jschuh at chromium.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Make SVG PendingResources use RefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=43587
+
+ Convert SVGDocumentExtensions::m_pendingResources to use a RefPtr for
+ pending elements instead of a raw pointer so that pending elements can't
+ be freed prematurely.
+
+ Test: svg/custom/use-invalid-pattern.svg
+
+ * rendering/RenderSVGResourceContainer.cpp:
+ (WebCore::RenderSVGResourceContainer::registerResource):
+ * svg/SVGDocumentExtensions.cpp:
+ (WebCore::SVGDocumentExtensions::addPendingResource):
+ (WebCore::SVGDocumentExtensions::removePendingResource):
+ * svg/SVGDocumentExtensions.h:
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::insertedIntoDocument):
+
2010-09-06 Martin Robinson <mrobinson at igalia.com>
Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/rendering/RenderSVGResourceContainer.cpp b/WebCore/rendering/RenderSVGResourceContainer.cpp
index f33eb85..41ab91f 100644
--- a/WebCore/rendering/RenderSVGResourceContainer.cpp
+++ b/WebCore/rendering/RenderSVGResourceContainer.cpp
@@ -160,14 +160,14 @@ void RenderSVGResourceContainer::registerResource()
return;
}
- OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id));
+ OwnPtr<SVGDocumentExtensions::SVGPendingElements> clients(extensions->removePendingResource(m_id));
// Cache us with the new id.
extensions->addResource(m_id, this);
// Update cached resources of pending clients.
- const HashSet<SVGStyledElement*>::const_iterator end = clients->end();
- for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it) {
+ const SVGDocumentExtensions::SVGPendingElements::const_iterator end = clients->end();
+ for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it) {
RenderObject* renderer = (*it)->renderer();
if (!renderer)
continue;
diff --git a/WebCore/svg/SVGDocumentExtensions.cpp b/WebCore/svg/SVGDocumentExtensions.cpp
index 011859a..3fd9761 100644
--- a/WebCore/svg/SVGDocumentExtensions.cpp
+++ b/WebCore/svg/SVGDocumentExtensions.cpp
@@ -156,7 +156,7 @@ void SVGDocumentExtensions::reportError(const String& message)
reportMessage(m_document, ErrorMessageLevel, "Error: " + message);
}
-void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyledElement* obj)
+void SVGDocumentExtensions::addPendingResource(const AtomicString& id, PassRefPtr<SVGStyledElement> obj)
{
ASSERT(obj);
@@ -166,7 +166,7 @@ void SVGDocumentExtensions::addPendingResource(const AtomicString& id, SVGStyled
if (m_pendingResources.contains(id))
m_pendingResources.get(id)->add(obj);
else {
- HashSet<SVGStyledElement*>* set = new HashSet<SVGStyledElement*>;
+ SVGPendingElements* set = new SVGPendingElements;
set->add(obj);
m_pendingResources.add(id, set);
@@ -181,11 +181,11 @@ bool SVGDocumentExtensions::isPendingResource(const AtomicString& id) const
return m_pendingResources.contains(id);
}
-PassOwnPtr<HashSet<SVGStyledElement*> > SVGDocumentExtensions::removePendingResource(const AtomicString& id)
+PassOwnPtr<HashSet<RefPtr<SVGStyledElement> > > SVGDocumentExtensions::removePendingResource(const AtomicString& id)
{
ASSERT(m_pendingResources.contains(id));
- OwnPtr<HashSet<SVGStyledElement*> > set(m_pendingResources.get(id));
+ OwnPtr<SVGPendingElements> set(m_pendingResources.get(id));
m_pendingResources.remove(id);
return set.release();
}
diff --git a/WebCore/svg/SVGDocumentExtensions.h b/WebCore/svg/SVGDocumentExtensions.h
index e716e10..a0cf2bb 100644
--- a/WebCore/svg/SVGDocumentExtensions.h
+++ b/WebCore/svg/SVGDocumentExtensions.h
@@ -40,6 +40,7 @@ class SVGSVGElement;
class SVGDocumentExtensions : public Noncopyable {
public:
+ typedef HashSet<RefPtr<SVGStyledElement> > SVGPendingElements;
SVGDocumentExtensions(Document*);
~SVGDocumentExtensions();
@@ -64,7 +65,7 @@ private:
Document* m_document; // weak reference
HashSet<SVGSVGElement*> m_timeContainers; // For SVG 1.2 support this will need to be made more general.
HashMap<AtomicString, RenderSVGResourceContainer*> m_resources;
- HashMap<AtomicString, HashSet<SVGStyledElement*>*> m_pendingResources;
+ HashMap<AtomicString, SVGPendingElements*> m_pendingResources;
OwnPtr<SVGResourcesCache> m_resourcesCache;
SVGDocumentExtensions(const SVGDocumentExtensions&);
@@ -74,9 +75,9 @@ public:
// This HashMap contains a list of pending resources. Pending resources, are such
// which are referenced by any object in the SVG document, but do NOT exist yet.
// For instance, dynamically build gradients / patterns / clippers...
- void addPendingResource(const AtomicString& id, SVGStyledElement*);
+ void addPendingResource(const AtomicString& id, PassRefPtr<SVGStyledElement>);
bool isPendingResource(const AtomicString& id) const;
- PassOwnPtr<HashSet<SVGStyledElement*> > removePendingResource(const AtomicString& id);
+ PassOwnPtr<SVGPendingElements> removePendingResource(const AtomicString& id);
};
}
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index ee16e8f..1b19f25 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -287,12 +287,12 @@ void SVGElement::insertedIntoDocument()
if (!extensions->isPendingResource(resourceId))
return;
- OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId));
+ OwnPtr<SVGDocumentExtensions::SVGPendingElements> clients(extensions->removePendingResource(resourceId));
if (clients->isEmpty())
return;
- const HashSet<SVGStyledElement*>::const_iterator end = clients->end();
- for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it)
+ const SVGDocumentExtensions::SVGPendingElements::const_iterator end = clients->end();
+ for (SVGDocumentExtensions::SVGPendingElements::const_iterator it = clients->begin(); it != end; ++it)
(*it)->buildPendingResource();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list