| Index: test/cctest/test-api.cc | 
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc | 
| index dab80d7c33cbd5259ab28b43ec9cd7633bb88737..2c02ceb916bba89275a758500a853379feaaa2aa 100644 | 
| --- a/test/cctest/test-api.cc | 
| +++ b/test/cctest/test-api.cc | 
| @@ -24858,3 +24858,40 @@ TEST(Proxy) { | 
| CHECK(proxy->GetTarget()->SameValue(target)); | 
| CHECK(proxy->GetHandler()->IsNull()); | 
| } | 
| + | 
| +TEST(HTMLCommentInJavascript) { | 
| +  // Regression test for crbug.com/573887. | 
| +  LocalContext context; | 
| +  v8::HandleScope scope(CcTest::isolate()); | 
| + | 
| +  // Inline scripts - i.e. the contents of <script> tags - need to obey HTML | 
| +  // comments, but JS sources - i.e., everything else - shouldn't. | 
| +  const char* source = "<!--\n var result = 2 + 2;\n-->\n result"; | 
| + | 
| +  v8::ScriptOrigin inline_script(v8_str("")); | 
| + | 
| +  v8::ScriptOrigin source_script( | 
| +      v8_str("http://some-resource.net/"), Local<v8::Integer>(), | 
| +      Local<v8::Integer>(), Local<Boolean>(), Local<v8::Integer>(), | 
| +      Local<Boolean>(), Local<Value>(), Local<Boolean>(), | 
| +      v8::False(CcTest::isolate())); | 
| + | 
| +  // Case 1: An inline script. | 
| +  { | 
| +    v8::MaybeLocal<v8::Script> script = | 
| +        v8::Script::Compile(context.local(), v8_str(source), &inline_script); | 
| +    CHECK(!script.IsEmpty()); | 
| +    CHECK_EQ(4, script.ToLocalChecked() | 
| +                    ->Run(context.local()) | 
| +                    .ToLocalChecked() | 
| +                    ->Int32Value(context.local()) | 
| +                    .FromJust()); | 
| +  } | 
| + | 
| +  // Case 2: Js source file. | 
| +  { | 
| +    v8::MaybeLocal<v8::Script> script = | 
| +        v8::Script::Compile(context.local(), v8_str(source), &source_script); | 
| +    CHECK(script.IsEmpty()); | 
| +  } | 
| +} | 
|  |