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 |
23 LocalContext context; | 25 LocalContext context; |
24 v8::Isolate* isolate = context->GetIsolate(); | 26 v8::Isolate* isolate = context->GetIsolate(); |
25 v8::HandleScope handle_scope(isolate); | 27 v8::HandleScope handle_scope(isolate); |
26 | 28 |
27 v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate); | 29 v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate); |
28 v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate); | 30 v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate); |
29 | 31 |
30 t1->SetHiddenPrototype(true); | 32 t1->SetHiddenPrototype(true); |
31 | 33 |
32 v8::Local<v8::Object> object = t0->GetFunction()->NewInstance(); | 34 v8::Local<v8::Object> object = t0->GetFunction()->NewInstance(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 "var result;" | 96 "var result;" |
95 "var x = 0;" | 97 "var x = 0;" |
96 "hidden_prototype.x = 6;" | 98 "hidden_prototype.x = 6;" |
97 "object[Symbol.unscopables] = {x: true};" | 99 "object[Symbol.unscopables] = {x: true};" |
98 "with (object) {" | 100 "with (object) {" |
99 " result = x;" | 101 " result = x;" |
100 "}" | 102 "}" |
101 "result")->Int32Value()); | 103 "result")->Int32Value()); |
102 } | 104 } |
103 } | 105 } |
OLD | NEW |