Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 656a3201fd4ea2421700d9fa0f3a97de1987bfde
      
https://github.com/WebKit/WebKit/commit/656a3201fd4ea2421700d9fa0f3a97de1987bfde
  Author: Alexey Proskuryakov <[email protected]>
  Date:   2026-05-18 (Mon, 18 May 2026)

  Changed paths:
    M Source/WebKit/Shared/API/Cocoa/_WKHitTestResult.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/ContextMenuTests.mm

  Log Message:
  -----------
  "Open [Image/Video] in New Tab" contextual menu item caused double 
percent-encoding for unencoded URLs
https://bugs.webkit.org/show_bug.cgi?id=314975
rdar://177297247

Reviewed by Darin Adler.

WebCore's URL parser leaves some characters literal in the path (e.g. '[' and 
']' per the
WHATWG URL spec), so `flower [A].jpg` becomes `flower%20[A].jpg`. +[NSURL 
URLWithString:]
reacts to those literal characters by re-encoding the whole path, turning the 
existing %20
into %2520 and yielding `flower%2520%5BA%5D.jpg`.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/ContextMenuTests.mm

* Source/WebKit/Shared/API/Cocoa/_WKHitTestResult.mm:
(URLFromString): Go through WTF::URL::createNSURL() 
(CFURLCreateAbsoluteURLWithBytes)
instead of +[NSURL URLWithString:], so that there is no opportunity for 
disagreement between
different URL implementations.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/ContextMenuTests.mm:
(TestWebKitAPI::TEST(ContextMenuTests, HitTestResultImageURLNotDoubleEncoded)):

Canonical link: https://commits.webkit.org/313430@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to