webkit-fake-url:// replaced with blob:file:// in macOS 10.12.14? How to access data?

I have a Cocoa Mac app with an embedded WebView. That WebView loads a local HTML page with a contenteditable DIV.


Users can paste images from the clipboard. Before the recent update to macOS Sierra 10.12.14, images pasted from the clipboard would be pasted with a URL such as: webkit-fake-url://740e9b51-061c-499c-ba28-404f4392...


I would detect those URLs and access the actual file from the Objective-C side via the API:


NSURL *fakeUrl = [NSURL URLWithString:@"webkit-fake-url://1245-56789";

[self.webView.mainFrame.dataSource subresourceForURL:fakeUrl];

[fakeResource.data writeToFile:tempPath options:0 error:&error];


However, starting with macOS Sierra 10.12.14, the webkit-fake-url scheme was replaced by this: blob:file://1234-5678.


Accessing those resources via [webView.mainFrame.dataSource subresourceForURL:] does not work anymore.


How can I access the data for a `blob:file://` URL from Objective-C via the WebKit API? Is this still possible?

Replies

We are having this same issue. Is there any way to load blob: URLs via Obj-C WebKit APIs?