Title: [207331] trunk/Source/WebCore
Revision
207331
Author
commit-qu...@webkit.org
Date
2016-10-14 02:04:24 -0700 (Fri, 14 Oct 2016)

Log Message

MediaResourceLoader should use CachedResource::ressourceError to do CORS checks
https://bugs.webkit.org/show_bug.cgi?id=163279

Patch by Youenn Fablet <you...@apple.com> on 2016-10-14
Reviewed by Darin Adler.

Covered by existing tests.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResource::responseReceived): Making use of CachedResource::ressourceError to detect CORS failures.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Activating loader options checks
before reusing the resource.
(WebCore::isResourceSuitableForDirectReuse): Disabling direct reuse of MediaResource since reuse of raw
resources does not work yet for media resources.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207330 => 207331)


--- trunk/Source/WebCore/ChangeLog	2016-10-14 08:47:16 UTC (rev 207330)
+++ trunk/Source/WebCore/ChangeLog	2016-10-14 09:04:24 UTC (rev 207331)
@@ -1,5 +1,22 @@
 2016-10-14  Youenn Fablet  <you...@apple.com>
 
+        MediaResourceLoader should use CachedResource::ressourceError to do CORS checks
+        https://bugs.webkit.org/show_bug.cgi?id=163279
+
+        Reviewed by Darin Adler.
+
+        Covered by existing tests.
+
+        * loader/MediaResourceLoader.cpp:
+        (WebCore::MediaResource::responseReceived): Making use of CachedResource::ressourceError to detect CORS failures.
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Activating loader options checks
+        before reusing the resource.
+        (WebCore::isResourceSuitableForDirectReuse): Disabling direct reuse of MediaResource since reuse of raw
+        resources does not work yet for media resources.
+
+2016-10-14  Youenn Fablet  <you...@apple.com>
+
         Make NetworkCache aware of fetch cache mode
         https://bugs.webkit.org/show_bug.cgi?id=163332
 

Modified: trunk/Source/WebCore/loader/MediaResourceLoader.cpp (207330 => 207331)


--- trunk/Source/WebCore/loader/MediaResourceLoader.cpp	2016-10-14 08:47:16 UTC (rev 207330)
+++ trunk/Source/WebCore/loader/MediaResourceLoader.cpp	2016-10-14 09:04:24 UTC (rev 207331)
@@ -134,7 +134,7 @@
         return;
 
     RefPtr<MediaResource> protectedThis(this);
-    if (!m_loader->crossOriginMode().isNull() && !m_resource->passesSameOriginPolicyCheck(*m_loader->document()->securityOrigin())) {
+    if (m_resource->resourceError().isAccessControl()) {
         static NeverDestroyed<const String> consoleMessage("Cross-origin media resource load denied by Cross-Origin Resource Sharing policy.");
         m_loader->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, consoleMessage.get());
         m_didPassAccessControlCheck = false;
@@ -144,7 +144,7 @@
         return;
     }
 
-    m_didPassAccessControlCheck = !m_loader->crossOriginMode().isNull();
+    m_didPassAccessControlCheck = m_resource->options().mode == FetchOptions::Mode::Cors;
     if (m_client)
         m_client->responseReceived(*this, response);
 }

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (207330 => 207331)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2016-10-14 08:47:16 UTC (rev 207330)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2016-10-14 09:04:24 UTC (rev 207331)
@@ -561,8 +561,6 @@
     switch (resource.type()) {
     case CachedResource::SVGDocumentResource:
         return false;
-    case CachedResource::MediaResource:
-        return false;
     case CachedResource::MainResource:
         return false;
 #if ENABLE(LINK_PREFETCH)
@@ -602,7 +600,7 @@
         return false;
 
     // FIXME: Implement reuse of cached raw resources.
-    if (resource.type() == CachedResource::Type::RawResource)
+    if (resource.type() == CachedResource::Type::RawResource || resource.type() == CachedResource::Type::MediaResource)
         return false;
 
     return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to