Bug 178947 - Need WebView API to load blob: resources
Summary: Need WebView API to load blob: resources
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: Safari Technology Preview
Hardware: Macintosh All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-27 11:48 PDT by Jonathan Hammer
Modified: 2017-12-19 02:01 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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