Bug 54585 - [fileapi] Implement EntrySync.toURI by moving Entry::toURI to EntryBase
Summary: [fileapi] Implement EntrySync.toURI by moving Entry::toURI to EntryBase
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-16 13:59 PST by Adam Klein
Modified: 2011-02-26 05:14 PST (History)
5 users (show)

See Also:


Attachments
Patch (21.46 KB, patch)
2011-02-16 14:01 PST, Adam Klein
no flags Details | Formatted Diff | Diff
Patch for commit queue (21.46 KB, patch)
2011-02-22 10:20 PST, Adam Klein
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Klein 2011-02-16 13:59:42 PST
[fileapi] Implement EntrySync.toURI by moving Entry::toURI to EntryBase
Comment 1 Adam Klein 2011-02-16 14:01:39 PST
Created attachment 82689 [details]
Patch
Comment 2 Adam Klein 2011-02-16 14:03:32 PST
Still trying to get the added test to pass; if you have any hints about worker tests, let me know.
Comment 3 Adam Klein 2011-02-16 14:42:19 PST
Apparently none of the worker tests are currently able to run, so this should be fully ready for review.
Comment 4 Eric U. 2011-02-16 16:47:20 PST
Comment on attachment 82689 [details]
Patch

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

LGTM otherwise.

> LayoutTests/fast/filesystem/resources/file-entry-to-uri-sync.js:11
> +shouldBe("testFileEntry.toURI()", "'filesystem:file:///temporary/testFileEntry.txt'");

Are we forcing all URLs to start with three slashes, then--two for the protocol, and one for "it's from the root"?  It seems like the third one should be superfluous, as the root is implied.  I realize this is beyond the scope of this CL, but apparently I missed it in the last one.
Comment 5 Adam Klein 2011-02-16 17:21:29 PST
Comment on attachment 82689 [details]
Patch

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

>> LayoutTests/fast/filesystem/resources/file-entry-to-uri-sync.js:11
>> +shouldBe("testFileEntry.toURI()", "'filesystem:file:///temporary/testFileEntry.txt'");
> 
> Are we forcing all URLs to start with three slashes, then--two for the protocol, and one for "it's from the root"?  It seems like the third one should be superfluous, as the root is implied.  I realize this is beyond the scope of this CL, but apparently I missed it in the last one.

I think the three slashes in a row here are due simply to the way the file: URI scheme works (and how SecurityOrigin::toString deals with it).  The first two slashes are part of the security origin: "file://". The third slash separates the origin from the filesystem type ("permanent" or "temporary").  Without this, "normal" http-based filesystme URIs would be unparseable: that last slash keeps these from reading "http://www.google.comtemporary/foo/bar.txt".

It just so happens that the "host" part of the origin is empty for file: URIs.  Does that make sense? Or am I missing your point?
Comment 6 Eric U. 2011-02-16 17:23:29 PST
(In reply to comment #5)
> (From update of attachment 82689 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=82689&action=review
> 
> >> LayoutTests/fast/filesystem/resources/file-entry-to-uri-sync.js:11
> >> +shouldBe("testFileEntry.toURI()", "'filesystem:file:///temporary/testFileEntry.txt'");
> > 
> > Are we forcing all URLs to start with three slashes, then--two for the protocol, and one for "it's from the root"?  It seems like the third one should be superfluous, as the root is implied.  I realize this is beyond the scope of this CL, but apparently I missed it in the last one.
> 
> I think the three slashes in a row here are due simply to the way the file: URI scheme works (and how SecurityOrigin::toString deals with it).  The first two slashes are part of the security origin: "file://". The third slash separates the origin from the filesystem type ("permanent" or "temporary").  Without this, "normal" http-based filesystme URIs would be unparseable: that last slash keeps these from reading "http://www.google.comtemporary/foo/bar.txt".
> 
> It just so happens that the "host" part of the origin is empty for file: URIs.  Does that make sense? Or am I missing your point?

Oh, OK--nevermind then.  Looks like it's not a problem.
Comment 7 Kinuko Yasuda 2011-02-16 17:47:12 PST
Comment on attachment 82689 [details]
Patch

lgtm.
Comment 8 Adam Barth 2011-02-21 12:50:01 PST
Comment on attachment 82689 [details]
Patch

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

> Source/WebCore/fileapi/DOMFileSystem.cpp:54
> -    : DOMFileSystemBase(name, asyncFileSystem)
> +    : DOMFileSystemBase(context, name, asyncFileSystem)
>      , ActiveDOMObject(context, this)

It's too bad we end up with two pointers to the script execution context, but I don't see a way around it.

> Source/WebCore/fileapi/EntryBase.cpp:59
> +    StringBuilder uriBuilder;

nit: I would have just called this "result" or something.

> Source/WebCore/fileapi/EntryBase.cpp:63
> +    uriBuilder.append(m_fileSystem->asyncFileSystem()->type() == AsyncFileSystem::Temporary ? "temporary" : "persistent");

These should use the constants, but I guess that hasn't landed yet
Comment 9 Adam Klein 2011-02-22 10:20:10 PST
Created attachment 83337 [details]
Patch for commit queue
Comment 10 Adam Klein 2011-02-22 10:22:54 PST
Comment on attachment 82689 [details]
Patch

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

>> Source/WebCore/fileapi/DOMFileSystem.cpp:54
>>      , ActiveDOMObject(context, this)
> 
> It's too bad we end up with two pointers to the script execution context, but I don't see a way around it.

Yeah, given the way the type hierarchy works, I don't see a better way. I could just hold onto a ScriptOrigin*, but that strikes me as conceptually worse.

>> Source/WebCore/fileapi/EntryBase.cpp:59
>> +    StringBuilder uriBuilder;
> 
> nit: I would have just called this "result" or something.

Fixed, agreed this name is better. Wish StringBuilder was a bit more like the Java version and allowed me to chain.

>> Source/WebCore/fileapi/EntryBase.cpp:63
>> +    uriBuilder.append(m_fileSystem->asyncFileSystem()->type() == AsyncFileSystem::Temporary ? "temporary" : "persistent");
> 
> These should use the constants, but I guess that hasn't landed yet

Will use the constants once the other 54774 lands; for now I just want to avoid a merge conflict between the two patches.
Comment 11 WebKit Commit Bot 2011-02-26 05:14:19 PST
Comment on attachment 83337 [details]
Patch for commit queue

Clearing flags on attachment: 83337

Committed r79778: <http://trac.webkit.org/changeset/79778>
Comment 12 WebKit Commit Bot 2011-02-26 05:14:26 PST
All reviewed patches have been landed.  Closing bug.