OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 env->Global()->Set(v8_str("UnrelFun"), unrel_fun->GetFunction()); | 195 env->Global()->Set(v8_str("UnrelFun"), unrel_fun->GetFunction()); |
196 CompileRun( | 196 CompileRun( |
197 "var o = new UnrelFun();" | 197 "var o = new UnrelFun();" |
198 "o.m = Fun.prototype.m;" | 198 "o.m = Fun.prototype.m;" |
199 "o.m();"); | 199 "o.m();"); |
200 CHECK_EQ(2, signature_callback_count); | 200 CHECK_EQ(2, signature_callback_count); |
201 CHECK(try_catch.HasCaught()); | 201 CHECK(try_catch.HasCaught()); |
202 } | 202 } |
203 | 203 |
204 | 204 |
205 TEST(HasOwnProperty) { | |
206 v8::HandleScope scope; | |
207 LocalContext env; | |
208 Handle<Value> value = CompileRun( | |
209 "function Foo() { this.foo = 11; };" | |
210 "function Bar() { this.bar = 13; };" | |
211 "Bar.prototype = new Foo();" | |
212 "new Bar();"); | |
213 CHECK(value->IsObject()); | |
214 Handle<Object> object = value->ToObject(); | |
Vitaly Repeshko
2011/04/27 09:03:59
It'd be interesting to test this with __defineGett
Karl Klose
2011/04/28 08:32:43
Done.
| |
215 CHECK_EQ(true, object->Has(v8_str("foo"))); | |
216 CHECK_EQ(false, object->HasOwnProperty(v8_str("foo"))); | |
217 CHECK_EQ(true, object->HasOwnProperty(v8_str("bar"))); | |
218 } | |
205 | 219 |
206 | 220 |
207 THREADED_TEST(ArgumentSignature) { | 221 THREADED_TEST(ArgumentSignature) { |
208 v8::HandleScope scope; | 222 v8::HandleScope scope; |
209 LocalContext env; | 223 LocalContext env; |
210 v8::Handle<v8::FunctionTemplate> cons = v8::FunctionTemplate::New(); | 224 v8::Handle<v8::FunctionTemplate> cons = v8::FunctionTemplate::New(); |
211 cons->SetClassName(v8_str("Cons")); | 225 cons->SetClassName(v8_str("Cons")); |
212 v8::Handle<v8::Signature> sig = | 226 v8::Handle<v8::Signature> sig = |
213 v8::Signature::New(v8::Handle<v8::FunctionTemplate>(), 1, &cons); | 227 v8::Signature::New(v8::Handle<v8::FunctionTemplate>(), 1, &cons); |
214 v8::Handle<v8::FunctionTemplate> fun = | 228 v8::Handle<v8::FunctionTemplate> fun = |
(...skipping 13689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13904 CHECK(func2->CreationContext() == context2); | 13918 CHECK(func2->CreationContext() == context2); |
13905 CheckContextId(func2, 2); | 13919 CheckContextId(func2, 2); |
13906 CHECK(instance2->CreationContext() == context2); | 13920 CHECK(instance2->CreationContext() == context2); |
13907 CheckContextId(instance2, 2); | 13921 CheckContextId(instance2, 2); |
13908 } | 13922 } |
13909 | 13923 |
13910 context1.Dispose(); | 13924 context1.Dispose(); |
13911 context2.Dispose(); | 13925 context2.Dispose(); |
13912 context3.Dispose(); | 13926 context3.Dispose(); |
13913 } | 13927 } |
OLD | NEW |