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 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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;"); | 2382 CompileRun("ReferenceError.prototype.constructor.name = void 0;"); |
2383 CompileRun("asdf;"); | 2383 CompileRun("asdf;"); |
2384 CompileRun("ReferenceError.prototype.constructor = void 0;"); | 2384 CompileRun("ReferenceError.prototype.constructor = void 0;"); |
2385 CompileRun("asdf;"); | 2385 CompileRun("asdf;"); |
| 2386 CompileRun("ReferenceError.prototype.__proto__ = new Object();"); |
| 2387 CompileRun("asdf;"); |
| 2388 CompileRun("ReferenceError.prototype = new Object();"); |
| 2389 CompileRun("asdf;"); |
2386 v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }"); | 2390 v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }"); |
2387 CHECK(string->Equals(v8_str("Whoops"))); | 2391 CHECK(string->Equals(v8_str("Whoops"))); |
2388 v8::V8::RemoveMessageListeners(check_message); | 2392 v8::V8::RemoveMessageListeners(check_message); |
2389 } | 2393 } |
2390 | 2394 |
2391 | 2395 |
2392 static void receive_message(v8::Handle<v8::Message> message, | 2396 static void receive_message(v8::Handle<v8::Message> message, |
2393 v8::Handle<v8::Value> data) { | 2397 v8::Handle<v8::Value> data) { |
2394 message->Get(); | 2398 message->Get(); |
2395 message_received = true; | 2399 message_received = true; |
(...skipping 9805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12201 v8::Context::Scope context_scope(context.local()); | 12205 v8::Context::Scope context_scope(context.local()); |
12202 | 12206 |
12203 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 12207 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
12204 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 12208 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
12205 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 12209 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
12206 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 12210 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
12207 "var result = []; for (var k in o) result.push(k); result")); | 12211 "var result = []; for (var k in o) result.push(k); result")); |
12208 CHECK_EQ(1, result->Length()); | 12212 CHECK_EQ(1, result->Length()); |
12209 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 12213 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
12210 } | 12214 } |
OLD | NEW |