OLD | NEW |
1 // Copyright 2007-2008 Google Inc. All Rights Reserved. | 1 // Copyright 2007-2008 Google Inc. 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 3941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3952 CHECK(!try_catch.HasCaught()); | 3952 CHECK(!try_catch.HasCaught()); |
3953 | 3953 |
3954 value = Script::Compile(v8_str("obj(42)"))->Run(); | 3954 value = Script::Compile(v8_str("obj(42)"))->Run(); |
3955 CHECK(!try_catch.HasCaught()); | 3955 CHECK(!try_catch.HasCaught()); |
3956 CHECK_EQ(42, value->Int32Value()); | 3956 CHECK_EQ(42, value->Int32Value()); |
3957 | 3957 |
3958 value = Script::Compile(v8_str("(function(o){return o(49)})(obj)"))->Run(); | 3958 value = Script::Compile(v8_str("(function(o){return o(49)})(obj)"))->Run(); |
3959 CHECK(!try_catch.HasCaught()); | 3959 CHECK(!try_catch.HasCaught()); |
3960 CHECK_EQ(49, value->Int32Value()); | 3960 CHECK_EQ(49, value->Int32Value()); |
3961 | 3961 |
| 3962 // test special case of call as function |
| 3963 value = Script::Compile(v8_str("[obj]['0'](45)"))->Run(); |
| 3964 CHECK(!try_catch.HasCaught()); |
| 3965 CHECK_EQ(45, value->Int32Value()); |
| 3966 |
3962 value = Script::Compile(v8_str("obj.call = Function.prototype.call;" | 3967 value = Script::Compile(v8_str("obj.call = Function.prototype.call;" |
3963 "obj.call(null, 87)"))->Run(); | 3968 "obj.call(null, 87)"))->Run(); |
3964 CHECK(!try_catch.HasCaught()); | 3969 CHECK(!try_catch.HasCaught()); |
3965 CHECK_EQ(87, value->Int32Value()); | 3970 CHECK_EQ(87, value->Int32Value()); |
3966 | 3971 |
3967 // Regression tests for bug #1116356: Calling call through call/apply | 3972 // Regression tests for bug #1116356: Calling call through call/apply |
3968 // must work for non-function receivers. | 3973 // must work for non-function receivers. |
3969 const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])"; | 3974 const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])"; |
3970 value = Script::Compile(v8_str(apply_99))->Run(); | 3975 value = Script::Compile(v8_str(apply_99))->Run(); |
3971 CHECK(!try_catch.HasCaught()); | 3976 CHECK(!try_catch.HasCaught()); |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4810 THREADED_TEST(DisposeEnteredContext) { | 4815 THREADED_TEST(DisposeEnteredContext) { |
4811 v8::HandleScope scope; | 4816 v8::HandleScope scope; |
4812 LocalContext outer; | 4817 LocalContext outer; |
4813 { v8::Persistent<v8::Context> inner = v8::Context::New(); | 4818 { v8::Persistent<v8::Context> inner = v8::Context::New(); |
4814 inner->Enter(); | 4819 inner->Enter(); |
4815 inner.Dispose(); | 4820 inner.Dispose(); |
4816 inner.Clear(); | 4821 inner.Clear(); |
4817 inner->Exit(); | 4822 inner->Exit(); |
4818 } | 4823 } |
4819 } | 4824 } |
OLD | NEW |