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

Unified Diff: test/cctest/test-api.cc

Issue 6272004: Make the 'name' property on error prototypes read-only and dont-delete... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 6298)
+++ test/cctest/test-api.cc (working copy)
@@ -2288,6 +2288,30 @@
}
+static void check_reference_error_message(
+ v8::Handle<v8::Message> message,
+ v8::Handle<v8::Value> data) {
+ const char* reference_error = "Uncaught ReferenceError: asdf is not defined";
+ CHECK(message->Get()->Equals(v8_str(reference_error)));
+}
+
+
+// Test that overwritten toString methods are not invoked on uncaught
+// exception formatting. However, they are invoked when performing
+// normal error string conversions.
+THREADED_TEST(APIThrowMessageOverwrittenToString) {
+ v8::HandleScope scope;
+ v8::V8::AddMessageListener(check_reference_error_message);
+ LocalContext context;
+ CompileRun("ReferenceError.prototype.toString ="
+ " function() { return 'Whoops' }");
+ CompileRun("asdf;");
+ v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }");
+ CHECK(string->Equals(v8_str("Whoops")));
+ v8::V8::RemoveMessageListeners(check_message);
+}
+
+
static void receive_message(v8::Handle<v8::Message> message,
v8::Handle<v8::Value> data) {
message->Get();

Powered by Google App Engine
This is Rietveld 408576698