Re: [whatwg/url] Use definitions in FileAPI spec to resolve blob URLs and their origins. (#371)

annevk commented on this pull request.

Aside from nits this looks okay to me. Another thought I had was that we could go with a different design where File API returns an object only and URL defines the rest. That is, if return url's object's environment's origin if url's object is non-null and otherwise keep the existing steps. Maybe that would be a little cleaner?

> @@ -1026,6 +1026,12 @@ resource the <a for=/>URL</a>'s other components identify. It is initially null.
 "<code>blob</code>" <a for=/>URLs</a>, but others can be added going forward, hence
 "object".
 
+<p>A <a for=/>URL</a> also has an associated
+<dfn for=url>object origin</dfn> that is either null or an <a>ASCII string</a>.
+It is initially null.
+
+<p class="note">This is used to support caching the origin of a "<code>blob</code>"
+<a for=/>URL</a> at the time it is parsed.

I think it would be helpful to add here that this is important as it might be removed from the blob URL store after that time.

> @@ -1026,6 +1026,12 @@ resource the <a for=/>URL</a>'s other components identify. It is initially null.
 "<code>blob</code>" <a for=/>URLs</a>, but others can be added going forward, hence
 "object".
 
+<p>A <a for=/>URL</a> also has an associated
+<dfn for=url>object origin</dfn> that is either null or an <a>ASCII string</a>.
+It is initially null.

Actually, shouldn't this be an origin rather than a string?

> @@ -1325,12 +1331,12 @@ different document encoding. Using the <a>UTF-8</a> encoding everywhere solves t
  <li><p>If <var>url</var>'s <a for=url>scheme</a> is not
  "<code>blob</code>", return <var>url</var>.
 
- <li><p>If <var>url</var>'s <a for=url>path</a> <a for=list>is empty</a> or <var>url</var>'s
- <a for=url>path</a>[0] is not in the <a>Blob URL Store</a>, then return <var>url</var>.
- [[!FILEAPI]]
+ <li><p>Set <var>url</var>'s <a for=url>object origin</a> to the result of
+ <a for="blob URL" lt="resolve the origin">resolving the origin of the blob URL</a> <var>url</var>.

Should we only set this if url's object is non-null?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/371#pullrequestreview-93812948

Received on Saturday, 3 February 2018 10:26:51 UTC