NEW 277493
UIDelegate method to dissallow FileUpload panel for an arbitrary frame
https://bugs.webkit.org/show_bug.cgi?id=277493
Summary UIDelegate method to dissallow FileUpload panel for an arbitrary frame
dmt021
Reported 2024-08-01 11:13:48 PDT
For security reasons one may want to forbid file uploads on certain domains. On MacOS this could be achieved by checking `frame` in the implementation of `runOpenPanelWithParameters`. But this method is unavailable on other platforms. I don't think it will be practical to add `runOpenPanelWithParameters` on iOS, but the same goal could be achieved by adding an optional method: ``` - (void)webView:(WKWebView *)webView canRunOpenPanelWithParameters:(WKOpenPanelParameters *)parameters initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL allow))completionHandler; ``` which is called before showing the FileUpload panel. And it could be further enhanced with ``` - (void)webView:(WKWebView *)webView filterOpenPanelResults:(NSArray<NSURL *> * URLs)urls forFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSArray<NSURL *> * _Nullable URLs))completionHandler; ``` which is called after the FileUpload panel is dismissed and can be used to filter selected files based on their urls (for example by extension).
Attachments
Radar WebKit Bug Importer
Comment 1 2024-08-08 11:14:13 PDT
Note You need to log in before you can comment on or make changes to this bug.