2011-04-07 Adam Barth <abarth@webkit.org>
[WebKit-https.git] / Source / WebCore / loader / cache / CachedResourceLoader.cpp
index a718097..f780c6c 100644 (file)
@@ -255,8 +255,32 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
     }
     // FIXME: Consider letting the embedder block mixed content loads.
 
-    if (type == CachedResource::Script && !m_document->contentSecurityPolicy()->allowScriptFromSource(url))
-        return false;
+    switch (type) {
+    case CachedResource::Script:
+        if (!m_document->contentSecurityPolicy()->allowScriptFromSource(url))
+            return false;
+        break;
+#if ENABLE(XSLT)
+    case CachedResource::XSLStyleSheet:
+#endif
+    case CachedResource::CSSStyleSheet:
+        if (!m_document->contentSecurityPolicy()->allowStyleFromSource(url))
+            return false;
+        break;
+    case CachedResource::ImageResource:
+        if (!m_document->contentSecurityPolicy()->allowImageFromSource(url))
+            return false;
+        break;
+    case CachedResource::FontResource: {
+        if (!m_document->contentSecurityPolicy()->allowFontFromSource(url))
+            return false;
+        break;
+    }
+#if ENABLE(LINK_PREFETCH)
+    case CachedResource::LinkPrefetch:
+        break;
+#endif
+    }
 
     return true;
 }