<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement WebAssembly module parser"
   href="https://bugs.webkit.org/show_bug.cgi?id=147293#c7">Comment # 7</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement WebAssembly module parser"
   href="https://bugs.webkit.org/show_bug.cgi?id=147293">bug 147293</a>
              from <span class="vcard"><a class="email" href="mailto:sukolsak&#64;gmail.com" title="Sukolsak Sakshuwong &lt;sukolsak&#64;gmail.com&gt;"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
        <pre>Thank you for the review.

(In reply to <a href="show_bug.cgi?id=147293#c3">comment #3</a>)
<span class="quote">&gt; Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=257558&amp;action=diff" name="attach_257558" title="Patch">attachment 257558</a> <a href="attachment.cgi?id=257558&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=257558&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=257558&amp;action=review</a>
&gt; 
&gt; r=me with some mixups
&gt; 
&gt; &gt; Source/JavaScriptCore/parser/SourceProvider.h:90
&gt; &gt; +#if ENABLE(WEBASSEMBLY)
&gt; &gt; +        virtual bool isStringSource() const override
&gt; &gt; +        {
&gt; &gt; +            return true;
&gt; &gt; +        }
&gt; &gt; +#endif
&gt; 
&gt; SourceProvider has a subclass named &quot;StringSourceProvider&quot;. This function is
&gt; too easily confused with that class. 
&gt; 
&gt; For now, I think you should remove this function. Instead of performing an
&gt; isStringSource() check, I think you should just go with the [WebAssembly
&gt; Source] source string you've provided. In the future, we'll have to see what
&gt; the spec says about toString on a WebAssembly function.</span >

I originally named it isStringSourceProvider() but renamed it to isStringSource() after realizing that OpaqueJSScript was another subclass of SourceProvider that should have this method return true.

The reason I used this method was that SourceCode::toUTF8() returns &quot;m_provider-&gt;source().impl()-&gt;utf8ForRange(m_startChar, m_endChar - m_startChar)&quot;. This will crash if source() is &quot;[WebAssembly source]&quot; and m_startChar and m_endChar are out of range. Come to think of it, maybe I shouldn't have m_startChar and m_endChar out of range in the first place.

<span class="quote">&gt; &gt; Source/JavaScriptCore/wasm/WASMFormat.h:33
&gt; &gt; +static const uint32_t wasmMagicNumber = 0x6d736177;
&gt; 
&gt; This file should be named WASMMagicNumber.h.</span >

This file will have more constants and enums that define the WASM file format. It will be very similar to &lt;<a href="https://github.com/WebAssembly/polyfill-prototype-1/blob/master/src/shared.h">https://github.com/WebAssembly/polyfill-prototype-1/blob/master/src/shared.h</a>&gt; Should I rename it to WASMMagicNumber.h for now? Or maybe WASMConstants.h?</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>