Title: [294117] trunk
- Revision
- 294117
- Author
- commit-qu...@webkit.org
- Date
- 2022-05-12 13:15:42 -0700 (Thu, 12 May 2022)
Log Message
Make if-domain and unless-domain regexes only look at URL hosts
https://bugs.webkit.org/show_bug.cgi?id=240199
Patch by Alex Christensen <achristen...@webkit.org> on 2022-05-12
Reviewed by John Wilander.
Source/WebCore:
In bug 234126 I moved how if-domain and unless-domain are done by translating them into a regex.
I overlooked that a domain can be in the path. If we get to '/' then we are at the end of the host.
Covered by an API test.
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::getDomainList):
Tools:
* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::TEST_F):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (294116 => 294117)
--- trunk/Source/WebCore/ChangeLog 2022-05-12 20:08:08 UTC (rev 294116)
+++ trunk/Source/WebCore/ChangeLog 2022-05-12 20:15:42 UTC (rev 294117)
@@ -1,3 +1,17 @@
+2022-05-12 Alex Christensen <achristen...@webkit.org>
+
+ Make if-domain and unless-domain regexes only look at URL hosts
+ https://bugs.webkit.org/show_bug.cgi?id=240199
+
+ Reviewed by John Wilander.
+
+ In bug 234126 I moved how if-domain and unless-domain are done by translating them into a regex.
+ I overlooked that a domain can be in the path. If we get to '/' then we are at the end of the host.
+ Covered by an API test.
+
+ * contentextensions/ContentExtensionParser.cpp:
+ (WebCore::ContentExtensions::getDomainList):
+
2022-05-11 Kate Cheney <katherine_che...@apple.com>
Mail compose: right clicking an image attachment selects it
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp (294116 => 294117)
--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp 2022-05-12 20:08:08 UTC (rev 294116)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp 2022-05-12 20:15:42 UTC (rev 294117)
@@ -97,7 +97,7 @@
domain = makeStringByReplacingAll(domain, pair.first, pair.second);
const char* protocolRegex = "[a-z][a-z+.-]*:\\/\\/";
- const char* allowSubdomainsRegex = "(.*\\.)*";
+ const char* allowSubdomainsRegex = "([^/]*\\.)*";
regexes.uncheckedAppend(makeString(protocolRegex, allowSubdomains ? allowSubdomainsRegex : "", domain, "[:/]"));
}
return regexes;
Modified: trunk/Tools/ChangeLog (294116 => 294117)
--- trunk/Tools/ChangeLog 2022-05-12 20:08:08 UTC (rev 294116)
+++ trunk/Tools/ChangeLog 2022-05-12 20:15:42 UTC (rev 294117)
@@ -1,3 +1,13 @@
+2022-05-12 Alex Christensen <achristen...@webkit.org>
+
+ Make if-domain and unless-domain regexes only look at URL hosts
+ https://bugs.webkit.org/show_bug.cgi?id=240199
+
+ Reviewed by John Wilander.
+
+ * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
+ (TestWebKitAPI::TEST_F):
+
2022-05-11 Kate Cheney <katherine_che...@apple.com>
Mail compose: right clicking an image attachment selects it
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (294116 => 294117)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp 2022-05-12 20:08:08 UTC (rev 294116)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp 2022-05-12 20:15:42 UTC (rev 294117)
@@ -648,7 +648,8 @@
testRequest(ifDomainStarBackend, mainDocumentRequest("http://webkit.organization/test.htm"_s), { });
testRequest(ifDomainStarBackend, mainDocumentRequest("http://not_webkit.org/test.html"_s), { });
testRequest(ifDomainStarBackend, mainDocumentRequest("http://webkit.organization/test.html"_s), { });
-
+ testRequest(ifDomainStarBackend, mainDocumentRequest("http://example.com/.webkit.org/in/path/test.html"_s), { });
+
auto unlessDomainStarBackend = makeBackend("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"test\\\\.html\", \"unless-domain\":[\"*webkit.org\"]}}]"_s);
testRequest(unlessDomainStarBackend, mainDocumentRequest("http://webkit.org/test.htm"_s), { });
testRequest(unlessDomainStarBackend, mainDocumentRequest("http://bugs.webkit.org/test.htm"_s), { });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes