Title: [97199] trunk/Source/WebCore
Revision
97199
Author
[email protected]
Date
2011-10-11 17:12:29 -0700 (Tue, 11 Oct 2011)

Log Message

Make CachedResourceClientWalker templates, and
have it check and filter out bad casts when iterating
(currently we rely on CachedResourceClients being careful
to inherit from the right subclass for the type of resource
they want to load).
https://bugs.webkit.org/show_bug.cgi?id=69877

Reviewed by Adam Barth.

No new tests, no functionality change.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* loader/cache/CachedCSSStyleSheet.cpp:
* loader/cache/CachedFont.cpp:
* loader/cache/CachedFont.h:
* loader/cache/CachedImage.cpp:
* loader/cache/CachedImage.h:
* loader/cache/CachedResource.cpp:
* loader/cache/CachedResourceClient.h:
* loader/cache/CachedResourceClientWalker.cpp: Removed.
* loader/cache/CachedResourceClientWalker.h:
* loader/cache/CachedStyleSheetClient.h:
* loader/cache/CachedXSLStyleSheet.cpp:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (97198 => 97199)


--- trunk/Source/WebCore/CMakeLists.txt	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-10-12 00:12:29 UTC (rev 97199)
@@ -950,7 +950,6 @@
     loader/cache/CachedImage.cpp
     loader/cache/CachedRawResource.cpp
     loader/cache/CachedResource.cpp
-    loader/cache/CachedResourceClientWalker.cpp
     loader/cache/CachedResourceHandle.cpp
     loader/cache/CachedResourceLoader.cpp
     loader/cache/CachedResourceRequest.cpp

Modified: trunk/Source/WebCore/ChangeLog (97198 => 97199)


--- trunk/Source/WebCore/ChangeLog	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/ChangeLog	2011-10-12 00:12:29 UTC (rev 97199)
@@ -1,3 +1,34 @@
+2011-10-11  Nate Chapin  <[email protected]>
+
+        Make CachedResourceClientWalker templates, and
+        have it check and filter out bad casts when iterating
+        (currently we rely on CachedResourceClients being careful
+        to inherit from the right subclass for the type of resource
+        they want to load).
+        https://bugs.webkit.org/show_bug.cgi?id=69877
+
+        Reviewed by Adam Barth.
+
+        No new tests, no functionality change.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/cache/CachedCSSStyleSheet.cpp:
+        * loader/cache/CachedFont.cpp:
+        * loader/cache/CachedFont.h:
+        * loader/cache/CachedImage.cpp:
+        * loader/cache/CachedImage.h:
+        * loader/cache/CachedResource.cpp:
+        * loader/cache/CachedResourceClient.h:
+        * loader/cache/CachedResourceClientWalker.cpp: Removed.
+        * loader/cache/CachedResourceClientWalker.h:
+        * loader/cache/CachedStyleSheetClient.h:
+        * loader/cache/CachedXSLStyleSheet.cpp:
+
 2011-10-11  W. James MacLean  <[email protected]>
 
         [chromium] Fix compilation guards in ScrollAnimatorNone (GESTURE_EVENTS).

Modified: trunk/Source/WebCore/GNUmakefile.list.am (97198 => 97199)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-10-12 00:12:29 UTC (rev 97199)
@@ -2109,7 +2109,6 @@
 	Source/WebCore/loader/cache/CachedImage.cpp \
 	Source/WebCore/loader/cache/CachedImage.h \
 	Source/WebCore/loader/cache/CachedResourceClient.h \
-	Source/WebCore/loader/cache/CachedResourceClientWalker.cpp \
 	Source/WebCore/loader/cache/CachedResourceClientWalker.h \
 	Source/WebCore/loader/cache/CachedRawResource.cpp \
 	Source/WebCore/loader/cache/CachedRawResource.h \

Modified: trunk/Source/WebCore/WebCore.gypi (97198 => 97199)


--- trunk/Source/WebCore/WebCore.gypi	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/WebCore.gypi	2011-10-12 00:12:29 UTC (rev 97199)
@@ -2841,7 +2841,6 @@
             'loader/cache/CachedImage.cpp',
             'loader/cache/CachedRawResource.cpp',
             'loader/cache/CachedResource.cpp',
-            'loader/cache/CachedResourceClientWalker.cpp',
             'loader/cache/CachedResourceClientWalker.h',
             'loader/cache/CachedResourceHandle.cpp',
             'loader/cache/CachedResourceLoader.cpp',

Modified: trunk/Source/WebCore/WebCore.pro (97198 => 97199)


--- trunk/Source/WebCore/WebCore.pro	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/WebCore.pro	2011-10-12 00:12:29 UTC (rev 97199)
@@ -876,7 +876,6 @@
     loader/cache/CachedFont.cpp \
     loader/cache/CachedImage.cpp \
     loader/cache/CachedRawResource.cpp \
-    loader/cache/CachedResourceClientWalker.cpp \
     loader/cache/CachedResourceHandle.cpp \
     loader/cache/CachedResourceRequest.cpp \
     loader/cache/CachedResource.cpp \

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (97198 => 97199)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-10-12 00:12:29 UTC (rev 97199)
@@ -26793,10 +26793,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\loader\cache\CachedResourceClientWalker.cpp"
-					>
-				</File>
-				<File
 					RelativePath="..\loader\cache\CachedResourceClientWalker.h"
 					>
 				</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (97198 => 97199)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-10-12 00:12:29 UTC (rev 97199)
@@ -5202,7 +5202,6 @@
 		BCB16C1C0979C3BD00467741 /* CachedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C030979C3BD00467741 /* CachedImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C060979C3BD00467741 /* CachedResource.cpp */; };
 		BCB16C200979C3BD00467741 /* CachedResource.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C070979C3BD00467741 /* CachedResource.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		BCB16C210979C3BD00467741 /* CachedResourceClientWalker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C080979C3BD00467741 /* CachedResourceClientWalker.cpp */; };
 		BCB16C220979C3BD00467741 /* CachedResourceClientWalker.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C090979C3BD00467741 /* CachedResourceClientWalker.h */; };
 		BCB16C230979C3BD00467741 /* CachedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C0A0979C3BD00467741 /* CachedScript.cpp */; };
 		BCB16C240979C3BD00467741 /* CachedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C0B0979C3BD00467741 /* CachedScript.h */; };
@@ -12473,7 +12472,6 @@
 		BCB16C030979C3BD00467741 /* CachedImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedImage.h; sourceTree = "<group>"; };
 		BCB16C060979C3BD00467741 /* CachedResource.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResource.cpp; sourceTree = "<group>"; };
 		BCB16C070979C3BD00467741 /* CachedResource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedResource.h; sourceTree = "<group>"; };
-		BCB16C080979C3BD00467741 /* CachedResourceClientWalker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResourceClientWalker.cpp; sourceTree = "<group>"; };
 		BCB16C090979C3BD00467741 /* CachedResourceClientWalker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedResourceClientWalker.h; sourceTree = "<group>"; };
 		BCB16C0A0979C3BD00467741 /* CachedScript.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CachedScript.cpp; sourceTree = "<group>"; };
 		BCB16C0B0979C3BD00467741 /* CachedScript.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CachedScript.h; sourceTree = "<group>"; };
@@ -18439,7 +18437,6 @@
 				BCB16C060979C3BD00467741 /* CachedResource.cpp */,
 				BCB16C070979C3BD00467741 /* CachedResource.h */,
 				BCFB2E5D0979E46400BA703D /* CachedResourceClient.h */,
-				BCB16C080979C3BD00467741 /* CachedResourceClientWalker.cpp */,
 				BCB16C090979C3BD00467741 /* CachedResourceClientWalker.h */,
 				E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */,
 				E47B4BE60E71241600038854 /* CachedResourceHandle.h */,
@@ -25078,7 +25075,6 @@
 				5101846A0B08602A004A825F /* CachedPage.cpp in Sources */,
 				D0EDA774143E303C0028E383 /* CachedRawResource.cpp in Sources */,
 				BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */,
-				BCB16C210979C3BD00467741 /* CachedResourceClientWalker.cpp in Sources */,
 				E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */,
 				BCB16C290979C3BD00467741 /* CachedResourceLoader.cpp in Sources */,
 				D0D141B212B2BF5200E39620 /* CachedResourceRequest.cpp in Sources */,

Modified: trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp	2011-10-12 00:12:29 UTC (rev 97199)
@@ -50,9 +50,9 @@
 {
 }
 
-void CachedCSSStyleSheet::didAddClient(CachedResourceClient *c)
+void CachedCSSStyleSheet::didAddClient(CachedResourceClient* c)
 {
-    if (!isLoading())
+    if (!isLoading() && c->type() == CachedStyleSheetClient::expectedType())
         static_cast<CachedStyleSheetClient*>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this);
 }
 
@@ -111,9 +111,9 @@
     if (isLoading())
         return;
 
-    CachedResourceClientWalker w(m_clients);
-    while (CachedResourceClient *c = w.next())
-        static_cast<CachedStyleSheetClient*>(c)->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this);
+    CachedResourceClientWalker<CachedStyleSheetClient> w(m_clients);
+    while (CachedStyleSheetClient* c = w.next())
+        c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder->encoding().name(), this);
 }
 
 void CachedCSSStyleSheet::error(CachedResource::Status status)

Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedFont.cpp	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp	2011-10-12 00:12:29 UTC (rev 97199)
@@ -79,7 +79,7 @@
 
 void CachedFont::didAddClient(CachedResourceClient* c)
 {
-    if (!isLoading())
+    if (!isLoading() && c->type() == CachedFontClient::expectedType())
         static_cast<CachedFontClient*>(c)->fontLoaded(this);
 }
 
@@ -192,9 +192,9 @@
     if (isLoading())
         return;
     
-    CachedResourceClientWalker w(m_clients);
-    while (CachedResourceClient *c = w.next())
-         static_cast<CachedFontClient*>(c)->fontLoaded(this);
+    CachedResourceClientWalker<CachedFontClient> w(m_clients);
+    while (CachedFontClient* c = w.next())
+         c->fontLoaded(this);
 }
 
 

Modified: trunk/Source/WebCore/loader/cache/CachedFont.h (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedFont.h	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedFont.h	2011-10-12 00:12:29 UTC (rev 97199)
@@ -83,6 +83,8 @@
 class CachedFontClient : public CachedResourceClient {
 public:
     virtual ~CachedFontClient() { }
+    static CachedResourceClientType expectedType() { return FontType; }
+    virtual CachedResourceClientType type() { return expectedType(); }
     virtual void fontLoaded(CachedFont*) { }
 };
 

Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedImage.cpp	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp	2011-10-12 00:12:29 UTC (rev 97199)
@@ -99,7 +99,7 @@
         m_image->setData(m_data, true);
     }
 
-    if (m_image && !m_image->isNull())
+    if (m_image && !m_image->isNull() && c->type() == CachedImageClient::expectedType())
         static_cast<CachedImageClient*>(c)->imageChanged(this);
 
     CachedResource::didAddClient(c);
@@ -228,9 +228,9 @@
 
 void CachedImage::notifyObservers(const IntRect* changeRect)
 {
-    CachedResourceClientWalker w(m_clients);
-    while (CachedResourceClient* c = w.next())
-        static_cast<CachedImageClient*>(c)->imageChanged(this, changeRect);
+    CachedResourceClientWalker<CachedImageClient> w(m_clients);
+    while (CachedImageClient* c = w.next())
+        c->imageChanged(this, changeRect);
 }
 
 void CachedImage::checkShouldPaintBrokenImage()
@@ -371,9 +371,9 @@
     if (image != m_image)
         return false;
     
-    CachedResourceClientWalker w(m_clients);
-    while (CachedResourceClient* c = w.next()) {
-        if (static_cast<CachedImageClient*>(c)->willRenderImage(this))
+    CachedResourceClientWalker<CachedImageClient> w(m_clients);
+    while (CachedImageClient* c = w.next()) {
+        if (c->willRenderImage(this))
             return false;
     }
 

Modified: trunk/Source/WebCore/loader/cache/CachedImage.h (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedImage.h	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedImage.h	2011-10-12 00:12:29 UTC (rev 97199)
@@ -107,6 +107,8 @@
 class CachedImageClient : public CachedResourceClient {
 public:
     virtual ~CachedImageClient() { }
+    static CachedResourceClientType expectedType() { return ImageType; }
+    virtual CachedResourceClientType type() { return expectedType(); }
 
     // Called whenever a frame of an image changes, either because we got more data from the network or
     // because we are animating. If not null, the IntRect is the changed rect of the image.

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2011-10-12 00:12:29 UTC (rev 97199)
@@ -145,7 +145,7 @@
     if (isLoading())
         return;
 
-    CachedResourceClientWalker w(m_clients);
+    CachedResourceClientWalker<CachedResourceClient> w(m_clients);
     while (CachedResourceClient* c = w.next())
         c->notifyFinished(this);
 }

Modified: trunk/Source/WebCore/loader/cache/CachedResourceClient.h (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedResourceClient.h	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClient.h	2011-10-12 00:12:29 UTC (rev 97199)
@@ -34,8 +34,19 @@
 class CachedResourceClient {
     WTF_MAKE_FAST_ALLOCATED;
 public:
+    enum CachedResourceClientType {
+        BaseResourceType,
+        ImageType,
+        FontType,
+        StyleSheetType
+    };
+
     virtual ~CachedResourceClient() { }
     virtual void notifyFinished(CachedResource*) { }
+    
+    static CachedResourceClientType expectedType() { return BaseResourceType; }
+    virtual CachedResourceClientType type() { return expectedType(); }
+
 protected:
     CachedResourceClient() { }
 };

Deleted: trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.cpp (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.cpp	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.cpp	2011-10-12 00:12:29 UTC (rev 97199)
@@ -1,53 +0,0 @@
-/*
-    Copyright (C) 1998 Lars Knoll ([email protected])
-    Copyright (C) 2001 Dirk Mueller ([email protected])
-    Copyright (C) 2002 Waldo Bastian ([email protected])
-    Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-
-    This class provides all functionality needed for loading images, style sheets and html
-    pages from the web. It has a memory cache for these objects.
-*/
-
-#include "config.h"
-#include "CachedResourceClientWalker.h"
-
-namespace WebCore {
-
-CachedResourceClientWalker::CachedResourceClientWalker(const HashCountedSet<CachedResourceClient*>& set)
-    : m_clientSet(set), m_clientVector(set.size()), m_index(0)
-{
-    typedef HashCountedSet<CachedResourceClient*>::const_iterator Iterator;
-    Iterator end = set.end();
-    size_t clientIndex = 0;
-    for (Iterator current = set.begin(); current != end; ++current)
-        m_clientVector[clientIndex++] = current->first;
-}
-
-CachedResourceClient* CachedResourceClientWalker::next()
-{
-    size_t size = m_clientVector.size();
-    while (m_index < size) {
-        CachedResourceClient* next = m_clientVector[m_index++];
-        if (m_clientSet.contains(next))
-            return next;
-    }
-
-    return 0;
-}
-
-}

Modified: trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.h (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.h	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedResourceClientWalker.h	2011-10-12 00:12:29 UTC (rev 97199)
@@ -25,24 +25,42 @@
 #ifndef CachedResourceClientWalker_h
 #define CachedResourceClientWalker_h
 
+#include "CachedResourceClient.h"
 #include <wtf/HashCountedSet.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-    class CachedResourceClient;
+// Call this "walker" instead of iterator so people won't expect Qt or STL-style iterator interface.
+// Just keep calling next() on this. It's safe from deletions of items.
+template<typename T> class CachedResourceClientWalker {
+public:
+    CachedResourceClientWalker(const HashCountedSet<CachedResourceClient*>& set)
+        : m_clientSet(set), m_clientVector(set.size()), m_index(0)
+    {
+        typedef HashCountedSet<CachedResourceClient*>::const_iterator Iterator;
+        Iterator end = set.end();
+        size_t clientIndex = 0;
+        for (Iterator current = set.begin(); current != end; ++current)
+            m_clientVector[clientIndex++] = current->first;
+    }
 
-    // Call this "walker" instead of iterator so people won't expect Qt or STL-style iterator interface.
-    // Just keep calling next() on this. It's safe from deletions of items.
-    class CachedResourceClientWalker {
-    public:
-        CachedResourceClientWalker(const HashCountedSet<CachedResourceClient*>&);
-        CachedResourceClient* next();
-    private:
-        const HashCountedSet<CachedResourceClient*>& m_clientSet;
-        Vector<CachedResourceClient*> m_clientVector;
-        size_t m_index;
-    };
+    T* next()
+    {
+        size_t size = m_clientVector.size();
+        while (m_index < size) {
+            CachedResourceClient* next = m_clientVector[m_index++];
+            if (m_clientSet.contains(next) && (T::expectedType() == CachedResourceClient::expectedType() || next->type() == T::expectedType()))
+                return static_cast<T*>(next);
+        }
+        
+        return 0;
+    }
+private:
+    const HashCountedSet<CachedResourceClient*>& m_clientSet;
+    Vector<CachedResourceClient*> m_clientVector;
+    size_t m_index;
+};
 
 }
 

Modified: trunk/Source/WebCore/loader/cache/CachedStyleSheetClient.h (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedStyleSheetClient.h	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedStyleSheetClient.h	2011-10-12 00:12:29 UTC (rev 97199)
@@ -37,6 +37,8 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     virtual ~CachedStyleSheetClient() { }
+    static CachedResourceClientType expectedType() { return StyleSheetType; }
+    virtual CachedResourceClientType type() { return expectedType(); }
     virtual void setCSSStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* charset */, const CachedCSSStyleSheet*) { }
     virtual void setXSLStyleSheet(const String& /* href */, const KURL& /* baseURL */, const String& /* sheet */) { }
 };

Modified: trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp (97198 => 97199)


--- trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp	2011-10-11 23:50:33 UTC (rev 97198)
+++ trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp	2011-10-12 00:12:29 UTC (rev 97199)
@@ -48,7 +48,7 @@
 
 void CachedXSLStyleSheet::didAddClient(CachedResourceClient* c)
 {  
-    if (!isLoading())
+    if (!isLoading() && c->type() == CachedStyleSheetClient::expectedType())
         static_cast<CachedStyleSheetClient*>(c)->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);
 }
 
@@ -82,9 +82,9 @@
     if (isLoading())
         return;
     
-    CachedResourceClientWalker w(m_clients);
-    while (CachedResourceClient *c = w.next())
-        static_cast<CachedStyleSheetClient*>(c)->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);
+    CachedResourceClientWalker<CachedStyleSheetClient> w(m_clients);
+    while (CachedStyleSheetClient* c = w.next())
+        c->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);
 }
 
 void CachedXSLStyleSheet::error(CachedResource::Status status)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to