Bug 137153 - Add API for loading local files
Summary: Add API for loading local files
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-26 11:56 PDT by Anders Carlsson
Modified: 2015-08-18 02:02 PDT (History)
2 users (show)

See Also:


Attachments
Patch (6.75 KB, patch)
2014-09-26 12:08 PDT, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (6.76 KB, patch)
2014-09-26 16:29 PDT, Anders Carlsson
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2014-09-26 11:56:32 PDT
Add API for loading local files
Comment 1 Anders Carlsson 2014-09-26 12:08:19 PDT
Created attachment 238727 [details]
Patch
Comment 2 mitz 2014-09-26 12:58:25 PDT
Comment on attachment 238727 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238727&action=review

This new API could use a couple of API tests.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h:99
> +- (WKNavigation *)loadFileURL:(NSURL *)URL allowingReadAccessToURL:(NSURL *)readAccessURL WK_AVAILABLE(NA, WK_IOS_TBA);

The Modern WebKit API has been described as “Class for class […] exactly the same on iOS and OS X”. Why is this method not available on OS X?
Comment 3 Anders Carlsson 2014-09-26 13:07:50 PDT
Comment on attachment 238727 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238727&action=review

>> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h:99
>> +- (WKNavigation *)loadFileURL:(NSURL *)URL allowingReadAccessToURL:(NSURL *)readAccessURL WK_AVAILABLE(NA, WK_IOS_TBA);
> 
> The Modern WebKit API has been described as “Class for class […] exactly the same on iOS and OS X”. Why is this method not available on OS X?

No reason, I'll fix that!
Comment 4 Anders Carlsson 2014-09-26 16:29:37 PDT
Created attachment 238745 [details]
Patch
Comment 5 Anders Carlsson 2014-09-26 16:38:41 PDT
Committed r174029: <http://trac.webkit.org/changeset/174029>
Comment 6 Darin Adler 2014-09-28 16:25:18 PDT
Comment on attachment 238745 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238745&action=review

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h:96
> + If readAccessURL references a directory, files inside that file may be loaded by WebKit.

file inside that *directory*

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h:99
> +- (WKNavigation *)loadFileURL:(NSURL *)URL allowingReadAccessToURL:(NSURL *)readAccessURL WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);

Why is a single URL good enough for read-access? Should this be an array of NSURL instead?

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:423
> +    auto navigation = _navigationState->createLoadRequestNavigation(navigationID, [NSURLRequest requestWithURL:URL]);
> +
> +    return navigation.autorelease();

Wouldn’t this read better without a local variable?
Comment 7 Marcin Ignac 2015-08-18 02:02:21 PDT
Looks like images loaded from a local path on iOS even with allowingReadAccessToURL are tainted and trying to use them for WebGL textures throws DOM Exception 18. Is there any solution for that?