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

Unified Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 124763002: Support IDL attributes limited to only known values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Flatten generated code block Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/tests/idls/TestObject.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index c87706d664ba088f6f6f24251de3245b67aaef70..784fdaf50222f0b32d9c83a14482929339209f81 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -873,6 +873,123 @@ static void animatedReflectedAttributeAttributeSetterCallback(v8::Local<v8::Stri
TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
}
+static void limitedToOnlyOneAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ String resultValue = imp->fastGetAttribute(HTMLNames::limitedtoonlyoneattributeAttr);
+ if (resultValue.isEmpty()) {
+ ;
+ } else if (equalIgnoringCase(resultValue, "unique")) {
+ resultValue = "unique";
+ } else {
+ resultValue = "";
+ }
+ v8SetReturnValueString(info, resultValue, info.GetIsolate());
+}
+
+static void limitedToOnlyOneAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TestObjV8Internal::limitedToOnlyOneAttributeAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
+static void limitedToOnlyOneAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
+ CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+ imp->setAttribute(HTMLNames::limitedtoonlyoneattributeAttr, cppValue);
+}
+
+static void limitedToOnlyOneAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+ TestObjV8Internal::limitedToOnlyOneAttributeAttributeSetter(jsValue, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
+static void limitedToOnlyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ String resultValue = imp->fastGetAttribute(HTMLNames::limitedtoonlyattributeAttr);
+ if (resultValue.isEmpty()) {
+ ;
+ } else if (equalIgnoringCase(resultValue, "Per")) {
+ resultValue = "Per";
+ } else if (equalIgnoringCase(resultValue, "Paal")) {
+ resultValue = "Paal";
+ } else if (equalIgnoringCase(resultValue, "Espen")) {
+ resultValue = "Espen";
+ } else {
+ resultValue = "";
+ }
+ v8SetReturnValueString(info, resultValue, info.GetIsolate());
+}
+
+static void limitedToOnlyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TestObjV8Internal::limitedToOnlyAttributeAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
+static void limitedToOnlyAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
+ CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+ imp->setAttribute(HTMLNames::limitedtoonlyattributeAttr, cppValue);
+}
+
+static void limitedToOnlyAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+ TestObjV8Internal::limitedToOnlyAttributeAttributeSetter(jsValue, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
+static void limitedToOnlyOtherAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ String resultValue = imp->fastGetAttribute(HTMLNames::OtherAttr);
+ if (resultValue.isEmpty()) {
+ ;
+ } else if (equalIgnoringCase(resultValue, "Value1")) {
+ resultValue = "Value1";
+ } else if (equalIgnoringCase(resultValue, "Value2")) {
+ resultValue = "Value2";
+ } else {
+ resultValue = "";
+ }
+ v8SetReturnValueString(info, resultValue, info.GetIsolate());
+}
+
+static void limitedToOnlyOtherAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TestObjV8Internal::limitedToOnlyOtherAttributeAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
+static void limitedToOnlyOtherAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
+{
+ TestObj* imp = V8TestObject::toNative(info.Holder());
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
+ CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+ imp->setAttribute(HTMLNames::OtherAttr, cppValue);
+}
+
+static void limitedToOnlyOtherAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
+ TestObjV8Internal::limitedToOnlyOtherAttributeAttributeSetter(jsValue, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
+}
+
static void typedArrayAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObj* imp = V8TestObject::toNative(info.Holder());
@@ -5138,6 +5255,9 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestObjectAttributes[]
{"reflectedCustomBooleanAttr", TestObjV8Internal::reflectedCustomBooleanAttrAttributeGetterCallback, TestObjV8Internal::reflectedCustomBooleanAttrAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"reflectedCustomURLAttr", TestObjV8Internal::reflectedCustomURLAttrAttributeGetterCallback, TestObjV8Internal::reflectedCustomURLAttrAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"animatedReflectedAttribute", TestObjV8Internal::animatedReflectedAttributeAttributeGetterCallback, TestObjV8Internal::animatedReflectedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ {"limitedToOnlyOneAttribute", TestObjV8Internal::limitedToOnlyOneAttributeAttributeGetterCallback, TestObjV8Internal::limitedToOnlyOneAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ {"limitedToOnlyAttribute", TestObjV8Internal::limitedToOnlyAttributeAttributeGetterCallback, TestObjV8Internal::limitedToOnlyAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ {"limitedToOnlyOtherAttribute", TestObjV8Internal::limitedToOnlyOtherAttributeAttributeGetterCallback, TestObjV8Internal::limitedToOnlyOtherAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"typedArrayAttr", TestObjV8Internal::typedArrayAttrAttributeGetterCallback, TestObjV8Internal::typedArrayAttrAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"attrWithGetterException", TestObjV8Internal::attrWithGetterExceptionAttributeGetterCallback, TestObjV8Internal::attrWithGetterExceptionAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
{"attrWithSetterException", TestObjV8Internal::attrWithSetterExceptionAttributeGetterCallback, TestObjV8Internal::attrWithSetterExceptionAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
« no previous file with comments | « Source/bindings/tests/idls/TestObject.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698