<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:achristensen&#64;apple.com" title="Alex Christensen &lt;achristensen&#64;apple.com&gt;"> <span class="fn">Alex Christensen</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add Link header support for preload."
   href="https://bugs.webkit.org/show_bug.cgi?id=165521">bug 165521</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #296683 Flags</td>
           <td>review?
           </td>
           <td>review-
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add Link header support for preload."
   href="https://bugs.webkit.org/show_bug.cgi?id=165521#c12">Comment # 12</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add Link header support for preload."
   href="https://bugs.webkit.org/show_bug.cgi?id=165521">bug 165521</a>
              from <span class="vcard"><a class="email" href="mailto:achristensen&#64;apple.com" title="Alex Christensen &lt;achristensen&#64;apple.com&gt;"> <span class="fn">Alex Christensen</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=296683&amp;action=diff" name="attach_296683" title="Patch">attachment 296683</a> <a href="attachment.cgi?id=296683&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=296683&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=296683&amp;action=review</a>

<span class="quote">&gt; Source/WebCore/loader/LinkHeader.cpp:39
&gt; +static bool isWhitespace(CharType chr)
&gt; +{
&gt; +    return (chr == ' ') || (chr == '\t');
&gt; +}</span >

This function should have a better name.  We probably already have a function that checks for tab or space.

<span class="quote">&gt; Source/WebCore/loader/LinkHeader.cpp:45
&gt; +static bool isValidURLChar(CharType chr)
&gt; +{
&gt; +    return !isWhitespace(chr) &amp;&amp; chr != '&gt;';
&gt; +}</span >

Why do we think a character is valid for a URL if it's not ' ', '\t' or '&gt;'?  URLs can have spaces and '&gt;', and they ignore tabs while parsing.

<span class="quote">&gt; Source/WebCore/loader/LinkLoader.cpp:161
&gt; +std::optional&lt;std::unique_ptr&lt;LinkPreloadResourceClient&gt;&gt; LinkLoader::preloadIfNeeded(const LinkRelAttribute&amp; relAttribute, const URL&amp; href, Document&amp; document, const String&amp; as,</span >

std::unique_ptr already has a value that indicates it is empty.  The std::optional seems excessive.

<span class="quote">&gt; Source/WebCore/loader/LinkLoader.cpp:162
&gt; +    const String&amp; crossOriginMode, LinkLoader* loader, LinkLoaderClient* client)</span >

This doesn't need to be on a new line.  Also, making client a pointer instead of a reference seems like a step in the wrong direction.  This function has one call site, and it could pass a reference.

<span class="quote">&gt; Source/WebCore/loader/LinkLoader.cpp:164
&gt; +    fprintf(stderr, &quot;preloadIfNeeded\n&quot;);</span >

Do we really want to print to stderr every time this function is called?

<span class="quote">&gt; LayoutTests/http/tests/preload/resources/download_resources_from_header.php:2
&gt; +header(&quot;Link: &lt;../resources/dummy.js&gt;; rel=preload; as=script&quot;, false);</span >

We need more tests with non-ASCII characters, invalid URLs, attempts at making CORS requests from link headers, null characters, vertical tabs, URLs with '&gt;' in them, etc.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>