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

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

Issue 1157563005: Do not eagerly convert exception to string when creating a message object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: test case Created 5 years, 7 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 4780 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 "ReferenceError.prototype.constructor.name = 1;" 4791 "ReferenceError.prototype.constructor.name = 1;"
4792 "Number.prototype.toString = function() { return 'Whoops'; };" 4792 "Number.prototype.toString = function() { return 'Whoops'; };"
4793 "ReferenceError.prototype.toString = Object.prototype.toString;"); 4793 "ReferenceError.prototype.toString = Object.prototype.toString;");
4794 CompileRun("asdf;"); 4794 CompileRun("asdf;");
4795 v8::V8::RemoveMessageListeners(check_reference_error_message); 4795 v8::V8::RemoveMessageListeners(check_reference_error_message);
4796 } 4796 }
4797 4797
4798 4798
4799 static void check_custom_error_tostring(v8::Handle<v8::Message> message, 4799 static void check_custom_error_tostring(v8::Handle<v8::Message> message,
4800 v8::Handle<v8::Value> data) { 4800 v8::Handle<v8::Value> data) {
4801 const char* uncaught_error = "Uncaught MyError toString"; 4801 const char* uncaught_error = "[object Object]";
4802 CHECK(message->Get()->Equals(v8_str(uncaught_error))); 4802 CHECK(message->Get()->Equals(v8_str(uncaught_error)));
4803 } 4803 }
4804 4804
4805 4805
4806 TEST(CustomErrorToString) { 4806 TEST(CustomErrorToString) {
4807 LocalContext context; 4807 LocalContext context;
4808 v8::HandleScope scope(context->GetIsolate()); 4808 v8::HandleScope scope(context->GetIsolate());
4809 v8::V8::AddMessageListener(check_custom_error_tostring); 4809 v8::V8::AddMessageListener(check_custom_error_tostring);
4810 CompileRun( 4810 CompileRun(
4811 "function MyError(name, message) { " 4811 "function MyError(name, message) { "
(...skipping 16305 matching lines...) Expand 10 before | Expand all | Expand 10 after
21117 // add the testExtraShouldReturnFive export 21117 // add the testExtraShouldReturnFive export
21118 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); 21118 v8::Local<v8::Object> exports = env->GetExtrasExportsObject();
21119 21119
21120 auto func = 21120 auto func =
21121 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); 21121 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
21122 auto undefined = v8::Undefined(isolate); 21122 auto undefined = v8::Undefined(isolate);
21123 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); 21123 auto result = func->Call(undefined, 0, {}).As<v8::Number>();
21124 21124
21125 CHECK(result->Value() == 5.0); 21125 CHECK(result->Value() == 5.0);
21126 } 21126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698