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

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

Issue 534133002: [WIP] bindings: Introduce PropertyBag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
Index: Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp b/Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp
index d28cc0edc21ae0eb2dc3bef4b57d5ac3ac040821..e48e6e98268b1ea1e750c8c29267feb3a85945e3 100644
--- a/Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceEventConstructor.cpp
@@ -7,8 +7,8 @@
#include "config.h"
#include "V8TestInterfaceEventConstructor.h"
-#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/PropertyBag.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/SerializedScriptValue.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
@@ -241,15 +241,16 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
TOSTRING_VOID(V8StringResource<>, type, info[0]);
v8::Local<v8::Value> initializedByEventConstructorReadonlyAnyAttribute;
TestInterfaceEventConstructorInit eventInit;
- if (info.Length() >= 2) {
- TONATIVE_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate()));
- if (!initializeTestInterfaceEventConstructor(eventInit, options, exceptionState, info)) {
+ if (info.Length() >= 2 && !info[1].IsEmpty() && info[1]->IsObject()) {
+ PropertyBag bag(info.GetIsolate(), info[1]->ToObject(), exceptionState);
+ if (!initializeTestInterfaceEventConstructor(eventInit, bag, exceptionState, info)) {
exceptionState.throwIfNeeded();
return;
}
- options.get("initializedByEventConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttribute);
- if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
+ if (bag.hasProperty("initializedByEventConstructorReadonlyAnyAttribute")) {
+ bag.convert("initializedByEventConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttribute);
V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyAnyAttribute"), initializedByEventConstructorReadonlyAnyAttribute);
+ }
}
RefPtrWillBeRawPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor::create(type, eventInit, exceptionState);
if (exceptionState.throwIfNeeded())
@@ -281,36 +282,36 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceEventCons
{"deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
};
-bool initializeTestInterfaceEventConstructor(TestInterfaceEventConstructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const v8::FunctionCallbackInfo<v8::Value>& info, const String& forEventName)
+bool initializeTestInterfaceEventConstructor(TestInterfaceEventConstructorInit& eventInit, const PropertyBag& bag, ExceptionState& exceptionState, const v8::FunctionCallbackInfo<v8::Value>& info, const String& forEventName)
{
- Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName, "", exceptionState);
- if (!initializeEvent(eventInit, options, exceptionState, info, forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName))
+ EventInitInitializer initializer(forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName, bag, exceptionState);
+ if (!initializeEvent(eventInit, bag, exceptionState, info, forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "initializedByEventConstructorReadonlyStringAttribute", eventInit.initializedByEventConstructorReadonlyStringAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyStringAttribute", eventInit.initializedByEventConstructorReadonlyStringAttribute, "DOMString", PropertyBag::IsNotNullable))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("boolean", false), "initializedByEventConstructorReadonlyBooleanAttribute", eventInit.initializedByEventConstructorReadonlyBooleanAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyBooleanAttribute", eventInit.initializedByEventConstructorReadonlyBooleanAttribute, "boolean", PropertyBag::IsNotNullable))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("long", false), "initializedByEventConstructorReadonlyLongAttribute", eventInit.initializedByEventConstructorReadonlyLongAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyLongAttribute", eventInit.initializedByEventConstructorReadonlyLongAttribute, "long", PropertyBag::IsNotNullable))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("Uint8Array", false), "initializedByEventConstructorReadonlyUint8ArrayAttribute", eventInit.initializedByEventConstructorReadonlyUint8ArrayAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyUint8ArrayAttribute", eventInit.initializedByEventConstructorReadonlyUint8ArrayAttribute, "Uint8Array", PropertyBag::IsNotNullable))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty", false), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute, "TestInterfaceEmpty", PropertyBag::IsNotNullable))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty[]", false), "initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute, "TestInterfaceEmpty[]", PropertyBag::IsNotNullable))
return false;
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty", true), "initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute))
+ if (!initializer.initializeProperty("initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute, "TestInterfaceEmpty", PropertyBag::IsNullable))
return false;
- if (DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "deprecatedInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedInitializedByEventConstructorReadonlyStringAttribute)) {
- if (options.hasProperty("deprecatedInitializedByEventConstructorReadonlyStringAttribute"))
+ if (initializer.initializeProperty("deprecatedInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedInitializedByEventConstructorReadonlyStringAttribute, "DOMString", PropertyBag::IsNotNullable)) {
+ if (bag.hasProperty("deprecatedInitializedByEventConstructorReadonlyStringAttribute"))
UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
} else {
return false;
}
- if (!DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "implementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.implementedAsName))
+ if (!initializer.initializeProperty("implementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.implementedAsName, "DOMString", PropertyBag::IsNotNullable))
return false;
- if (DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedImplementedAsName)) {
- if (options.hasProperty("deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute"))
+ if (initializer.initializeProperty("deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedImplementedAsName, "DOMString", PropertyBag::IsNotNullable)) {
+ if (bag.hasProperty("deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute"))
UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
} else {
return false;

Powered by Google App Engine
This is Rietveld 408576698