Re: [w3c/FileAPI] Refactor Blob URL Store definition. (#92)

inexorabletash commented on this pull request.

Thanks for taking this on!

> +
+<h3 id="url-model">
+Model</h3>
+
+Each user agent must maintain a <dfn id="BlobURLStore" export>Blob URL Store</dfn>.
+A [=Blob URL Store=] is a [=map=]
+where [=map/keys=] are [=valid URL strings=]
+and [=map/values=] are [=Blob URL Entries=].
+
+A <dfn>Blob URL Entry</dfn> consists of
+an <dfn for="Blob URL Entry">object</dfn> (typically a {{Blob}},
+but other specs can extend this to refer to other types of objects),
+and an <dfn for="Blob URL Entry">environment</dfn> (an [=environment settings object=]).
+
+[=map/Keys=] in the [=Blob URL Store=] (also known as <dfn lt="Blob URL" export>Blob URLs</dfn>)
+are [=valid URL strings=] that when [=URL parser|parsed=]

Has someone walked through blob URLs through the URL parser steps?

>From a skim, I don't see how the host and path end up as as the origin and UUID as this states. Maybe there's a pending change for URL? Or maybe I'm just missing it.

>  
 1. Let |result| be the empty string.
-  Append the string "blob"
-  (that is, the Unicode code point sequence U+0062, U+006C, U+006F, U+0062)
+1. Append the string "blob"
+  (that is, the Unicode [=code point=] sequence U+0062, U+006C, U+006F, U+0062)

nit: can drop 'Unicode', I don't think we need to call that out everywhere and it's in the definition of code point.

>  1. Let |settings| be the [=current settings object=]
 1. Let |origin| be |settings|'s [=environment settings object/origin=].
 1. Let |serialized| be the <a lt="ASCII serialization of an origin">ASCII serialization</a> of |origin|.
 1. If |serialized| is "null", set it to an implementation-defined value.
 1. Append |serialized| to |result|.
-1. Append the "/" character (U+0024 SOLIDUS) to |result|.
-1. Generate a UUID [[RFC4122]] as a Unicode string and append it to |result|.
+1. Append U+0024 SOLIDUS (/) to |result|.
+1. Generate a UUID [[!RFC4122]] as a Unicode string and append it to |result|.

nit: "Unicode string" can just be "string"

> -If a resource identified with a <a>Blob URL</a> is a {{File}} object,
-user agents use that file's {{File/name}} attribute,
-as if the [=/response=] had a <code>Content-Disposition</code> header
-with the filename parameter set to the {{File}}'s {{File/name}} attribute [[!RFC6266]].
-
-Note: A corollary to this is a non-normative implementation guideline:
-that the "File Save As" user interface in user agents takes into account the {{File}}'s {{File/name}} attribute
-if presenting a default name to save the file as.
-
-<h4 id="NetworkError">
-Network Errors</h4>
-
-Responses that do not succeed with a <a href="#TwoHundredOK">200 OK</a>
-act as if a <a>network error</a> has occurred.
-Network errors are used when:
+Issue: This more or less matches chrome's behavior,

nit: capitalize "Chrome" if this is going to land.

>  
-This section provides sample exchanges between web applications and user agents using <a>Blob URLs</a>.
-A [=/request=] can be triggered using HTML markup of the sort
-<code class="lang-markup">&lt;img src="blob:http://example.org:8080/550e8400-e29b-41d4-a716-446655440000"></code>.
-These examples merely illustrate the [=/request=] and [=/response=];
-web developers are not likely to interact with all the headers,
-but the {{XMLHttpRequest/getAllResponseHeaders()}} method of {{XMLHttpRequest}}, if used,
-will show relevant [=/response=] headers.
+1. [=Assert=]: |url|'s [=url/scheme=] is <code>"blob"</code>.
+1. Let |entry| be the result of [=Blob URL/resolve|resolving=] |url|.
+1. If |entry| is not undefined, return |entry|'s [=Blob URL Entry/environment=]'s [=environment settings object/origin=].
+1. Let |nested url| be the result of [=URL parser|parsing=] |url|'s [=url/path=][0].

What's the `[0]` ?

Also, isn't url/path the UUID and url/host is the serialized origin?

>  
 <h3 id="creating-revoking">
 Creating and Revoking a Blob URL</h3>
 
 <a>Blob URLs</a> are created and revoked using methods exposed on the {{URL}} object,
-supported by global objects {{Window}} [[HTML]] and {{WorkerGlobalScope}} [[Web Workers]].
+supported by global objects {{Window}} and {{WorkerGlobalScope}}.

Is this "supported by...." sentence fragment even necessary? 

And maybe "static methods" as used above?

> -      <code>window2</code> could be an <{iframe}> inside <code>window1</code>.
-
-      <pre class="lang-javascript">
-        myurl = window1.URL.createObjectURL(myblob);
-        window2.URL.revokeObjectURL(myurl);
-      </pre>
-
-      Since <code>window1</code> and <code>window2</code> are in the <a>same origin</a>
-      and share the same <a>Blob URL Store</a>,
-      the <code>URL.{{revokeObjectURL()}}</code> call
-      ensures that subsequent dereferencing of <code>myurl</code>
-      results in a the user agent acting as if a <a>network error</a> has occurred.
-    </div>
-</dl>
+1. Let |url| be the result of [=adding an entry to the Blob URL Store=] for |blob|.
+4. Return |url|.

nit: `1.`

> -      Since <code>window1</code> and <code>window2</code> are in the <a>same origin</a>
-      and share the same <a>Blob URL Store</a>,
-      the <code>URL.{{revokeObjectURL()}}</code> call
-      ensures that subsequent dereferencing of <code>myurl</code>
-      results in a the user agent acting as if a <a>network error</a> has occurred.
-    </div>
-</dl>
+1. Let |url| be the result of [=adding an entry to the Blob URL Store=] for |blob|.
+4. Return |url|.
+
+</div>
+
+<div algorithm="revokeObjectURL">
+The <dfn method for=URL id="dfn-revokeObjectURL">revokeObjectURL(|url|)</dfn> static method must run these steps:
+
+1. [=Remove an entry from the Blob URL Store=] for |url|.

I'm assuming these steps are still being worked on? Looks like this is incomplete. (Redundant first/last steps, FIXME, etc)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/pull/92#pullrequestreview-81029500

Received on Tuesday, 5 December 2017 00:29:09 UTC