<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Decode data URLs in web process"
   href="https://bugs.webkit.org/show_bug.cgi?id=148128#c36">Comment # 36</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Decode data URLs in web process"
   href="https://bugs.webkit.org/show_bug.cgi?id=148128">bug 148128</a>
              from <span class="vcard"><a class="email" href="mailto:koivisto&#64;iki.fi" title="Antti Koivisto &lt;koivisto&#64;iki.fi&gt;"> <span class="fn">Antti Koivisto</span></a>
</span></b>
        <pre>
<span class="quote">&gt; I don’t think we need this constructor. We should just be able to write:
&gt; 
&gt;     std::make_unique&lt;DecodeTask&gt;({ ... });</span >

That wouldn't compile. More awkward version does:

    std::make_unique&lt;DecodeTask&gt;(DecodeTask { ... });


<span class="quote">&gt; &gt; Source/WebCore/platform/network/DataURLDecoder.cpp:68
&gt; &gt; +    ASSERT(urlString.startsWith(dataString));
&gt; 
&gt; This check needs to ignore ASCII case.</span >

I believe protocol part of URL is always converted to lowercase

<span class="quote">&gt; &gt; Source/WebCore/platform/network/DataURLDecoder.cpp:72
&gt; &gt; +    if (headerEnd == notFound)
&gt; &gt; +        return nullptr;
&gt; 
&gt; Do we have a test case that covers this?</span >

Probably not. We have some explicit data url test coverage and a ton of incidental coverage. It would be good to add a bunch of more systematic cases covering all the edges.

<span class="quote">&gt; &gt; Source/WebCore/platform/network/DataURLDecoder.h:49
&gt; &gt; +void decode(const URL&amp;, DecodeCompletionHandler);
&gt; 
&gt; Don’t functions sometimes have state and are thus expensive to copy? If so,
&gt; it might be nicer to take ownership of the completion handler rather than
&gt; passing it by value.</span >

std::function has efficient move constructor. I think we just need to use WTF::move in a few places? (instead of say DecodeCompletionHandler&amp;&amp;)

<span class="quote">&gt; &gt; Source/WebCore/platform/text/DecodeEscapeSequences.h:170
&gt; &gt; +            encodedRunPosition = length;
&gt; 
&gt; I’m not sure this line of code is needed. We intentionally made
&gt; encodedRunPosition a very large value so it doesn’t need to be explicitly
&gt; checked for. Using StringView::substring with it should work because it
&gt; clamps its arguments down to the length of the string. It’s even possible,
&gt; depending on how URLEscapeSequence::findEndOfRun is written, that we could
&gt; remove the if statement entirely.</span >

Ok. I didn't know that notFound value was intentionally chosen for this purpose.</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>