Title: [239069] trunk
Revision
239069
Author
[email protected]
Date
2018-12-10 21:37:24 -0800 (Mon, 10 Dec 2018)

Log Message

<rdar://problem/45296285> Content blocker rule "raw" blocks media elements from loading
https://bugs.webkit.org/show_bug.cgi?id=192439

Reviewed by Dean Jackson.

Source/WebCore:

This broken when WebKit switched to NSURLSession.
In CachedResourceLoader::requestResource(), toResourceType() was turning media load into RAW.

Test: http/tests/contentextensions/video-element-resource-type.html

* loader/ResourceLoadInfo.cpp:
(WebCore::toResourceType):

LayoutTests:

* http/tests/contentextensions/video-element-resource-type-expected.txt: Added.
* http/tests/contentextensions/video-element-resource-type.html: Added.
* http/tests/contentextensions/video-element-resource-type.html.json: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239068 => 239069)


--- trunk/LayoutTests/ChangeLog	2018-12-11 04:04:45 UTC (rev 239068)
+++ trunk/LayoutTests/ChangeLog	2018-12-11 05:37:24 UTC (rev 239069)
@@ -1,3 +1,14 @@
+2018-12-10  Benjamin Poulain  <[email protected]>
+
+        <rdar://problem/45296285> Content blocker rule "raw" blocks media elements from loading
+        https://bugs.webkit.org/show_bug.cgi?id=192439
+
+        Reviewed by Dean Jackson.
+
+        * http/tests/contentextensions/video-element-resource-type-expected.txt: Added.
+        * http/tests/contentextensions/video-element-resource-type.html: Added.
+        * http/tests/contentextensions/video-element-resource-type.html.json: Added.
+
 2018-12-10  Justin Michaud  <[email protected]>
 
         CS Painting API should support multiple worklets.

Added: trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type-expected.txt (0 => 239069)


--- trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type-expected.txt	2018-12-11 05:37:24 UTC (rev 239069)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: line 18: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test.mp4
+CONSOLE MESSAGE: line 19: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test-25fps.mp4
+CONSOLE MESSAGE: line 22: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test.mp4
+CONSOLE MESSAGE: line 23: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test-25fps.mp4
+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test.mp4
+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test-25fps.mp4
+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test.mp4
+CONSOLE MESSAGE: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/video-element-resource-type.html from loading a resource from http://localhost:8000/media/resources/test.mp4
+        

Added: trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type.html (0 => 239069)


--- trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type.html	2018-12-11 05:37:24 UTC (rev 239069)
@@ -0,0 +1,43 @@
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var mediaLoadedCount = 0;
+function mediaLoaded()
+{
+    ++mediaLoadedCount;
+    if (mediaLoadedCount == 2 && window.testRunner)
+        testRunner.notifyDone();
+}
+
+</script>
+
+<!-- Filtered -->
+<img src=""
+<img src=""
+
+<!-- Filtered -->
+<link href="" rel="stylesheet" type="text/css">
+<link href="" rel="stylesheet" type="text/css">
+
+<!-- Filtered -->
+<script src=""
+<script src=""
+
+<!-- Filtered -->
+<video src=""
+
+<!-- Filtered -->
+<video>
+    <source src="" type="video/mp4">
+</video>
+
+<!-- Ok -->
+<video src="" _oncanplay_="mediaLoaded();"></video>
+
+<!-- Ok -->
+<video _oncanplay_="mediaLoaded();">
+    <source src="" type="video/mp4">
+</video>

Added: trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type.html.json (0 => 239069)


--- trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type.html.json	                        (rev 0)
+++ trunk/LayoutTests/http/tests/contentextensions/video-element-resource-type.html.json	2018-12-11 05:37:24 UTC (rev 239069)
@@ -0,0 +1,21 @@
+[
+    {
+        "action": {
+            "type": "block"
+        },
+        "trigger": {
+            "url-filter": ".*\\.mp4"
+        }
+    },
+    {
+      "trigger": {
+        "url-filter": ".*test-25fps\\.mp4",
+        "resource-type": [
+          "media"
+        ]
+      },
+      "action": {
+        "type": "ignore-previous-rules"
+      }
+    }
+]

Modified: trunk/Source/WebCore/ChangeLog (239068 => 239069)


--- trunk/Source/WebCore/ChangeLog	2018-12-11 04:04:45 UTC (rev 239068)
+++ trunk/Source/WebCore/ChangeLog	2018-12-11 05:37:24 UTC (rev 239069)
@@ -1,3 +1,18 @@
+2018-12-10  Benjamin Poulain  <[email protected]>
+
+        <rdar://problem/45296285> Content blocker rule "raw" blocks media elements from loading
+        https://bugs.webkit.org/show_bug.cgi?id=192439
+
+        Reviewed by Dean Jackson.
+
+        This broken when WebKit switched to NSURLSession.
+        In CachedResourceLoader::requestResource(), toResourceType() was turning media load into RAW.
+
+        Test: http/tests/contentextensions/video-element-resource-type.html
+
+        * loader/ResourceLoadInfo.cpp:
+        (WebCore::toResourceType):
+
 2018-12-10  Don Olmstead  <[email protected]>
 
         Move ENABLE_RESOURCE_LOAD_STATISTICS to FeatureDefines.xcconfig

Modified: trunk/Source/WebCore/loader/ResourceLoadInfo.cpp (239068 => 239069)


--- trunk/Source/WebCore/loader/ResourceLoadInfo.cpp	2018-12-11 04:04:45 UTC (rev 239068)
+++ trunk/Source/WebCore/loader/ResourceLoadInfo.cpp	2018-12-11 05:37:24 UTC (rev 239069)
@@ -55,8 +55,10 @@
 #endif
         return ResourceType::Font;
 
+    case CachedResource::Type::MediaResource:
+        return ResourceType::Media;
+
     case CachedResource::Type::Beacon:
-    case CachedResource::Type::MediaResource:
     case CachedResource::Type::Icon:
     case CachedResource::Type::RawResource:
         return ResourceType::Raw;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to