<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:achristensen@apple.com" title="Alex Christensen <achristensen@apple.com>"> <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@apple.com" title="Alex Christensen <achristensen@apple.com>"> <span class="fn">Alex Christensen</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=296683&action=diff" name="attach_296683" title="Patch">attachment 296683</a> <a href="attachment.cgi?id=296683&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=296683&action=review">https://bugs.webkit.org/attachment.cgi?id=296683&action=review</a>
<span class="quote">> Source/WebCore/loader/LinkHeader.cpp:39
> +static bool isWhitespace(CharType chr)
> +{
> + return (chr == ' ') || (chr == '\t');
> +}</span >
This function should have a better name. We probably already have a function that checks for tab or space.
<span class="quote">> Source/WebCore/loader/LinkHeader.cpp:45
> +static bool isValidURLChar(CharType chr)
> +{
> + return !isWhitespace(chr) && chr != '>';
> +}</span >
Why do we think a character is valid for a URL if it's not ' ', '\t' or '>'? URLs can have spaces and '>', and they ignore tabs while parsing.
<span class="quote">> Source/WebCore/loader/LinkLoader.cpp:161
> +std::optional<std::unique_ptr<LinkPreloadResourceClient>> LinkLoader::preloadIfNeeded(const LinkRelAttribute& relAttribute, const URL& href, Document& document, const String& as,</span >
std::unique_ptr already has a value that indicates it is empty. The std::optional seems excessive.
<span class="quote">> Source/WebCore/loader/LinkLoader.cpp:162
> + const String& 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">> Source/WebCore/loader/LinkLoader.cpp:164
> + fprintf(stderr, "preloadIfNeeded\n");</span >
Do we really want to print to stderr every time this function is called?
<span class="quote">> LayoutTests/http/tests/preload/resources/download_resources_from_header.php:2
> +header("Link: <../resources/dummy.js>; rel=preload; as=script", 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 '>' 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>