| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4649 // must work for non-function receivers. | 4649 // must work for non-function receivers. |
| 4650 const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])"; | 4650 const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])"; |
| 4651 value = Script::Compile(v8_str(apply_99))->Run(); | 4651 value = Script::Compile(v8_str(apply_99))->Run(); |
| 4652 CHECK(!try_catch.HasCaught()); | 4652 CHECK(!try_catch.HasCaught()); |
| 4653 CHECK_EQ(99, value->Int32Value()); | 4653 CHECK_EQ(99, value->Int32Value()); |
| 4654 | 4654 |
| 4655 const char* call_17 = "Function.prototype.call.call(obj, this, 17)"; | 4655 const char* call_17 = "Function.prototype.call.call(obj, this, 17)"; |
| 4656 value = Script::Compile(v8_str(call_17))->Run(); | 4656 value = Script::Compile(v8_str(call_17))->Run(); |
| 4657 CHECK(!try_catch.HasCaught()); | 4657 CHECK(!try_catch.HasCaught()); |
| 4658 CHECK_EQ(17, value->Int32Value()); | 4658 CHECK_EQ(17, value->Int32Value()); |
| 4659 | |
| 4660 // Try something that will cause an exception: Call the object as a | |
| 4661 // constructor. This should be the last test. | |
| 4662 value = Script::Compile(v8_str("new obj(42)"))->Run(); | |
| 4663 CHECK(try_catch.HasCaught()); | |
| 4664 } | 4659 } |
| 4665 | 4660 |
| 4666 | 4661 |
| 4667 static int CountHandles() { | 4662 static int CountHandles() { |
| 4668 return v8::HandleScope::NumberOfHandles(); | 4663 return v8::HandleScope::NumberOfHandles(); |
| 4669 } | 4664 } |
| 4670 | 4665 |
| 4671 | 4666 |
| 4672 static int Recurse(int depth, int iterations) { | 4667 static int Recurse(int depth, int iterations) { |
| 4673 v8::HandleScope scope; | 4668 v8::HandleScope scope; |
| (...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6451 // the property | 6446 // the property |
| 6452 pass_on_get = false; | 6447 pass_on_get = false; |
| 6453 CHECK_EQ(3, global->Get(some_property)->Int32Value()); | 6448 CHECK_EQ(3, global->Get(some_property)->Int32Value()); |
| 6454 CHECK_EQ(1, force_set_set_count); | 6449 CHECK_EQ(1, force_set_set_count); |
| 6455 CHECK_EQ(5, force_set_get_count); | 6450 CHECK_EQ(5, force_set_get_count); |
| 6456 // The interceptor should also work for other properties | 6451 // The interceptor should also work for other properties |
| 6457 CHECK_EQ(3, global->Get(v8::String::New("b"))->Int32Value()); | 6452 CHECK_EQ(3, global->Get(v8::String::New("b"))->Int32Value()); |
| 6458 CHECK_EQ(1, force_set_set_count); | 6453 CHECK_EQ(1, force_set_set_count); |
| 6459 CHECK_EQ(6, force_set_get_count); | 6454 CHECK_EQ(6, force_set_get_count); |
| 6460 } | 6455 } |
| OLD | NEW |