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 9112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9123 global1->Set(v8_str("other"), global0); | 9123 global1->Set(v8_str("other"), global0); |
9124 | 9124 |
9125 // Access blocked property. | 9125 // Access blocked property. |
9126 CompileRun("other.blocked_prop = 1"); | 9126 CompileRun("other.blocked_prop = 1"); |
9127 | 9127 |
9128 ExpectUndefined("other.blocked_prop"); | 9128 ExpectUndefined("other.blocked_prop"); |
9129 ExpectUndefined( | 9129 ExpectUndefined( |
9130 "Object.getOwnPropertyDescriptor(other, 'blocked_prop')"); | 9130 "Object.getOwnPropertyDescriptor(other, 'blocked_prop')"); |
9131 ExpectFalse("propertyIsEnumerable.call(other, 'blocked_prop')"); | 9131 ExpectFalse("propertyIsEnumerable.call(other, 'blocked_prop')"); |
9132 | 9132 |
9133 // Enable ACCESS_HAS | |
9134 allowed_access_type[v8::ACCESS_HAS] = true; | |
9135 ExpectUndefined("other.blocked_prop"); | |
9136 // ... and now we can get the descriptor... | |
9137 ExpectUndefined( | |
9138 "Object.getOwnPropertyDescriptor(other, 'blocked_prop').value"); | |
9139 // ... and enumerate the property. | |
9140 ExpectTrue("propertyIsEnumerable.call(other, 'blocked_prop')"); | |
9141 allowed_access_type[v8::ACCESS_HAS] = false; | |
9142 | |
9143 // Access blocked element. | 9133 // Access blocked element. |
9144 CompileRun("other[239] = 1"); | 9134 CompileRun("other[239] = 1"); |
9145 | 9135 |
9146 ExpectUndefined("other[239]"); | 9136 ExpectUndefined("other[239]"); |
9147 ExpectUndefined("Object.getOwnPropertyDescriptor(other, '239')"); | 9137 ExpectUndefined("Object.getOwnPropertyDescriptor(other, '239')"); |
9148 ExpectFalse("propertyIsEnumerable.call(other, '239')"); | 9138 ExpectFalse("propertyIsEnumerable.call(other, '239')"); |
9149 | 9139 |
9150 // Enable ACCESS_HAS | 9140 // Enable ACCESS_HAS |
9151 allowed_access_type[v8::ACCESS_HAS] = true; | 9141 allowed_access_type[v8::ACCESS_HAS] = true; |
9152 ExpectUndefined("other[239]"); | 9142 ExpectUndefined("other[239]"); |
(...skipping 13530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22683 call_eval_context = v8::Context::New(isolate); | 22673 call_eval_context = v8::Context::New(isolate); |
22684 v8::Context::Scope scope(call_eval_context); | 22674 v8::Context::Scope scope(call_eval_context); |
22685 call_eval_bound_function = | 22675 call_eval_bound_function = |
22686 Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); | 22676 Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); |
22687 } | 22677 } |
22688 env->Global()->Set(v8_str("CallEval"), | 22678 env->Global()->Set(v8_str("CallEval"), |
22689 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); | 22679 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); |
22690 Local<Value> result = CompileRun("CallEval();"); | 22680 Local<Value> result = CompileRun("CallEval();"); |
22691 CHECK_EQ(result, v8::Integer::New(isolate, 1)); | 22681 CHECK_EQ(result, v8::Integer::New(isolate, 1)); |
22692 } | 22682 } |
OLD | NEW |