diff options
author | sigbjornf@opera.com <sigbjornf@opera.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2014-06-23 09:04:40 +0000 |
---|---|---|
committer | sigbjornf@opera.com <sigbjornf@opera.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2014-06-23 09:04:40 +0000 |
commit | ac87522e259ff08755bb85c7c4ef6e5e8193231f (patch) | |
tree | 20c922cb97cac324d9f2c64525462308adaf26cf | |
parent | 8d9bcd7314141e4789b15017e0324a8ae44464a6 (diff) | |
download | chromium-ac87522e259ff08755bb85c7c4ef6e5e8193231f.tar.gz chromium-ac87522e259ff08755bb85c7c4ef6e5e8193231f.tar.bz2 chromium-ac87522e259ff08755bb85c7c4ef6e5e8193231f.zip |
Extend ScalarValueString handling to include constructors.
ScalarValueString conversion may raise an exception; take that into
account when generating the constructor's code.
Also, common up various string-like and exception-raising tests
internally, making them properties over the underlying IDL types.
R=jsbell@chromium.org,haraken@chromium.org
BUG=
Review URL: https://codereview.chromium.org/338893004
git-svn-id: svn://svn.chromium.org/blink/trunk@176732 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r-- | Source/bindings/scripts/idl_types.py | 25 | ||||
-rw-r--r-- | Source/bindings/scripts/v8_attributes.py | 3 | ||||
-rw-r--r-- | Source/bindings/scripts/v8_interface.py | 13 | ||||
-rw-r--r-- | Source/bindings/scripts/v8_methods.py | 8 | ||||
-rw-r--r-- | Source/bindings/scripts/v8_types.py | 10 | ||||
-rw-r--r-- | Source/bindings/tests/idls/TestInterfaceConstructor4.idl | 11 | ||||
-rw-r--r-- | Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp | 199 | ||||
-rw-r--r-- | Source/bindings/tests/results/V8TestInterfaceConstructor4.h | 125 | ||||
-rw-r--r-- | Source/bindings/tests/results/V8TestObject.cpp | 2 |
9 files changed, 372 insertions, 24 deletions
diff --git a/Source/bindings/scripts/idl_types.py b/Source/bindings/scripts/idl_types.py index e488e3326483..9de8efc16d3f 100644 --- a/Source/bindings/scripts/idl_types.py +++ b/Source/bindings/scripts/idl_types.py @@ -70,6 +70,14 @@ TYPE_NAMES = { 'Date': 'Date', } +STRING_TYPES = frozenset([ + # http://heycam.github.io/webidl/#es-interface-call (step 10.11) + # (Interface object [[Call]] method's string types.) + 'String', + 'ByteString', + 'ScalarValueString', +]) + ################################################################################ # Inheritance @@ -195,17 +203,30 @@ class IdlType(object): self.name == 'Promise') # Promise will be basic in future @property + def is_string_type(self): + return self.base_type_name in STRING_TYPES + + @property + def may_raise_exception_on_conversion(self): + return (self.is_integer_type or + self.name in ('ByteString', 'ScalarValueString')) + + @property def is_union_type(self): return isinstance(self, IdlUnionType) @property + def base_type_name(self): + base_type = self.base_type + return TYPE_NAMES.get(base_type, base_type) + + @property def name(self): """Return type name. http://heycam.github.io/webidl/#dfn-type-name """ - base_type = self.base_type - base_type_name = TYPE_NAMES.get(base_type, base_type) + base_type_name = self.base_type_name if self.is_array: return base_type_name + 'Array' if self.is_sequence: diff --git a/Source/bindings/scripts/v8_attributes.py b/Source/bindings/scripts/v8_attributes.py index 2aaec3c716f2..6d00711a6007 100644 --- a/Source/bindings/scripts/v8_attributes.py +++ b/Source/bindings/scripts/v8_attributes.py @@ -109,8 +109,7 @@ def generate_attribute(interface, attribute): 'has_setter_exception_state': is_setter_raises_exception or has_type_checking_interface or has_type_checking_nullable or has_type_checking_unrestricted or - idl_type.is_integer_type or - idl_type.name in ('ByteString', 'ScalarValueString'), + idl_type.may_raise_exception_on_conversion, 'has_type_checking_interface': has_type_checking_interface, 'has_type_checking_nullable': has_type_checking_nullable, 'has_type_checking_unrestricted': has_type_checking_unrestricted, diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py index abc23b40b079..141cb45a563d 100644 --- a/Source/bindings/scripts/v8_interface.py +++ b/Source/bindings/scripts/v8_interface.py @@ -738,7 +738,7 @@ def resolution_tests_methods(effective_overloads): # only needed if distinguishing between primitive types.) if len([idl_type.is_primitive_type for idl_type in idl_types]) > 1: # (Only needed if match in step 11, otherwise redundant.) - if any(idl_type.name == 'String' or idl_type.is_enum + if any(idl_type.is_string_type or idl_type.is_enum for idl_type in idl_types): # 10. Otherwise: if V is a Number value, and there is an entry in S # that has one of the following types at position i of its type @@ -760,15 +760,12 @@ def resolution_tests_methods(effective_overloads): # 11. Otherwise: if there is an entry in S that has one of the following # types at position i of its type list, # • DOMString + # • ByteString + # • ScalarValueString [a DOMString typedef, per definition.] # • an enumeration type - # * ByteString - # Blink: ScalarValueString is a pending Web IDL addition try: method = next(method for idl_type, method in idl_types_methods - if idl_type.name in ('String', - 'ByteString', - 'ScalarValueString') or - idl_type.is_enum) + if idl_type.is_string_type or idl_type.is_enum) yield 'true', method except StopIteration: pass @@ -855,7 +852,7 @@ def generate_constructor(interface, constructor): interface.extended_attributes.get('RaisesException') == 'Constructor' or any(argument for argument in constructor.arguments if argument.idl_type.name == 'SerializedScriptValue' or - argument.idl_type.is_integer_type), + argument.idl_type.may_raise_exception_on_conversion), 'is_constructor': True, 'is_named_constructor': False, 'number_of_required_arguments': diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py index 11486410b0fd..eed36f1a16cc 100644 --- a/Source/bindings/scripts/v8_methods.py +++ b/Source/bindings/scripts/v8_methods.py @@ -131,10 +131,8 @@ def generate_method(interface, method): is_raises_exception or is_check_security_for_frame or any(argument for argument in arguments - if argument.idl_type.name in ('ByteString', - 'ScalarValueString', - 'SerializedScriptValue') or - argument.idl_type.is_integer_type), + if argument.idl_type.name == 'SerializedScriptValue' or + argument.idl_type.may_raise_exception_on_conversion), 'idl_type': idl_type.base_type, 'is_call_with_execution_context': has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'), 'is_call_with_script_arguments': is_call_with_script_arguments, @@ -313,7 +311,7 @@ def v8_value_to_local_cpp_value(argument, index): # FIXME: This special way of handling string arguments with null defaults # can go away once we fully support default values. if (argument.is_optional and - idl_type.name in ('String', 'ByteString', 'ScalarValueString') and + idl_type.is_string_type and argument.default_value and argument.default_value.is_null): v8_value = 'argumentOrNull(info, %s)' % index else: diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py index 5f735af235cb..f8c83faf67d9 100644 --- a/Source/bindings/scripts/v8_types.py +++ b/Source/bindings/scripts/v8_types.py @@ -167,7 +167,7 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as if base_idl_type in NON_WRAPPER_TYPES: return 'RefPtr<%s>' % base_idl_type - if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'): + if idl_type.is_string_type: if not used_as_argument: return 'String' return 'V8StringResource<%s>' % string_mode() @@ -417,8 +417,7 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index): if 'EnforceRange' in extended_attributes: arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) - elif (idl_type.is_integer_type or # NormalConversion - idl_type.name in ('ByteString', 'ScalarValueString')): + elif idl_type.may_raise_exception_on_conversion: arguments = ', '.join([v8_value, 'exceptionState']) else: arguments = v8_value @@ -466,8 +465,7 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl args = [variable_name, cpp_value] if idl_type.base_type == 'DOMString' and not idl_type.array_or_sequence_type: macro = 'TOSTRING_VOID' - elif (idl_type.is_integer_type or - idl_type.name in ('ByteString', 'ScalarValueString')): + elif idl_type.may_raise_exception_on_conversion: macro = 'TONATIVE_VOID_EXCEPTIONSTATE' args.append('exceptionState') else: @@ -550,7 +548,7 @@ def v8_conversion_type(idl_type, extended_attributes): return 'int' if base_idl_type in CPP_UNSIGNED_TYPES: return 'unsigned' - if base_idl_type in ('DOMString', 'ByteString', 'ScalarValueString'): + if idl_type.is_string_type: if 'TreatReturnedNullStringAs' not in extended_attributes: return base_idl_type treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs'] diff --git a/Source/bindings/tests/idls/TestInterfaceConstructor4.idl b/Source/bindings/tests/idls/TestInterfaceConstructor4.idl new file mode 100644 index 000000000000..246f5516054f --- /dev/null +++ b/Source/bindings/tests/idls/TestInterfaceConstructor4.idl @@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test for overload resolution for the string-like ScalarValueString +// argument. +[ + Constructor(TestInterfaceConstructor4 testInterface4Arg), + Constructor(ScalarValueString scalarValueStringArg), +] interface TestInterfaceConstructor4 { +}; diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp new file mode 100644 index 000000000000..db3d04fc9f9e --- /dev/null +++ b/Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp @@ -0,0 +1,199 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#include "config.h" +#include "V8TestInterfaceConstructor4.h" + +#include "bindings/tests/v8/V8TestInterfaceConstructor4.h" +#include "bindings/v8/ExceptionState.h" +#include "bindings/v8/V8DOMConfiguration.h" +#include "bindings/v8/V8HiddenValue.h" +#include "bindings/v8/V8ObjectConstructor.h" +#include "core/dom/ContextFeatures.h" +#include "core/dom/Document.h" +#include "core/frame/LocalDOMWindow.h" +#include "platform/RuntimeEnabledFeatures.h" +#include "platform/TraceEvent.h" +#include "wtf/GetPtr.h" +#include "wtf/RefPtr.h" + +namespace WebCore { + +static void initializeScriptWrappableForInterface(TestInterfaceConstructor4* object) +{ + if (ScriptWrappable::wrapperCanBeStoredInObject(object)) + ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceConstructor4::wrapperTypeInfo); + else + ASSERT_NOT_REACHED(); +} + +} // namespace WebCore + +void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor4* object) +{ + WebCore::initializeScriptWrappableForInterface(object); +} + +namespace WebCore { +const WrapperTypeInfo V8TestInterfaceConstructor4::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor4::domTemplate, V8TestInterfaceConstructor4::derefObject, 0, 0, 0, V8TestInterfaceConstructor4::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject }; + +namespace TestInterfaceConstructor4V8Internal { + +template <typename T> void V8_USE(T) { } + +static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) +{ + v8::Isolate* isolate = info.GetIsolate(); + TestInterfaceConstructor4* testInterface4Arg; + { + v8::TryCatch block; + V8RethrowTryCatchScope rethrow(block); + TONATIVE_VOID_INTERNAL(testInterface4Arg, V8TestInterfaceConstructor4::toNativeWithTypeCheck(info.GetIsolate(), info[0])); + } + RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(testInterface4Arg); + + v8::Handle<v8::Object> wrapper = info.Holder(); + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor4>(impl.release(), &V8TestInterfaceConstructor4::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); + v8SetReturnValue(info, wrapper); +} + +static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) +{ + v8::Isolate* isolate = info.GetIsolate(); + ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor4", info.Holder(), isolate); + V8StringResource<> scalarValueStringArg; + { + v8::TryCatch block; + V8RethrowTryCatchScope rethrow(block); + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(scalarValueStringArg, toScalarValueString(info[0], exceptionState), exceptionState); + } + RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(scalarValueStringArg); + + v8::Handle<v8::Object> wrapper = info.Holder(); + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor4>(impl.release(), &V8TestInterfaceConstructor4::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); + v8SetReturnValue(info, wrapper); +} + +static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) +{ + v8::Isolate* isolate = info.GetIsolate(); + ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor4", info.Holder(), isolate); + switch (std::min(1, info.Length())) { + case 1: + if (V8TestInterfaceConstructor4::hasInstance(info[0], isolate)) { + TestInterfaceConstructor4V8Internal::constructor1(info); + return; + } + if (true) { + TestInterfaceConstructor4V8Internal::constructor2(info); + return; + } + break; + default: + exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); + exceptionState.throwIfNeeded(); + return; + } + exceptionState.throwTypeError("No matching constructor signature."); + exceptionState.throwIfNeeded(); +} + +} // namespace TestInterfaceConstructor4V8Internal + +void V8TestInterfaceConstructor4::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) +{ + TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); + if (!info.IsConstructCall()) { + throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceConstructor4"), info.GetIsolate()); + return; + } + + if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) { + v8SetReturnValue(info, info.Holder()); + return; + } + + TestInterfaceConstructor4V8Internal::constructor(info); +} + +static void configureV8TestInterfaceConstructor4Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) +{ + functionTemplate->ReadOnlyPrototype(); + + v8::Local<v8::Signature> defaultSignature; + defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor4", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor4::internalFieldCount, + 0, 0, + 0, 0, + 0, 0, + isolate); + functionTemplate->SetCallHandler(V8TestInterfaceConstructor4::constructorCallback); + functionTemplate->SetLength(1); + v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate(); + + // Custom toString template + functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); +} + +v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor4::domTemplate(v8::Isolate* isolate) +{ + return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestInterfaceConstructor4Template); +} + +bool V8TestInterfaceConstructor4::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) +{ + return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value); +} + +v8::Handle<v8::Object> V8TestInterfaceConstructor4::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) +{ + return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value); +} + +TestInterfaceConstructor4* V8TestInterfaceConstructor4::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) +{ + return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0; +} + +v8::Handle<v8::Object> wrap(TestInterfaceConstructor4* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + ASSERT(impl); + ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor4>(impl, isolate)); + return V8TestInterfaceConstructor4::createWrapper(impl, creationContext, isolate); +} + +v8::Handle<v8::Object> V8TestInterfaceConstructor4::createWrapper(PassRefPtr<TestInterfaceConstructor4> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + ASSERT(impl); + ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor4>(impl.get(), isolate)); + if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { + const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo(); + // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have + // the same object de-ref functions, though, so use that as the basis of the check. + RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); + } + + v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); + if (UNLIKELY(wrapper.IsEmpty())) + return wrapper; + + installPerContextEnabledProperties(wrapper, impl.get(), isolate); + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor4>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); + return wrapper; +} + +void V8TestInterfaceConstructor4::derefObject(void* object) +{ + fromInternalPointer(object)->deref(); +} + +template<> +v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor4* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl, creationContext, isolate); +} + +} // namespace WebCore diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor4.h b/Source/bindings/tests/results/V8TestInterfaceConstructor4.h new file mode 100644 index 000000000000..b39f820b6bcf --- /dev/null +++ b/Source/bindings/tests/results/V8TestInterfaceConstructor4.h @@ -0,0 +1,125 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! + +#ifndef V8TestInterfaceConstructor4_h +#define V8TestInterfaceConstructor4_h + +#include "bindings/tests/idls/TestInterfaceConstructor4.h" +#include "bindings/v8/V8Binding.h" +#include "bindings/v8/V8DOMWrapper.h" +#include "bindings/v8/WrapperTypeInfo.h" +#include "platform/heap/Handle.h" + +namespace WebCore { + +class V8TestInterfaceConstructor4 { +public: + static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); + static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*); + static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); + static TestInterfaceConstructor4* toNative(v8::Handle<v8::Object> object) + { + return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)); + } + static TestInterfaceConstructor4* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>); + static const WrapperTypeInfo wrapperTypeInfo; + static void derefObject(void*); + static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); + static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; + static inline void* toInternalPointer(TestInterfaceConstructor4* impl) + { + return impl; + } + + static inline TestInterfaceConstructor4* fromInternalPointer(void* object) + { + return static_cast<TestInterfaceConstructor4*>(object); + } + static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceConstructor4*, v8::Isolate*) { } + static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { } + +private: + friend v8::Handle<v8::Object> wrap(TestInterfaceConstructor4*, v8::Handle<v8::Object> creationContext, v8::Isolate*); + static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterfaceConstructor4>, v8::Handle<v8::Object> creationContext, v8::Isolate*); +}; + +v8::Handle<v8::Object> wrap(TestInterfaceConstructor4* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*); + +inline v8::Handle<v8::Value> toV8(TestInterfaceConstructor4* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + if (UNLIKELY(!impl)) + return v8::Null(isolate); + v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceConstructor4>(impl, isolate); + if (!wrapper.IsEmpty()) + return wrapper; + return wrap(impl, creationContext, isolate); +} + +template<typename CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceConstructor4* impl) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceConstructor4>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<typename CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceConstructor4* impl) +{ + ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceConstructor4>(callbackInfo.GetReturnValue(), impl)) + return; + v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceConstructor4* impl, Wrappable* wrappable) +{ + if (UNLIKELY(!impl)) { + v8SetReturnValueNull(callbackInfo); + return; + } + if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceConstructor4>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) + return; + v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); + v8SetReturnValue(callbackInfo, wrapper); +} + +inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterfaceConstructor4> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +{ + return toV8(impl.get(), creationContext, isolate); +} + +template<class CallbackInfo> +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceConstructor4> impl) +{ + v8SetReturnValue(callbackInfo, impl.get()); +} + +template<class CallbackInfo> +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceConstructor4> impl) +{ + v8SetReturnValueForMainWorld(callbackInfo, impl.get()); +} + +template<class CallbackInfo, class Wrappable> +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceConstructor4> impl, Wrappable* wrappable) +{ + v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); +} + +} +#endif // V8TestInterfaceConstructor4_h diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp index c88f5ba8ec65..4b312e40b928 100644 --- a/Source/bindings/tests/results/V8TestObject.cpp +++ b/Source/bindings/tests/results/V8TestObject.cpp @@ -6988,7 +6988,7 @@ static void voidMethodDefaultNullableStringArgMethod(const v8::FunctionCallbackI TestObject* impl = V8TestObject::toNative(info.Holder()); V8StringResource<> defaultStringArg; { - TOSTRING_VOID_INTERNAL(defaultStringArg, info[0]); + TOSTRING_VOID_INTERNAL(defaultStringArg, argumentOrNull(info, 0)); } impl->voidMethodDefaultNullableStringArg(defaultStringArg); } |