Bug 178947

Summary: Need WebView API to load blob: resources
Product: WebKit Reporter: Jonathan Hammer <jonathan>
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, jonathan, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=176986
https://bugs.webkit.org/show_bug.cgi?id=177801
https://bugs.webkit.org/show_bug.cgi?id=180969

Description Jonathan Hammer 2017-10-27 11:48:13 PDT
The efforts to move to blob: URLs for pasted RTFD and image content that have landed in <https://trac.webkit.org/changeset/222119/webkit> and <https://trac.webkit.org/changeset/222839/webkit> are great for JavaScript clients, but not so great for Obj-C WebKit clients. As far as I can tell, there is no Obj-C WebKit API for accessing or loading the data for the blob: URLs that are now appearing inside pasted DOM content. 

We need API for this because our Mac app uses WebKit (legacy) as an HTML email editor (similar to Mail.app) and needs to be able to "import" the image resources that users paste into the editor. Prior to the above two changesets landing, we could access these resources inside -webView:shouldInsertNode:replacingDOMRange:givenAction: by doing basically the following:

WebResource *webResource = [range.commonAncestorContainer.ownerDocument.webFrame.dataSource subresourceForURL:imageURL];

However, this does not work for blob: URLs. Would be really great if there was a way to do this, otherwise we're kind of stuck. Thanks!
Comment 1 Radar WebKit Bug Importer 2017-10-29 10:39:38 PDT
<rdar://problem/35241514>
Comment 2 Ryosuke Niwa 2017-12-19 02:01:08 PST
We're going to restore the old behavior for WebKit1 clients for now: https://bugs.webkit.org/show_bug.cgi?id=180969