OLD | NEW |
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 9504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9515 // return false and keep VM in sane state. | 9515 // return false and keep VM in sane state. |
9516 v8::TryCatch try_catch; | 9516 v8::TryCatch try_catch; |
9517 CHECK(!o1->SetPrototype(o0)); | 9517 CHECK(!o1->SetPrototype(o0)); |
9518 CHECK(!try_catch.HasCaught()); | 9518 CHECK(!try_catch.HasCaught()); |
9519 ASSERT(!i::Isolate::Current()->has_pending_exception()); | 9519 ASSERT(!i::Isolate::Current()->has_pending_exception()); |
9520 | 9520 |
9521 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); | 9521 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); |
9522 } | 9522 } |
9523 | 9523 |
9524 | 9524 |
| 9525 THREADED_TEST(FunctionRemovePrototype) { |
| 9526 LocalContext context; |
| 9527 v8::HandleScope handle_scope(context->GetIsolate()); |
| 9528 |
| 9529 Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); |
| 9530 t1->RemovePrototype(); |
| 9531 Local<v8::Function> fun = t1->GetFunction(); |
| 9532 context->Global()->Set(v8_str("fun"), fun); |
| 9533 CHECK(!CompileRun("'prototype' in fun")->BooleanValue()); |
| 9534 |
| 9535 v8::TryCatch try_catch; |
| 9536 CompileRun("new fun()"); |
| 9537 CHECK(try_catch.HasCaught()); |
| 9538 |
| 9539 try_catch.Reset(); |
| 9540 fun->NewInstance(); |
| 9541 CHECK(try_catch.HasCaught()); |
| 9542 } |
| 9543 |
| 9544 |
9525 THREADED_TEST(GetterSetterExceptions) { | 9545 THREADED_TEST(GetterSetterExceptions) { |
9526 LocalContext context; | 9546 LocalContext context; |
9527 v8::HandleScope handle_scope(context->GetIsolate()); | 9547 v8::HandleScope handle_scope(context->GetIsolate()); |
9528 CompileRun( | 9548 CompileRun( |
9529 "function Foo() { };" | 9549 "function Foo() { };" |
9530 "function Throw() { throw 5; };" | 9550 "function Throw() { throw 5; };" |
9531 "var x = { };" | 9551 "var x = { };" |
9532 "x.__defineSetter__('set', Throw);" | 9552 "x.__defineSetter__('set', Throw);" |
9533 "x.__defineGetter__('get', Throw);"); | 9553 "x.__defineGetter__('get', Throw);"); |
9534 Local<v8::Object> x = | 9554 Local<v8::Object> x = |
(...skipping 10632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20167 CheckCorrectThrow("%HasProperty(other, 'x')"); | 20187 CheckCorrectThrow("%HasProperty(other, 'x')"); |
20168 CheckCorrectThrow("%HasElement(other, 1)"); | 20188 CheckCorrectThrow("%HasElement(other, 1)"); |
20169 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); | 20189 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); |
20170 CheckCorrectThrow("%GetPropertyNames(other)"); | 20190 CheckCorrectThrow("%GetPropertyNames(other)"); |
20171 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); | 20191 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); |
20172 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" | 20192 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" |
20173 "other, 'x', null, null, 1)"); | 20193 "other, 'x', null, null, 1)"); |
20174 } | 20194 } |
20175 | 20195 |
20176 #endif // WIN32 | 20196 #endif // WIN32 |
OLD | NEW |