Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 619a552127eb2f2f6e9383823edd3dccb81f008a
      
https://github.com/WebKit/WebKit/commit/619a552127eb2f2f6e9383823edd3dccb81f008a
  Author: Karl Dubost <[email protected]>
  Date:   2026-08-16 (Sun, 16 Aug 2026)

  Changed paths:
    A ManualTests/download-triggers.html
    M Tools/MiniBrowser/MiniBrowser.entitlements
    M Tools/MiniBrowser/mac/WK2BrowserWindowController.m

  Log Message:
  -----------
  MiniBrowser should support downloads for testing purposes
https://bugs.webkit.org/show_bug.cgi?id=138673
rdar://185001852

Reviewed by Zak Ridouh.

Clicking a link with a download attribute in Mac MiniBrowser saves nothing: the
page navigates to the file, or goes blank. Same for a response carrying
Content-Disposition: attachment, and for Download Linked File in the context 
menu.

Three things were missing, each one enough on its own.
decidePolicyForNavigationAction returned Allow for anything _canHandleRequest,
which is true for the http and https URLs a download attribute points at. There
was no WKDownloadDelegate, so a download that did start was never told where to
write. And MiniBrowser is sandboxed with no entitlement for the download folder.

This answers download for a download attribute, and for a response that is an
attachment or a MIME type we cannot display in the main frame. It saves under a
name that is still free, since WebKit refuses a destination that already exists.

Note the WK1 window is untouched; the download attribute is off by default 
there.

Test: ManualTests/download-triggers.html

* ManualTests/download-triggers.html: Added.
* Tools/MiniBrowser/MiniBrowser.entitlements:
* Tools/MiniBrowser/mac/WK2BrowserWindowController.m:
(responseIsAttachment):
(-[WK2BrowserWindowController 
webView:decidePolicyForNavigationAction:preferences:decisionHandler:]):
(-[WK2BrowserWindowController 
webView:decidePolicyForNavigationResponse:decisionHandler:]):
(-[WK2BrowserWindowController webView:navigationAction:didBecomeDownload:]):
(-[WK2BrowserWindowController webView:navigationResponse:didBecomeDownload:]):
(-[WK2BrowserWindowController _webView:contextMenuDidCreateDownload:]):
(availableDownloadURLWithFilename):
(-[WK2BrowserWindowController 
download:decideDestinationUsingResponse:suggestedFilename:completionHandler:]):
(-[WK2BrowserWindowController downloadDidFinish:]):
(-[WK2BrowserWindowController download:didFailWithError:resumeData:]):

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



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

Reply via email to