Re: [whatwg/fetch] Skip unnecessary checks when we have a preloaded response candidate in main fetch (PR #1803)

@annevk commented on this pull request.

Looking at this one concern I have is that we preload for X and fulfill for Y. Is that possible? Can I preload something pretending it's going to be used as an image but then have it execute as a script?

cc @noamr 

> @@ -4480,19 +4480,25 @@ steps:
 
  <li><p>Let <var>response</var> be null.
 
- <li><p>If <var>request</var>'s <a>local-URLs-only flag</a> is set and <var>request</var>'s
- <a for=request>current URL</a> is not <a lt="is local">local</a>, then set <var>response</var> to a
- <a>network error</a>.
+ <li>
+   <p>If <var>fetchParams</var>'s <a for="fetch params">preloaded response candidate</a> is null, then:
+   <ol>
+     <li><p>If <var>request</var>'s <a>local-URLs-only flag</a> is set and <var>request</var>'s

Single-space indentation.

> @@ -4480,19 +4480,25 @@ steps:
 
  <li><p>Let <var>response</var> be null.
 
- <li><p>If <var>request</var>'s <a>local-URLs-only flag</a> is set and <var>request</var>'s
- <a for=request>current URL</a> is not <a lt="is local">local</a>, then set <var>response</var> to a
- <a>network error</a>.
+ <li>
+   <p>If <var>fetchParams</var>'s <a for="fetch params">preloaded response candidate</a> is null, then:

```suggestion
   <p>If <var>fetchParams</var>'s <a for="fetch params">preloaded response candidate</a> is null:
```

>  
- <li><p>If <a lt="block bad port">should <var>request</var> be blocked due to a bad port</a>,
- <a lt="should fetching request be blocked as mixed content?">should fetching <var>request</var> be blocked as mixed content</a>, or
- <a lt="should request be blocked by Content Security Policy?">should <var>request</var> be blocked by Content Security Policy</a>
+ <li><p>If <a lt="should fetching request be blocked as mixed content?">should fetching <var>request</var> be blocked as mixed content</a>

The `<a>` should be on its own line due to its length.

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

Message ID: <whatwg/fetch/pull/1803/review/2562842914@github.com>

Received on Monday, 20 January 2025 16:53:55 UTC