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

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

Issue 688813002: Reverting r25015 and r25016 for broken build. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8529 matching lines...) Expand 10 before | Expand all | Expand 10 after
8540 v8::Handle<String> foo = v8_str("foo"); 8540 v8::Handle<String> foo = v8_str("foo");
8541 v8::Handle<String> message = v8_str("message"); 8541 v8::Handle<String> message = v8_str("message");
8542 v8::Handle<Value> error = v8::Exception::Error(foo); 8542 v8::Handle<Value> error = v8::Exception::Error(foo);
8543 CHECK(error->IsObject()); 8543 CHECK(error->IsObject());
8544 CHECK(error.As<v8::Object>()->Get(message)->Equals(foo)); 8544 CHECK(error.As<v8::Object>()->Get(message)->Equals(foo));
8545 info.GetIsolate()->ThrowException(error); 8545 info.GetIsolate()->ThrowException(error);
8546 info.GetReturnValue().SetUndefined(); 8546 info.GetReturnValue().SetUndefined();
8547 } 8547 }
8548 8548
8549 8549
8550 THREADED_TEST(ExceptionGetMessage) { 8550 THREADED_TEST(ExceptionGetStackTrace) {
8551 LocalContext context; 8551 LocalContext context;
8552 v8::HandleScope scope(context->GetIsolate()); 8552 v8::HandleScope scope(context->GetIsolate());
8553 8553
8554 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); 8554 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true);
8555 8555
8556 Local<v8::FunctionTemplate> fun = 8556 Local<v8::FunctionTemplate> fun =
8557 v8::FunctionTemplate::New(context->GetIsolate(), ThrowV8Exception); 8557 v8::FunctionTemplate::New(context->GetIsolate(), ThrowV8Exception);
8558 v8::Local<v8::Object> global = context->Global(); 8558 v8::Local<v8::Object> global = context->Global();
8559 global->Set(v8_str("throwV8Exception"), fun->GetFunction()); 8559 global->Set(v8_str("throwV8Exception"), fun->GetFunction());
8560 8560
8561 TryCatch try_catch; 8561 TryCatch try_catch;
8562 CompileRun( 8562 CompileRun("function f1() { throwV8Exception(); }; f1();");
8563 "function f1() {\n"
8564 " throwV8Exception();\n"
8565 "};\n"
8566 "f1();");
8567 CHECK(try_catch.HasCaught()); 8563 CHECK(try_catch.HasCaught());
8568 8564
8569 v8::Handle<v8::Value> error = try_catch.Exception(); 8565 v8::Handle<v8::Value> error = try_catch.Exception();
8570 v8::Handle<String> foo_str = v8_str("foo"); 8566 v8::Handle<String> foo = v8_str("foo");
8571 v8::Handle<String> message_str = v8_str("message"); 8567 v8::Handle<String> message = v8_str("message");
8572 CHECK(error->IsObject()); 8568 CHECK(error->IsObject());
8573 CHECK(error.As<v8::Object>()->Get(message_str)->Equals(foo_str)); 8569 CHECK(error.As<v8::Object>()->Get(message)->Equals(foo));
8574 8570
8575 v8::Handle<v8::Message> message = v8::Exception::GetMessage(error); 8571 v8::Handle<v8::StackTrace> stackTrace = v8::Exception::GetStackTrace(error);
8576 CHECK(!message.IsEmpty());
8577 CHECK_EQ(2, message->GetLineNumber());
8578 CHECK_EQ(2, message->GetStartColumn());
8579
8580 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
8581 CHECK(!stackTrace.IsEmpty()); 8572 CHECK(!stackTrace.IsEmpty());
8582 CHECK_EQ(2, stackTrace->GetFrameCount()); 8573 CHECK_EQ(2, stackTrace->GetFrameCount());
8583 8574
8584 v8::V8::SetCaptureStackTraceForUncaughtExceptions(false); 8575 v8::V8::SetCaptureStackTraceForUncaughtExceptions(false);
8585 } 8576 }
8586 8577
8587 8578
8588 static void YGetter(Local<String> name, 8579 static void YGetter(Local<String> name,
8589 const v8::PropertyCallbackInfo<v8::Value>& info) { 8580 const v8::PropertyCallbackInfo<v8::Value>& info) {
8590 ApiTestFuzzer::Fuzz(); 8581 ApiTestFuzzer::Fuzz();
(...skipping 9284 matching lines...) Expand 10 before | Expand all | Expand 10 after
17875 int promise_reject_counter = 0; 17866 int promise_reject_counter = 0;
17876 int promise_revoke_counter = 0; 17867 int promise_revoke_counter = 0;
17877 int promise_reject_line_number = -1; 17868 int promise_reject_line_number = -1;
17878 int promise_reject_frame_count = -1; 17869 int promise_reject_frame_count = -1;
17879 17870
17880 void PromiseRejectCallback(v8::PromiseRejectMessage message) { 17871 void PromiseRejectCallback(v8::PromiseRejectMessage message) {
17881 if (message.GetEvent() == v8::kPromiseRejectWithNoHandler) { 17872 if (message.GetEvent() == v8::kPromiseRejectWithNoHandler) {
17882 promise_reject_counter++; 17873 promise_reject_counter++;
17883 CcTest::global()->Set(v8_str("rejected"), message.GetPromise()); 17874 CcTest::global()->Set(v8_str("rejected"), message.GetPromise());
17884 CcTest::global()->Set(v8_str("value"), message.GetValue()); 17875 CcTest::global()->Set(v8_str("value"), message.GetValue());
17885 v8::Handle<v8::StackTrace> stack_trace = 17876 v8::Handle<v8::StackTrace> stack_trace = message.GetStackTrace();
17886 v8::Exception::GetMessage(message.GetValue())->GetStackTrace();
17887 if (!stack_trace.IsEmpty()) { 17877 if (!stack_trace.IsEmpty()) {
17888 promise_reject_frame_count = stack_trace->GetFrameCount(); 17878 promise_reject_frame_count = stack_trace->GetFrameCount();
17889 if (promise_reject_frame_count > 0) { 17879 if (promise_reject_frame_count > 0) {
17890 CHECK(stack_trace->GetFrame(0)->GetScriptName()->Equals(v8_str("pro"))); 17880 CHECK(stack_trace->GetFrame(0)->GetScriptName()->Equals(v8_str("pro")));
17891 promise_reject_line_number = stack_trace->GetFrame(0)->GetLineNumber(); 17881 promise_reject_line_number = stack_trace->GetFrame(0)->GetLineNumber();
17892 } else { 17882 } else {
17893 promise_reject_line_number = -1; 17883 promise_reject_line_number = -1;
17894 } 17884 }
17895 } 17885 }
17896 } else { 17886 } else {
17897 promise_revoke_counter++; 17887 promise_revoke_counter++;
17898 CcTest::global()->Set(v8_str("revoked"), message.GetPromise()); 17888 CcTest::global()->Set(v8_str("revoked"), message.GetPromise());
17899 CHECK(message.GetValue().IsEmpty()); 17889 CHECK(message.GetValue().IsEmpty());
17890 CHECK(message.GetStackTrace().IsEmpty());
17900 } 17891 }
17901 } 17892 }
17902 17893
17903 17894
17904 v8::Handle<v8::Promise> GetPromise(const char* name) { 17895 v8::Handle<v8::Promise> GetPromise(const char* name) {
17905 return v8::Handle<v8::Promise>::Cast(CcTest::global()->Get(v8_str(name))); 17896 return v8::Handle<v8::Promise>::Cast(CcTest::global()->Get(v8_str(name)));
17906 } 17897 }
17907 17898
17908 17899
17909 v8::Handle<v8::Value> RejectValue() { 17900 v8::Handle<v8::Value> RejectValue() {
(...skipping 6135 matching lines...) Expand 10 before | Expand all | Expand 10 after
24045 char chunk2[] = 24036 char chunk2[] =
24046 "XX\xec\x92\x81r = 13;\n" 24037 "XX\xec\x92\x81r = 13;\n"
24047 " return foob\xec\x92\x81\xec\x92\x81r;\n" 24038 " return foob\xec\x92\x81\xec\x92\x81r;\n"
24048 "}\n"; 24039 "}\n";
24049 chunk1[strlen(chunk1) - 1] = reference[0]; 24040 chunk1[strlen(chunk1) - 1] = reference[0];
24050 chunk2[0] = reference[1]; 24041 chunk2[0] = reference[1];
24051 chunk2[1] = reference[2]; 24042 chunk2[1] = reference[2];
24052 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; 24043 const char* chunks[] = {chunk1, chunk2, "foo();", NULL};
24053 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); 24044 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8);
24054 } 24045 }
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698