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 21747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21758 | 21758 |
21759 // Running the script exposes the error. | 21759 // Running the script exposes the error. |
21760 v8::Handle<Value> result(script->Run()); | 21760 v8::Handle<Value> result(script->Run()); |
21761 CHECK(result.IsEmpty()); | 21761 CHECK(result.IsEmpty()); |
21762 CHECK(try_catch.HasCaught()); | 21762 CHECK(try_catch.HasCaught()); |
21763 delete[] full_source; | 21763 delete[] full_source; |
21764 } | 21764 } |
21765 | 21765 |
21766 | 21766 |
21767 void TestInvalidCacheData(v8::ScriptCompiler::CompileOptions option) { | 21767 void TestInvalidCacheData(v8::ScriptCompiler::CompileOptions option) { |
21768 const char* garbage = "garbage garbage garbage garbage."; | 21768 const char* garbage = "garbage garbage garbage garbage garbage garbage"; |
21769 const uint8_t* data = reinterpret_cast<const uint8_t*>(garbage); | 21769 const uint8_t* data = reinterpret_cast<const uint8_t*>(garbage); |
21770 int length = 16; | 21770 int length = 16; |
21771 v8::ScriptCompiler::CachedData* cached_data = | 21771 v8::ScriptCompiler::CachedData* cached_data = |
21772 new v8::ScriptCompiler::CachedData(data, length); | 21772 new v8::ScriptCompiler::CachedData(data, length); |
21773 DCHECK(!cached_data->rejected); | 21773 DCHECK(!cached_data->rejected); |
21774 v8::ScriptOrigin origin(v8_str("origin")); | 21774 v8::ScriptOrigin origin(v8_str("origin")); |
21775 v8::ScriptCompiler::Source source(v8_str("42"), origin, cached_data); | 21775 v8::ScriptCompiler::Source source(v8_str("42"), origin, cached_data); |
21776 v8::Handle<v8::Script> script = | 21776 v8::Handle<v8::Script> script = |
21777 v8::ScriptCompiler::Compile(CcTest::isolate(), &source, option); | 21777 v8::ScriptCompiler::Compile(CcTest::isolate(), &source, option); |
21778 CHECK(cached_data->rejected); | 21778 CHECK(cached_data->rejected); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21977 "bar2.js"); | 21977 "bar2.js"); |
21978 } | 21978 } |
21979 | 21979 |
21980 | 21980 |
21981 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 21981 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
21982 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 21982 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
21983 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 21983 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
21984 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 21984 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
21985 "bar2.js"); | 21985 "bar2.js"); |
21986 } | 21986 } |
OLD | NEW |