Changeset 244794 in webkit
- Timestamp:
- Apr 30, 2019 12:42:34 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r244787 r244794 1 2019-04-30 Alex Christensen <achristensen@webkit.org> 2 3 Add WKContentRuleList ping resource-type 4 https://bugs.webkit.org/show_bug.cgi?id=197325 5 <rdar://problem/49841404> 6 7 Reviewed by Geoff Garen. 8 9 * http/tests/contentextensions/block-ping-resource-type-raw--expected.txt: Copied from LayoutTests/http/tests/contentextensions/block-ping-expected.txt. 10 * http/tests/contentextensions/block-ping-resource-type-raw.html: Copied from LayoutTests/http/tests/contentextensions/block-ping.html. 11 * http/tests/contentextensions/block-ping-resource-type-raw.html.json: Copied from LayoutTests/http/tests/contentextensions/block-ping.html.json. 12 * http/tests/contentextensions/block-ping-resource-type-ping-expected.txt: Copied from LayoutTests/http/tests/contentextensions/block-ping-expected.txt. 13 * http/tests/contentextensions/block-ping-resource-type-ping.html: Copied from LayoutTests/http/tests/contentextensions/block-ping.html. 14 * http/tests/contentextensions/block-ping-resource-type-ping.html.json: Copied from LayoutTests/http/tests/contentextensions/block-ping.html.json. 15 1 16 2019-04-30 Shawn Roberts <sroberts@apple.com> 2 17 -
trunk/LayoutTests/http/tests/contentextensions/block-ping-resource-type-ping-expected.txt
r244759 r244794 1 CONSOLE MESSAGE: line 34: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-ping.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/save-ping.php?test=contentextensions-block-ping 1 CONSOLE MESSAGE: line 34: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-ping-resource-type-ping.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/save-ping.php?test=contentextensions-block-ping-resource-type-ping 2 ALERT: PASS: successfully loaded ping url with fetch 2 3 This test follows a link with a ping attribute where the ping URL matches a 'block' rule. 3 4 -
trunk/LayoutTests/http/tests/contentextensions/block-ping-resource-type-ping.html
r244759 r244794 12 12 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; 13 13 iframeDoc.write('' + 14 '<img src="resources/delete-ping.php?test=contentextensions-block-ping " ' +14 '<img src="resources/delete-ping.php?test=contentextensions-block-ping-resource-type-ping" ' + 15 15 'onerror="parent.clickOnLinkWithPing();">' + 16 16 '<a id="a" ' + 17 17 'href="resources/check-ping.html" ' + // check-ping.html calls showPingResult() 18 'ping="resources/save-ping.php?test=contentextensions-block-ping "> ' +18 'ping="resources/save-ping.php?test=contentextensions-block-ping-resource-type-ping"> ' + 19 19 'Link with ping' + 20 20 '</a>' … … 39 39 var iframe = document.getElementById("result_frame"); 40 40 iframe.onload = function() { 41 if (window.testRunner) { testRunner.notifyDone(); } 41 fetch("resources/save-ping.php?test=contentextensions-block-ping-resource-type-ping").then(()=>{ 42 fetch("resources/delete-ping.php?test=contentextensions-block-ping-resource-type-ping").then(()=>{ 43 alert("PASS: successfully loaded ping url with fetch"); 44 if (window.testRunner) { testRunner.notifyDone(); } 45 }) 46 }).catch(error => { alert("FAIL:" + error); if (window.testRunner) { testRunner.notifyDone(); } }); 42 47 } 43 iframe.src = "resources/get-ping-data.php?test=contentextensions-block-ping &timeout_ms=1000";48 iframe.src = "resources/get-ping-data.php?test=contentextensions-block-ping-resource-type-ping&timeout_ms=1000"; 44 49 // Why timeout_ms=1000: 45 50 // To pass the test, the ping shouldn't arrive, so we need to -
trunk/LayoutTests/http/tests/contentextensions/block-ping-resource-type-ping.html.json
r244759 r244794 2 2 { 3 3 "trigger": { 4 "url-filter": "save-ping.php" 4 "url-filter": "save-ping.php", 5 "resource-type": ["ping"] 5 6 }, 6 7 "action": { -
trunk/LayoutTests/http/tests/contentextensions/block-ping-resource-type-raw-expected.txt
r244759 r244794 1 CONSOLE MESSAGE: line 34: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-ping.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/save-ping.php?test=contentextensions-block-ping 1 CONSOLE MESSAGE: line 34: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-ping-resource-type-raw.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/save-ping.php?test=contentextensions-block-ping-resource-type-raw 2 CONSOLE MESSAGE: line 41: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/block-ping-resource-type-raw.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/save-ping.php?test=contentextensions-block-ping-resource-type-raw 3 CONSOLE MESSAGE: line 41: Resource blocked by content blocker 4 CONSOLE MESSAGE: line 41: Fetch API cannot load http://127.0.0.1:8000/contentextensions/resources/save-ping.php?test=contentextensions-block-ping-resource-type-raw due to access control checks. 5 ALERT: PASS:TypeError: Resource blocked by content blocker 2 6 This test follows a link with a ping attribute where the ping URL matches a 'block' rule. 3 7 -
trunk/LayoutTests/http/tests/contentextensions/block-ping-resource-type-raw.html
r244759 r244794 12 12 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; 13 13 iframeDoc.write('' + 14 '<img src="resources/delete-ping.php?test=contentextensions-block-ping " ' +14 '<img src="resources/delete-ping.php?test=contentextensions-block-ping-resource-type-raw" ' + 15 15 'onerror="parent.clickOnLinkWithPing();">' + 16 16 '<a id="a" ' + 17 17 'href="resources/check-ping.html" ' + // check-ping.html calls showPingResult() 18 'ping="resources/save-ping.php?test=contentextensions-block-ping "> ' +18 'ping="resources/save-ping.php?test=contentextensions-block-ping-resource-type-raw"> ' + 19 19 'Link with ping' + 20 20 '</a>' … … 39 39 var iframe = document.getElementById("result_frame"); 40 40 iframe.onload = function() { 41 if (window.testRunner) { testRunner.notifyDone(); } 41 fetch("resources/save-ping.php?test=contentextensions-block-ping-resource-type-raw").then(()=>{ 42 fetch("resources/delete-ping.php?test=contentextensions-block-ping-resource-type-raw").then(()=>{ 43 alert("FAIL: successfully loaded ping url with fetch"); 44 if (window.testRunner) { testRunner.notifyDone(); } 45 }) 46 }).catch(error => { alert("PASS:" + error); if (window.testRunner) { testRunner.notifyDone(); } }); 42 47 } 43 iframe.src = "resources/get-ping-data.php?test=contentextensions-block-ping &timeout_ms=1000";48 iframe.src = "resources/get-ping-data.php?test=contentextensions-block-ping-resource-type-raw&timeout_ms=1000"; 44 49 // Why timeout_ms=1000: 45 50 // To pass the test, the ping shouldn't arrive, so we need to -
trunk/LayoutTests/http/tests/contentextensions/block-ping-resource-type-raw.html.json
r244759 r244794 2 2 { 3 3 "trigger": { 4 "url-filter": "save-ping.php" 4 "url-filter": "save-ping.php", 5 "resource-type": ["raw"] 5 6 }, 6 7 "action": { -
trunk/Source/WebCore/ChangeLog
r244777 r244794 1 2019-04-30 Alex Christensen <achristensen@webkit.org> 2 3 Add WKContentRuleList ping resource-type 4 https://bugs.webkit.org/show_bug.cgi?id=197325 5 <rdar://problem/49841404> 6 7 Reviewed by Geoff Garen. 8 9 Tests: http/tests/contentextensions/block-ping-resource-type-ping.html and http/tests/contentextensions/block-ping-resource-type-raw.html 10 11 * contentextensions/ContentExtensionsBackend.cpp: 12 (WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad): 13 * contentextensions/ContentExtensionsBackend.h: 14 * loader/PingLoader.cpp: 15 (WebCore::processContentRuleListsForLoad): 16 (WebCore::PingLoader::sendPing): 17 * loader/ResourceLoadInfo.cpp: 18 (WebCore::ContentExtensions::readResourceType): 19 (WebCore::ContentExtensions::ResourceLoadInfo::getResourceFlags const): 20 * loader/ResourceLoadInfo.h: 21 * page/UserContentProvider.cpp: 22 (WebCore::UserContentProvider::processContentRuleListsForLoad): 23 * page/UserContentProvider.h: 24 1 25 2019-04-30 Justin Fan <justin_fan@apple.com> 2 26 -
trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
r243319 r244794 151 151 } 152 152 153 ContentRuleListResults ContentExtensionsBackend::processContentRuleListsForLoad(const URL& url, ResourceTyperesourceType, DocumentLoader& initiatingDocumentLoader)153 ContentRuleListResults ContentExtensionsBackend::processContentRuleListsForLoad(const URL& url, OptionSet<ResourceType> resourceType, DocumentLoader& initiatingDocumentLoader) 154 154 { 155 155 if (m_contentExtensions.isEmpty()) -
trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h
r244695 r244794 63 63 WEBCORE_EXPORT StyleSheetContents* globalDisplayNoneStyleSheet(const String& identifier) const; 64 64 65 ContentRuleListResults processContentRuleListsForLoad(const URL&, ResourceType, DocumentLoader& initiatingDocumentLoader);65 ContentRuleListResults processContentRuleListsForLoad(const URL&, OptionSet<ResourceType>, DocumentLoader& initiatingDocumentLoader); 66 66 WEBCORE_EXPORT ContentRuleListResults processContentRuleListsForPingLoad(const URL&, const URL& mainDocumentURL); 67 67 -
trunk/Source/WebCore/loader/PingLoader.cpp
r244700 r244794 64 64 65 65 // Returns true if we should block the load. 66 static bool processContentRuleListsForLoad(const Frame& frame, ResourceRequest& request, ContentExtensions::ResourceTyperesourceType)66 static bool processContentRuleListsForLoad(const Frame& frame, ResourceRequest& request, OptionSet<ContentExtensions::ResourceType> resourceType) 67 67 { 68 68 auto* documentLoader = frame.loader().documentLoader(); … … 120 120 ResourceRequest request(pingURL); 121 121 #if ENABLE(CONTENT_EXTENSIONS) 122 if (processContentRuleListsForLoad(frame, request, ContentExtensions::ResourceType::Raw))122 if (processContentRuleListsForLoad(frame, request, { ContentExtensions::ResourceType::Raw, ContentExtensions::ResourceType::Ping })) 123 123 return; 124 124 #endif -
trunk/Source/WebCore/loader/ResourceLoadInfo.cpp
r244700 r244794 103 103 if (name == "popup") 104 104 return static_cast<uint16_t>(ResourceType::Popup); 105 if (name == "ping") 106 return static_cast<uint16_t>(ResourceType::Ping); 105 107 return static_cast<uint16_t>(ResourceType::Invalid); 106 108 } … … 127 129 ResourceFlags flags = 0; 128 130 ASSERT(type != ResourceType::Invalid); 129 flags |= static_cast<ResourceFlags>(type);131 flags |= type.toRaw(); 130 132 flags |= isThirdParty() ? static_cast<ResourceFlags>(LoadType::ThirdParty) : static_cast<ResourceFlags>(LoadType::FirstParty); 131 133 return flags; -
trunk/Source/WebCore/loader/ResourceLoadInfo.h
r244695 r244794 29 29 30 30 #include "CachedResource.h" 31 #include <wtf/OptionSet.h> 31 32 #include <wtf/URL.h> 32 33 … … 46 47 PlugInStream = 0x0100, 47 48 Popup = 0x0200, 49 // 0x0400 and 0x0800 are used by LoadType. 50 Ping = 0x1000, 48 51 }; 49 const uint16_t ResourceTypeMask = 0x 03FF;52 const uint16_t ResourceTypeMask = 0x13FF; 50 53 51 54 enum class LoadType : uint16_t { … … 55 58 }; 56 59 const uint16_t LoadTypeMask = 0x0C00; 60 61 static_assert(!(ResourceTypeMask & LoadTypeMask), "ResourceTypeMask and LoadTypeMask should be mutually exclusive because they are stored in the same uint16_t"); 57 62 58 63 typedef uint16_t ResourceFlags; … … 75 80 URL resourceURL; 76 81 URL mainDocumentURL; 77 ResourceTypetype;82 OptionSet<ResourceType> type; 78 83 79 84 bool isThirdParty() const; -
trunk/Source/WebCore/page/UserContentProvider.cpp
r244695 r244794 103 103 } 104 104 105 ContentRuleListResults UserContentProvider::processContentRuleListsForLoad(const URL& url, ContentExtensions::ResourceTyperesourceType, DocumentLoader& initiatingDocumentLoader)105 ContentRuleListResults UserContentProvider::processContentRuleListsForLoad(const URL& url, OptionSet<ContentExtensions::ResourceType> resourceType, DocumentLoader& initiatingDocumentLoader) 106 106 { 107 107 if (!contentExtensionsEnabled(initiatingDocumentLoader)) -
trunk/Source/WebCore/page/UserContentProvider.h
r244695 r244794 89 89 // FIXME: These don't really belong here. They should probably bundled up in the ContentExtensionsBackend 90 90 // which should always exist. 91 ContentRuleListResults processContentRuleListsForLoad(const URL&, ContentExtensions::ResourceType, DocumentLoader& initiatingDocumentLoader);91 ContentRuleListResults processContentRuleListsForLoad(const URL&, OptionSet<ContentExtensions::ResourceType>, DocumentLoader& initiatingDocumentLoader); 92 92 Vector<ContentExtensions::ActionsFromContentRuleList> actionsForResourceLoad(const ContentExtensions::ResourceLoadInfo&, DocumentLoader& initiatingDocumentLoader); 93 93 WEBCORE_EXPORT void forEachContentExtension(const Function<void(const String&, ContentExtensions::ContentExtension&)>&, DocumentLoader& initiatingDocumentLoader);
Note: See TracChangeset
for help on using the changeset viewer.