OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 // Test that overwritten toString methods are not invoked on uncaught | 2372 // Test that overwritten toString methods are not invoked on uncaught |
2373 // exception formatting. However, they are invoked when performing | 2373 // exception formatting. However, they are invoked when performing |
2374 // normal error string conversions. | 2374 // normal error string conversions. |
2375 TEST(APIThrowMessageOverwrittenToString) { | 2375 TEST(APIThrowMessageOverwrittenToString) { |
2376 v8::HandleScope scope; | 2376 v8::HandleScope scope; |
2377 v8::V8::AddMessageListener(check_reference_error_message); | 2377 v8::V8::AddMessageListener(check_reference_error_message); |
2378 LocalContext context; | 2378 LocalContext context; |
2379 CompileRun("ReferenceError.prototype.toString =" | 2379 CompileRun("ReferenceError.prototype.toString =" |
2380 " function() { return 'Whoops' }"); | 2380 " function() { return 'Whoops' }"); |
2381 CompileRun("asdf;"); | 2381 CompileRun("asdf;"); |
| 2382 CompileRun("ReferenceError.prototype.constructor.name = void 0;"); |
| 2383 CompileRun("asdf;"); |
| 2384 CompileRun("ReferenceError.prototype.constructor = void 0;"); |
| 2385 CompileRun("asdf;"); |
2382 v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }"); | 2386 v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }"); |
2383 CHECK(string->Equals(v8_str("Whoops"))); | 2387 CHECK(string->Equals(v8_str("Whoops"))); |
2384 v8::V8::RemoveMessageListeners(check_message); | 2388 v8::V8::RemoveMessageListeners(check_message); |
2385 } | 2389 } |
2386 | 2390 |
2387 | 2391 |
2388 static void receive_message(v8::Handle<v8::Message> message, | 2392 static void receive_message(v8::Handle<v8::Message> message, |
2389 v8::Handle<v8::Value> data) { | 2393 v8::Handle<v8::Value> data) { |
2390 message->Get(); | 2394 message->Get(); |
2391 message_received = true; | 2395 message_received = true; |
(...skipping 9805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12197 v8::Context::Scope context_scope(context.local()); | 12201 v8::Context::Scope context_scope(context.local()); |
12198 | 12202 |
12199 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 12203 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
12200 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 12204 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
12201 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 12205 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
12202 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 12206 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
12203 "var result = []; for (var k in o) result.push(k); result")); | 12207 "var result = []; for (var k in o) result.push(k); result")); |
12204 CHECK_EQ(1, result->Length()); | 12208 CHECK_EQ(1, result->Length()); |
12205 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 12209 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
12206 } | 12210 } |
OLD | NEW |