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 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4387 // Create object with named interceptor. | 4387 // Create object with named interceptor. |
4388 v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New(isolate); | 4388 v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New(isolate); |
4389 named->SetHandler(v8::NamedPropertyHandlerConfiguration( | 4389 named->SetHandler(v8::NamedPropertyHandlerConfiguration( |
4390 NamedGetter, NULL, NULL, NULL, NamedEnum)); | 4390 NamedGetter, NULL, NULL, NULL, NamedEnum)); |
4391 env->Global()->Set( | 4391 env->Global()->Set( |
4392 v8::String::NewFromUtf8(isolate, "intercepted_named"), | 4392 v8::String::NewFromUtf8(isolate, "intercepted_named"), |
4393 named->NewInstance()); | 4393 named->NewInstance()); |
4394 | 4394 |
4395 // Create object with indexed interceptor. | 4395 // Create object with indexed interceptor. |
4396 v8::Handle<v8::ObjectTemplate> indexed = v8::ObjectTemplate::New(isolate); | 4396 v8::Handle<v8::ObjectTemplate> indexed = v8::ObjectTemplate::New(isolate); |
4397 indexed->SetIndexedPropertyHandler(IndexedGetter, | 4397 indexed->SetHandler(v8::IndexedPropertyHandlerConfiguration( |
4398 NULL, | 4398 IndexedGetter, NULL, NULL, NULL, IndexedEnum)); |
4399 NULL, | |
4400 NULL, | |
4401 IndexedEnum); | |
4402 env->Global()->Set( | 4399 env->Global()->Set( |
4403 v8::String::NewFromUtf8(isolate, "intercepted_indexed"), | 4400 v8::String::NewFromUtf8(isolate, "intercepted_indexed"), |
4404 indexed->NewInstance()); | 4401 indexed->NewInstance()); |
4405 | 4402 |
4406 // Create object with both named and indexed interceptor. | 4403 // Create object with both named and indexed interceptor. |
4407 v8::Handle<v8::ObjectTemplate> both = v8::ObjectTemplate::New(isolate); | 4404 v8::Handle<v8::ObjectTemplate> both = v8::ObjectTemplate::New(isolate); |
4408 both->SetHandler(v8::NamedPropertyHandlerConfiguration( | 4405 both->SetHandler(v8::NamedPropertyHandlerConfiguration( |
4409 NamedGetter, NULL, NULL, NULL, NamedEnum)); | 4406 NamedGetter, NULL, NULL, NULL, NamedEnum)); |
4410 both->SetIndexedPropertyHandler(IndexedGetter, NULL, NULL, NULL, IndexedEnum); | 4407 both->SetHandler(v8::IndexedPropertyHandlerConfiguration( |
| 4408 IndexedGetter, NULL, NULL, NULL, IndexedEnum)); |
4411 env->Global()->Set( | 4409 env->Global()->Set( |
4412 v8::String::NewFromUtf8(isolate, "intercepted_both"), | 4410 v8::String::NewFromUtf8(isolate, "intercepted_both"), |
4413 both->NewInstance()); | 4411 both->NewInstance()); |
4414 | 4412 |
4415 // Get mirrors for the three objects with interceptor. | 4413 // Get mirrors for the three objects with interceptor. |
4416 CompileRun( | 4414 CompileRun( |
4417 "var named_mirror = debug.MakeMirror(intercepted_named);" | 4415 "var named_mirror = debug.MakeMirror(intercepted_named);" |
4418 "var indexed_mirror = debug.MakeMirror(intercepted_indexed);" | 4416 "var indexed_mirror = debug.MakeMirror(intercepted_indexed);" |
4419 "var both_mirror = debug.MakeMirror(intercepted_both)"); | 4417 "var both_mirror = debug.MakeMirror(intercepted_both)"); |
4420 CHECK(CompileRun( | 4418 CHECK(CompileRun( |
(...skipping 3253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7674 "let y = 2; \n" | 7672 "let y = 2; \n" |
7675 "debugger; \n" | 7673 "debugger; \n" |
7676 "x * y", | 7674 "x * y", |
7677 30); | 7675 30); |
7678 ExpectInt32( | 7676 ExpectInt32( |
7679 "x = 1; y = 2; \n" | 7677 "x = 1; y = 2; \n" |
7680 "debugger;" | 7678 "debugger;" |
7681 "x * y", | 7679 "x * y", |
7682 30); | 7680 30); |
7683 } | 7681 } |
OLD | NEW |