OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 | 12 |
13 static void Cleanup() { | 13 static void Cleanup() { |
14 CompileRun( | 14 CompileRun( |
15 "delete object.x;" | 15 "delete object.x;" |
16 "delete hidden_prototype.x;" | 16 "delete hidden_prototype.x;" |
17 "delete object[Symbol.unscopables];" | 17 "delete object[Symbol.unscopables];" |
18 "delete hidden_prototype[Symbol.unscopables];"); | 18 "delete hidden_prototype[Symbol.unscopables];"); |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 TEST(Unscopables) { | 22 TEST(Unscopables) { |
23 i::FLAG_harmony_unscopables = true; | |
24 | |
25 LocalContext context; | 23 LocalContext context; |
26 v8::Isolate* isolate = context->GetIsolate(); | 24 v8::Isolate* isolate = context->GetIsolate(); |
27 v8::HandleScope handle_scope(isolate); | 25 v8::HandleScope handle_scope(isolate); |
28 | 26 |
29 v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate); | 27 v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate); |
30 v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate); | 28 v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate); |
31 | 29 |
32 t1->SetHiddenPrototype(true); | 30 t1->SetHiddenPrototype(true); |
33 | 31 |
34 v8::Local<v8::Object> object = t0->GetFunction()->NewInstance(); | 32 v8::Local<v8::Object> object = t0->GetFunction()->NewInstance(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 "var result;" | 94 "var result;" |
97 "var x = 0;" | 95 "var x = 0;" |
98 "hidden_prototype.x = 6;" | 96 "hidden_prototype.x = 6;" |
99 "object[Symbol.unscopables] = {x: true};" | 97 "object[Symbol.unscopables] = {x: true};" |
100 "with (object) {" | 98 "with (object) {" |
101 " result = x;" | 99 " result = x;" |
102 "}" | 100 "}" |
103 "result")->Int32Value()); | 101 "result")->Int32Value()); |
104 } | 102 } |
105 } | 103 } |
OLD | NEW |