Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7b37bf4eada1c881ba0453f9dc6b04b772a03e47
https://github.com/WebKit/WebKit/commit/7b37bf4eada1c881ba0453f9dc6b04b772a03e47
Author: Alex Christensen <[email protected]>
Date: 2025-06-12 (Thu, 12 Jun 2025)
Changed paths:
M Source/WTF/wtf/URL.h
M Source/WTF/wtf/cf/URLCF.cpp
M Source/WebKit/Shared/NavigationActionData.h
M Source/WebKit/Shared/NavigationActionData.serialization.in
M Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm
M Source/WebKit/UIProcess/win/AutomationSessionClientWin.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
M Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/NavigationAction.mm
Log Message:
-----------
Allow WKNavigationAction.request.URL to be valid NSURL that isn't valid
WTF::URL
https://bugs.webkit.org/show_bug.cgi?id=294333
rdar://145790356
Reviewed by Chris Dumez.
In 289946@main I made it so an invalid WTF::URL can't convert to a valid NSURL.
This fixed a large number of issues involving improper use of URLs.
However, this also prevented a legitimate use of invalid WTF::URLs:
An app can get a WKNavigationAction with the URL and decide to do something with
it that is not related to WebKit. For compatibility, we need to explicitly
allow
this. Since the WebCore::ResourceRequest IPC encoder uses conversion to NSURL,
if we have an invalid WTF::URL we need to send the invalid URL string separately
then use it on the other side. Since NSURL.URLWithString also doesn't
successfully
parse such a URL, we need to use CFURLCreateAbsoluteURLWithBytes, which I made
into its own function to share between its existing and introduced uses.
An alternative I considered was to percent encode spaces in hosts of URLs with
non-special schemes, but that goes against behavior of Chrome, Firefox, Safari,
and NSURL.URLWithString so I decided not to.
* Source/WTF/wtf/URL.h:
* Source/WTF/wtf/cf/URLCF.cpp:
(WTF::URL::createCFURL):
(WTF::URL::createCFURL const):
* Source/WebKit/Shared/NavigationActionData.h:
* Source/WebKit/Shared/NavigationActionData.serialization.in:
* Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm:
(-[WKNavigationAction request]):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWindow):
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::navigationActionData const):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::didSameDocumentNavigationForFrameViaJS):
(WebKit::WebLocalFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadInvalidURLRequest.mm:
(TestWebKitAPI::TEST(WebKit, NavigateToInvalidURL)):
Canonical link: https://commits.webkit.org/296130@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes