[Webkit-unassigned] [Bug 277493] New: UIDelegate method to dissallow FileUpload panel for an arbitrary frame

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 1 11:13:48 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=277493

            Bug ID: 277493
           Summary: UIDelegate method to dissallow FileUpload panel for an
                    arbitrary frame
           Product: WebKit
           Version: Other
          Hardware: iPhone / iPad
                OS: iOS 18
            Status: NEW
          Severity: Enhancement
          Priority: P2
         Component: Platform
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: dmt021 at gmail.com

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).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240801/041c7528/attachment-0001.htm>


More information about the webkit-unassigned mailing list