OLD | NEW |
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 Loading... |
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 |
| 24873 v8::ScriptOrigin source_script( |
| 24874 v8_str("http://some-resource.net/"), Local<v8::Integer>(), |
| 24875 Local<v8::Integer>(), Local<Boolean>(), Local<v8::Integer>(), |
| 24876 Local<Boolean>(), Local<Value>(), Local<Boolean>(), |
| 24877 v8::False(CcTest::isolate())); |
| 24878 |
| 24879 // Case 1: An inline script. |
| 24880 { |
| 24881 v8::MaybeLocal<v8::Script> script = |
| 24882 v8::Script::Compile(context.local(), v8_str(source), &inline_script); |
| 24883 CHECK(!script.IsEmpty()); |
| 24884 CHECK_EQ(4, script.ToLocalChecked() |
| 24885 ->Run(context.local()) |
| 24886 .ToLocalChecked() |
| 24887 ->Int32Value(context.local()) |
| 24888 .FromJust()); |
| 24889 } |
| 24890 |
| 24891 // Case 2: Js source file. |
| 24892 { |
| 24893 v8::MaybeLocal<v8::Script> script = |
| 24894 v8::Script::Compile(context.local(), v8_str(source), &source_script); |
| 24895 CHECK(script.IsEmpty()); |
| 24896 } |
| 24897 } |
OLD | NEW |