title: Android webview - single line javascript comments causing Uncaught SyntaxError errors?
body: <p>I am trying to load the following html as a string into a webview:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;script&gt;
        function foo() {
          // test.
        }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;p&gt;hi.&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  
  ------------------------------
  
  String content = readAboveContentIntoString();
  WebView webview = ...;
  webview.loadData(content, "text/html", "utf-8");
  </code></pre>
  
  <p>I get the following message from the webview console:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected end of input
  </code></pre>
  
  <p>If I remove the "// test." comment, I don't get the syntax error. It's as if the webview is stripping newlines, and so the function body is applying the comment to the closing brace like so:</p>
  
  <pre><code>function foo() { // test. }
  </code></pre>
  
  <p>Can anyone else repro this? I thought maybe my readAboveContentIntoString() was stripping newlines, but tested and it is not. I'm using android 4.4.4.</p>
  
  <p>Thanks</p>
  
  <p>-- Edit ---</p>
  
  <p>Also, a block comment works fine in place of the line comment:</p>
  
  <pre><code>/* test. */
  </code></pre>