Re: [whatwg/fetch] Partition Blob URL fetches by Storage Key (PR #1783)

@annevk commented on this pull request.

Thanks again for improving this aspect of `blob:` URLs!

>  
       <p class=note>The `<code>GET</code>` <a for=/>method</a> restriction serves no useful purpose
       other than being interoperable.
 
-     <li><p>Let <var>blob</var> be <var>blobURLEntry</var>'s <a for="blob URL entry">object</a>.
+     <li><p>Let <var>requestEnvironment</var> be the result of
+     <a for=request>determining the environment</a> given <var>request</var>.
+
+     <li><p>Let <var>isTopLevelNavigation</var> be true if <var>request</var>'s <a
+     for=request>destination</a> is "<code>document</code>"; otherwise, false.
+
+     <li><p>If <var>isTopLevelNavigation</var> is false and <var>requestEnvironment</var> is null,
+     then return a <a>network error</a>.
+
+     <li><p>Let <var>blob</var> be null.
+
+     <li><p>If <var>isTopLevelNavigation</var> is true, then set <var>blob</var> to the result of
+     <a href="https://w3c.github.io/FileAPI/#blob-url-obtain-object">obtaining a blob object</a>

Given that the File API PR landed we should be able to do this without `href`. Same below.

>  
       <p class=note>The `<code>GET</code>` <a for=/>method</a> restriction serves no useful purpose
       other than being interoperable.
 
-     <li><p>Let <var>blob</var> be <var>blobURLEntry</var>'s <a for="blob URL entry">object</a>.
+     <li><p>Let <var>requestEnvironment</var> be the result of
+     <a for=request>determining the environment</a> given <var>request</var>.
+
+     <li><p>Let <var>isTopLevelNavigation</var> be true if <var>request</var>'s <a
+     for=request>destination</a> is "<code>document</code>"; otherwise, false.
+
+     <li><p>If <var>isTopLevelNavigation</var> is false and <var>requestEnvironment</var> is null,
+     then return a <a>network error</a>.
+
+     <li><p>Let <var>blob</var> be null.
+
+     <li><p>If <var>isTopLevelNavigation</var> is true, then set <var>blob</var> to the result of
+     <a href="https://w3c.github.io/FileAPI/#blob-url-obtain-object">obtaining a blob object</a>
+     given <var>blobURLEntry</var> and the string "<code>navigation</code>".

I think it would be clearer to first initialize a variable called _navigationOrEnvironment_ and then invoke "obtaining a blob object" once. At least I find code written that way easier to follow.

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

Message ID: <whatwg/fetch/pull/1783/review/2485192317@github.com>

Received on Friday, 6 December 2024 15:58:40 UTC