Title: [130586] trunk/Source/WebCore
Revision
130586
Author
[email protected]
Date
2012-10-06 11:44:15 -0700 (Sat, 06 Oct 2012)

Log Message

Fix weird use of KURL's protocolIs
https://bugs.webkit.org/show_bug.cgi?id=98584

Reviewed by Adam Barth.

Converting a KURL to string is a bad idea.

Invalid URLs can return a string that pass the tests, while an
invalid URL will fail protocolIs().

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::removeClient):
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::load):
* platform/network/DataURL.cpp:
(WebCore::handleDataURL):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130585 => 130586)


--- trunk/Source/WebCore/ChangeLog	2012-10-06 18:37:38 UTC (rev 130585)
+++ trunk/Source/WebCore/ChangeLog	2012-10-06 18:44:15 UTC (rev 130586)
@@ -1,3 +1,22 @@
+2012-10-06  Benjamin Poulain  <[email protected]>
+
+        Fix weird use of KURL's protocolIs
+        https://bugs.webkit.org/show_bug.cgi?id=98584
+
+        Reviewed by Adam Barth.
+
+        Converting a KURL to string is a bad idea.
+
+        Invalid URLs can return a string that pass the tests, while an
+        invalid URL will fail protocolIs().
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::removeClient):
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::load):
+        * platform/network/DataURL.cpp:
+        (WebCore::handleDataURL):
+
 2012-10-06  Dan Bernstein  <[email protected]>
 
         WebCore part of <rdar://problem/12446507> [mac] WebKit clients cannot change the behavior of text-rendering: auto

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (130585 => 130586)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-10-06 18:37:38 UTC (rev 130585)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-10-06 18:44:15 UTC (rev 130586)
@@ -448,7 +448,7 @@
             // "no-store: ... MUST make a best-effort attempt to remove the information from volatile storage as promptly as possible"
             // "... History buffers MAY store such responses as part of their normal operation."
             // We allow non-secure content to be reused in history, but we do not allow secure content to be reused.
-            if (protocolIs(url(), "https"))
+            if (url().protocolIs("https"))
                 memoryCache()->remove(this);
         } else
             memoryCache()->prune();

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (130585 => 130586)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2012-10-06 18:37:38 UTC (rev 130585)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2012-10-06 18:44:15 UTC (rev 130586)
@@ -360,7 +360,7 @@
 
     // If the MIME type is missing or is not meaningful, try to figure it out from the URL.
     if (m_contentMIMEType.isEmpty() || m_contentMIMEType == applicationOctetStream() || m_contentMIMEType == textPlain()) {
-        if (protocolIs(m_url.string(), "data"))
+        if (m_url.protocolIsData())
             m_contentMIMEType = mimeTypeFromDataURL(m_url.string());
         else {
             String lastPathComponent = url.lastPathComponent();

Modified: trunk/Source/WebCore/platform/network/DataURL.cpp (130585 => 130586)


--- trunk/Source/WebCore/platform/network/DataURL.cpp	2012-10-06 18:37:38 UTC (rev 130585)
+++ trunk/Source/WebCore/platform/network/DataURL.cpp	2012-10-06 18:44:15 UTC (rev 130586)
@@ -40,7 +40,7 @@
 
 void handleDataURL(ResourceHandle* handle)
 {
-    ASSERT(handle->firstRequest().url().protocolIs("data"));
+    ASSERT(handle->firstRequest().url().protocolIsData());
     String url = ""
 
     int index = url.find(',');
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to