| 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 i::HandleScope scope(isolate); | 1019 i::HandleScope scope(isolate); |
| 1020 LocalContext env; | 1020 LocalContext env; |
| 1021 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; | 1021 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; |
| 1022 global_use_counts = use_counts; | 1022 global_use_counts = use_counts; |
| 1023 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); | 1023 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); |
| 1024 CompileRun("var obj = {}"); | 1024 CompileRun("var obj = {}"); |
| 1025 CompileRun("Object.getNotifier(obj)"); | 1025 CompileRun("Object.getNotifier(obj)"); |
| 1026 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); | 1026 CHECK_EQ(1, use_counts[v8::Isolate::kObjectObserve]); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 | |
| 1030 static bool NamedAccessCheckAlwaysAllow(Local<v8::Context> accessing_context, | 1029 static bool NamedAccessCheckAlwaysAllow(Local<v8::Context> accessing_context, |
| 1031 Local<v8::Object> accessed_object) { | 1030 Local<v8::Object> accessed_object, |
| 1031 Local<v8::Value> data) { |
| 1032 return true; | 1032 return true; |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 | 1035 |
| 1036 TEST(DisallowObserveAccessCheckedObject) { | 1036 TEST(DisallowObserveAccessCheckedObject) { |
| 1037 i::FLAG_harmony_object_observe = true; | 1037 i::FLAG_harmony_object_observe = true; |
| 1038 v8::Isolate* isolate = CcTest::isolate(); | 1038 v8::Isolate* isolate = CcTest::isolate(); |
| 1039 v8::HandleScope scope(isolate); | 1039 v8::HandleScope scope(isolate); |
| 1040 LocalContext env; | 1040 LocalContext env; |
| 1041 v8::Local<v8::ObjectTemplate> object_template = | 1041 v8::Local<v8::ObjectTemplate> object_template = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1068 v8::Isolate::GetCurrent()->GetCurrentContext()) | 1068 v8::Isolate::GetCurrent()->GetCurrentContext()) |
| 1069 .ToLocalChecked(); | 1069 .ToLocalChecked(); |
| 1070 env->Global() | 1070 env->Global() |
| 1071 ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), | 1071 ->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), |
| 1072 new_instance) | 1072 new_instance) |
| 1073 .FromJust(); | 1073 .FromJust(); |
| 1074 v8::TryCatch try_catch(isolate); | 1074 v8::TryCatch try_catch(isolate); |
| 1075 CompileRun("Object.getNotifier(obj)"); | 1075 CompileRun("Object.getNotifier(obj)"); |
| 1076 CHECK(try_catch.HasCaught()); | 1076 CHECK(try_catch.HasCaught()); |
| 1077 } | 1077 } |
| OLD | NEW |