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

annevk commented on this pull request.

Many many thanks for tackling this! You should add yourself to the acknowledgments section. I also have a bit of feedback.

> @@ -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>cached origin</dfn> that is either null or a <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.

Shall we call it object origin then? Also, is this observable? If not, maybe we shouldn't make it a thing to avoid folks making it observable?

>  
-  <p>Return a new <a>opaque origin</a>, if <var>url</var> is failure, and <var>url</var>'s
-  <a for=url>origin</a> otherwise.
+  <p>Return the result of <a for="blob URL" lt="resolve the origin">resolving the origin of the blob URL</a>.
   <!-- Did you mean: recursion -->

There's no more recursion in your algorithm so this can be removed.

> @@ -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>cached origin</dfn> that is either null or a <a>ASCII string</a>.

an ASCII*

>  
-  <p>Return a new <a>opaque origin</a>, if <var>url</var> is failure, and <var>url</var>'s
-  <a for=url>origin</a> otherwise.
+  <p>Return the result of <a for="blob URL" lt="resolve the origin">resolving the origin of the blob URL</a>.
   <!-- Did you mean: recursion -->

Hmm I see now that https://w3c.github.io/FileAPI/#blob-url-resolve-the-origin still does recursion. I guess the advantage of that is making it less observable when things are revoked and allowing for a fast path.

-- 
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-93566367

Received on Friday, 2 February 2018 09:55:23 UTC