Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: test/cctest/test-api.cc

Issue 1801203002: Parser: Make skipping HTML comments optional. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 24840 matching lines...) Expand 10 before | Expand all | Expand 10 after
24851 CHECK(proxy->GetTarget()->SameValue(target)); 24851 CHECK(proxy->GetTarget()->SameValue(target));
24852 CHECK(proxy->GetHandler()->SameValue(handler)); 24852 CHECK(proxy->GetHandler()->SameValue(handler));
24853 24853
24854 proxy->Revoke(); 24854 proxy->Revoke();
24855 CHECK(proxy->IsProxy()); 24855 CHECK(proxy->IsProxy());
24856 CHECK(!target->IsProxy()); 24856 CHECK(!target->IsProxy());
24857 CHECK(proxy->IsRevoked()); 24857 CHECK(proxy->IsRevoked());
24858 CHECK(proxy->GetTarget()->SameValue(target)); 24858 CHECK(proxy->GetTarget()->SameValue(target));
24859 CHECK(proxy->GetHandler()->IsNull()); 24859 CHECK(proxy->GetHandler()->IsNull());
24860 } 24860 }
24861
24862 TEST(HTMLCommentInJavascript) {
24863 // Regression test for crbug.com/573887.
24864 LocalContext context;
24865 v8::HandleScope scope(CcTest::isolate());
24866
24867 // Inline scripts - i.e. the contents of <script> tags - need to obey HTML
24868 // comments, but JS sources - i.e., everything else - shouldn't.
24869 const char* source = "<!--\n var result = 2 + 2;\n-->\n result";
24870
24871 v8::ScriptOrigin inline_script(v8_str(""));
24872 v8::ScriptOrigin source_script(v8_str("http://some-resource.net/"));
24873
24874 // Case 1: An inline script.
24875 {
24876 v8::MaybeLocal<v8::Script> script =
24877 v8::Script::Compile(context.local(), v8_str(source), &inline_script);
24878 CHECK(!script.IsEmpty());
24879 CHECK_EQ(4, script.ToLocalChecked()
24880 ->Run(context.local())
24881 .ToLocalChecked()
24882 ->Int32Value(context.local())
24883 .FromJust());
24884 }
24885
24886 // Case 2: Js source file.
24887 {
24888 v8::MaybeLocal<v8::Script> script =
24889 v8::Script::Compile(context.local(), v8_str(source), &source_script);
24890 CHECK(script.IsEmpty());
24891 }
24892 }
OLDNEW
« src/compiler.cc ('K') | « src/parsing/scanner.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698