| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 } // namespace | 300 } // namespace |
| 301 | 301 |
| 302 TEST(Issue23768) { | 302 TEST(Issue23768) { |
| 303 v8::HandleScope scope(CcTest::isolate()); | 303 v8::HandleScope scope(CcTest::isolate()); |
| 304 v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate()); | 304 v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate()); |
| 305 env->Enter(); | 305 env->Enter(); |
| 306 | 306 |
| 307 SimpleExternalString source_ext_str("(function ext() {})();"); | 307 SimpleExternalString source_ext_str("(function ext() {})();"); |
| 308 v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str); | 308 v8::Local<v8::String> source = |
| 309 v8::String::NewExternal(CcTest::isolate(), &source_ext_str); |
| 309 // Script needs to have a name in order to trigger InitLineEnds execution. | 310 // Script needs to have a name in order to trigger InitLineEnds execution. |
| 310 v8::Handle<v8::String> origin = | 311 v8::Handle<v8::String> origin = |
| 311 v8::String::NewFromUtf8(CcTest::isolate(), "issue-23768-test"); | 312 v8::String::NewFromUtf8(CcTest::isolate(), "issue-23768-test"); |
| 312 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin); | 313 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin); |
| 313 CHECK(!evil_script.IsEmpty()); | 314 CHECK(!evil_script.IsEmpty()); |
| 314 CHECK(!evil_script->Run().IsEmpty()); | 315 CHECK(!evil_script->Run().IsEmpty()); |
| 315 i::Handle<i::ExternalTwoByteString> i_source( | 316 i::Handle<i::ExternalTwoByteString> i_source( |
| 316 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); | 317 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); |
| 317 // This situation can happen if source was an external string disposed | 318 // This situation can happen if source was an external string disposed |
| 318 // by its owner. | 319 // by its owner. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 329 | 330 |
| 330 TEST(LogCallbacks) { | 331 TEST(LogCallbacks) { |
| 331 ScopedLoggerInitializer initialize_logger; | 332 ScopedLoggerInitializer initialize_logger; |
| 332 Logger* logger = initialize_logger.logger(); | 333 Logger* logger = initialize_logger.logger(); |
| 333 | 334 |
| 334 v8::Local<v8::FunctionTemplate> obj = | 335 v8::Local<v8::FunctionTemplate> obj = |
| 335 v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(), | 336 v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(), |
| 336 v8::FunctionTemplate::New()); | 337 v8::FunctionTemplate::New()); |
| 337 obj->SetClassName(v8_str("Obj")); | 338 obj->SetClassName(v8_str("Obj")); |
| 338 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); | 339 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); |
| 339 v8::Local<v8::Signature> signature = v8::Signature::New(obj); | 340 v8::Local<v8::Signature> signature = |
| 341 v8::Signature::New(CcTest::isolate(), obj); |
| 340 proto->Set(v8_str("method1"), | 342 proto->Set(v8_str("method1"), |
| 341 v8::FunctionTemplate::New(ObjMethod1, | 343 v8::FunctionTemplate::New(ObjMethod1, |
| 342 v8::Handle<v8::Value>(), | 344 v8::Handle<v8::Value>(), |
| 343 signature), | 345 signature), |
| 344 static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 346 static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| 345 | 347 |
| 346 initialize_logger.env()->Global()->Set(v8_str("Obj"), obj->GetFunction()); | 348 initialize_logger.env()->Global()->Set(v8_str("Obj"), obj->GetFunction()); |
| 347 CompileRun("Obj.prototype.method1.toString();"); | 349 CompileRun("Obj.prototype.method1.toString();"); |
| 348 | 350 |
| 349 logger->LogCompiledFunctions(); | 351 logger->LogCompiledFunctions(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 v8::Local<v8::String> s = result->ToString(); | 480 v8::Local<v8::String> s = result->ToString(); |
| 479 i::ScopedVector<char> data(s->Utf8Length() + 1); | 481 i::ScopedVector<char> data(s->Utf8Length() + 1); |
| 480 CHECK_NE(NULL, data.start()); | 482 CHECK_NE(NULL, data.start()); |
| 481 s->WriteUtf8(data.start()); | 483 s->WriteUtf8(data.start()); |
| 482 printf("%s\n", data.start()); | 484 printf("%s\n", data.start()); |
| 483 // Make sure that our output is written prior crash due to CHECK failure. | 485 // Make sure that our output is written prior crash due to CHECK failure. |
| 484 fflush(stdout); | 486 fflush(stdout); |
| 485 CHECK(false); | 487 CHECK(false); |
| 486 } | 488 } |
| 487 } | 489 } |
| OLD | NEW |