Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp

Issue 2832923003: v8binding: Don't allow author script to define indexed accessor prop. (Closed)
Patch Set: Added the test expectation. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium 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 // This file has been auto-generated by code_generator_v8.py. 5 // This file has been auto-generated by code_generator_v8.py.
6 // DO NOT MODIFY! 6 // DO NOT MODIFY!
7 7
8 // This file has been generated from the Jinja2 template in 8 // This file has been generated from the Jinja2 template in
9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl 9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
10 10
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 802 }
803 803
804 void V8TestInterface5::indexedPropertySetterCallback(uint32_t index, v8::Local<v 8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { 804 void V8TestInterface5::indexedPropertySetterCallback(uint32_t index, v8::Local<v 8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
805 TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info); 805 TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
806 } 806 }
807 807
808 void V8TestInterface5::indexedPropertyDeleterCallback(uint32_t index, const v8:: PropertyCallbackInfo<v8::Boolean>& info) { 808 void V8TestInterface5::indexedPropertyDeleterCallback(uint32_t index, const v8:: PropertyCallbackInfo<v8::Boolean>& info) {
809 TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info); 809 TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info);
810 } 810 }
811 811
812 void V8TestInterface5::indexedPropertyDefinerCallback(
813 uint32_t index,
814 const v8::PropertyDescriptor& desc,
815 const v8::PropertyCallbackInfo<v8::Value>& info) {
816 // https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty
817 // 3.9.3. [[DefineOwnProperty]]
818 // step 1.1. If the result of calling IsDataDescriptor(Desc) is false, then
819 // return false.
820 if (desc.has_get() || desc.has_set()) {
821 V8SetReturnValue(info, v8::Null(info.GetIsolate()));
822 if (info.ShouldThrowOnError()) {
823 ExceptionState exceptionState(info.GetIsolate(),
824 ExceptionState::kIndexedSetterContext,
825 "TestInterface5");
826 exceptionState.ThrowTypeError("Accessor properties are not allowed.");
827 }
828 return;
829 }
830
831 // Return nothing and fall back to indexedPropertySetterCallback.
832 }
833
812 // Suppress warning: global constructors, because AttributeConfiguration is triv ial 834 // Suppress warning: global constructors, because AttributeConfiguration is triv ial
813 // and does not depend on another global objects. 835 // and does not depend on another global objects.
814 #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) 836 #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
815 #pragma clang diagnostic push 837 #pragma clang diagnostic push
816 #pragma clang diagnostic ignored "-Wglobal-constructors" 838 #pragma clang diagnostic ignored "-Wglobal-constructors"
817 #endif 839 #endif
818 static const V8DOMConfiguration::AttributeConfiguration V8TestInterface5LazyData Attributes[] = { 840 static const V8DOMConfiguration::AttributeConfiguration V8TestInterface5LazyData Attributes[] = {
819 { "testInterfaceConstructorAttribute", V8ConstructorAttributeGetter, nullptr , const_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast< v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::kOnInstance, V8DOMConf iguration::kCheckHolder, V8DOMConfiguration::kAllWorlds }, 841 { "testInterfaceConstructorAttribute", V8ConstructorAttributeGetter, nullptr , const_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast< v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::kOnInstance, V8DOMConf iguration::kCheckHolder, V8DOMConfiguration::kAllWorlds },
820 }; 842 };
821 #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) 843 #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 isolate, world, instanceTemplate, prototypeTemplate, 907 isolate, world, instanceTemplate, prototypeTemplate,
886 V8TestInterface5LazyDataAttributes, WTF_ARRAY_LENGTH(V8TestInterface5LazyD ataAttributes)); 908 V8TestInterface5LazyDataAttributes, WTF_ARRAY_LENGTH(V8TestInterface5LazyD ataAttributes));
887 V8DOMConfiguration::InstallAccessors( 909 V8DOMConfiguration::InstallAccessors(
888 isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, 910 isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate,
889 signature, V8TestInterface5Accessors, WTF_ARRAY_LENGTH(V8TestInterface5Acc essors)); 911 signature, V8TestInterface5Accessors, WTF_ARRAY_LENGTH(V8TestInterface5Acc essors));
890 V8DOMConfiguration::InstallMethods( 912 V8DOMConfiguration::InstallMethods(
891 isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, 913 isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate,
892 signature, V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Metho ds)); 914 signature, V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Metho ds));
893 915
894 // Indexed properties 916 // Indexed properties
895 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(V8TestInt erface5::indexedPropertyGetterCallback, V8TestInterface5::indexedPropertySetterC allback, nullptr, V8TestInterface5::indexedPropertyDeleterCallback, IndexedPrope rtyEnumerator<TestInterface5Implementation>, v8::Local<v8::Value>(), v8::Propert yHandlerFlags::kNone); 917 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(
918 V8TestInterface5::indexedPropertyGetterCallback,
919 V8TestInterface5::indexedPropertySetterCallback,
920 nullptr,
921 V8TestInterface5::indexedPropertyDeleterCallback,
922 IndexedPropertyEnumerator<TestInterface5Implementation>,
923 V8TestInterface5::indexedPropertyDefinerCallback,
924 v8::Local<v8::Value>(),
925 v8::PropertyHandlerFlags::kNone);
896 instanceTemplate->SetHandler(indexedPropertyHandlerConfig); 926 instanceTemplate->SetHandler(indexedPropertyHandlerConfig);
897 // Named properties 927 // Named properties
898 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(V8TestInterfa ce5::namedPropertyGetterCallback, V8TestInterface5::namedPropertySetterCallback, V8TestInterface5::namedPropertyQueryCallback, V8TestInterface5::namedPropertyDe leterCallback, V8TestInterface5::namedPropertyEnumeratorCallback, v8::Local<v8:: Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kO nlyInterceptStrings) | int(v8::PropertyHandlerFlags::kNonMasking))); 928 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(V8TestInterfa ce5::namedPropertyGetterCallback, V8TestInterface5::namedPropertySetterCallback, V8TestInterface5::namedPropertyQueryCallback, V8TestInterface5::namedPropertyDe leterCallback, V8TestInterface5::namedPropertyEnumeratorCallback, v8::Local<v8:: Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kO nlyInterceptStrings) | int(v8::PropertyHandlerFlags::kNonMasking)));
899 instanceTemplate->SetHandler(namedPropertyHandlerConfig); 929 instanceTemplate->SetHandler(namedPropertyHandlerConfig);
900 930
901 // Array iterator (@@iterator) 931 // Array iterator (@@iterator)
902 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum); 932 prototypeTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum);
903 // For value iterators, the properties below must originally be set to the cor responding ones in %ArrayPrototype%. 933 // For value iterators, the properties below must originally be set to the cor responding ones in %ArrayPrototype%.
904 // See https://heycam.github.io/webidl/#es-iterators. 934 // See https://heycam.github.io/webidl/#es-iterators.
905 prototypeTemplate->SetIntrinsicDataProperty(V8AtomicString(isolate, "entries") , v8::kArrayProto_entries); 935 prototypeTemplate->SetIntrinsicDataProperty(V8AtomicString(isolate, "entries") , v8::kArrayProto_entries);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 if (executionContext && (executionContext->IsDocument() || executionContext->I sServiceWorkerGlobalScope())) { 1041 if (executionContext && (executionContext->IsDocument() || executionContext->I sServiceWorkerGlobalScope())) {
1012 const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedM ethodMethodConfiguration[] = { 1042 const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedM ethodMethodConfiguration[] = {
1013 {"windowAndServiceWorkerExposedMethod", V8TestInterface5::windowAndService WorkerExposedMethodMethodCallback, 0, v8::None, V8DOMConfiguration::kOnPrototype , V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOM Configuration::kAllWorlds} 1043 {"windowAndServiceWorkerExposedMethod", V8TestInterface5::windowAndService WorkerExposedMethodMethodCallback, 0, v8::None, V8DOMConfiguration::kOnPrototype , V8DOMConfiguration::kCheckHolder, V8DOMConfiguration::kDoNotCheckAccess, V8DOM Configuration::kAllWorlds}
1014 }; 1044 };
1015 for (const auto& methodConfig : windowAndServiceWorkerExposedMethodMethodCon figuration) 1045 for (const auto& methodConfig : windowAndServiceWorkerExposedMethodMethodCon figuration)
1016 V8DOMConfiguration::InstallMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, methodConfig); 1046 V8DOMConfiguration::InstallMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, methodConfig);
1017 } 1047 }
1018 } 1048 }
1019 1049
1020 } // namespace blink 1050 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698