X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fbindings%2Ftests%2Fresults%2FV8TestInterfaceNamedConstructor.cpp;h=9567b39369720ef3162213e12e06a006cf5ca56e;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=4c0861e5c757e42bed4c1191b60235eeb30896a7;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp b/src/third_party/WebKit/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp index 4c0861e..9567b39 100644 --- a/src/third_party/WebKit/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp +++ b/src/third_party/WebKit/Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp @@ -24,7 +24,7 @@ namespace WebCore { static void initializeScriptWrappableForInterface(TestInterfaceNamedConstructor* object) { if (ScriptWrappable::wrapperCanBeStoredInObject(object)) - ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceNamedConstructor::wrapperTypeInfo); + ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceNamedConstructor::wrapperTypeInfo); else ASSERT_NOT_REACHED(); } @@ -37,7 +37,7 @@ void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceNamedCon } namespace WebCore { -const WrapperTypeInfo V8TestInterfaceNamedConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructor::domTemplate, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructor::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; +const WrapperTypeInfo V8TestInterfaceNamedConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructor::domTemplate, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructor::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject }; namespace TestInterfaceNamedConstructorV8Internal { @@ -55,7 +55,8 @@ static void TestInterfaceNamedConstructorConstructorGetter(v8::Local static void TestInterfaceNamedConstructorReplaceableAttributeSetter(v8::Local name, v8::Local v8Value, const v8::PropertyCallbackInfo& info) { - info.This()->ForceSet(name, v8Value); + if (info.This()->IsObject()) + v8::Handle::Cast(info.This())->ForceSet(name, v8Value); } static void TestInterfaceNamedConstructorReplaceableAttributeSetterCallback(v8::Local name, v8::Local v8Value, const v8::PropertyCallbackInfo& info) @@ -69,44 +70,52 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNamedCons {"testNamedConstructorConstructorAttribute", TestInterfaceNamedConstructorV8Internal::TestInterfaceNamedConstructorConstructorGetter, TestInterfaceNamedConstructorV8Internal::TestInterfaceNamedConstructorReplaceableAttributeSetterCallback, 0, 0, const_cast(&V8TestNamedConstructor::wrapperTypeInfo), static_cast(v8::DEFAULT), static_cast(v8::DontEnum), 0 /* on instance */}, }; -const WrapperTypeInfo V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructorConstructor::domTemplate, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructor::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; +const WrapperTypeInfo V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructorConstructor::domTemplate, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructor::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject }; static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::FunctionCallbackInfo& info) { + v8::Isolate* isolate = info.GetIsolate(); if (!info.IsConstructCall()) { - throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audio"), info.GetIsolate()); + throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audio"), isolate); return; } - if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { + if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject) { v8SetReturnValue(info, info.Holder()); return; } - Document* document = currentDOMWindow(info.GetIsolate())->document(); + Document* document = currentDOMWindow(isolate)->document(); ASSERT(document); // Make sure the document is added to the DOM Node map. Otherwise, the TestInterfaceNamedConstructor instance // may end up being the only node in the map and get garbage-collected prematurely. - toV8(document, info.Holder(), info.GetIsolate()); + toV8(document, info.Holder(), isolate); - ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceNamedConstructor", info.Holder(), info.GetIsolate()); + ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceNamedConstructor", info.Holder(), isolate); if (UNLIKELY(info.Length() < 1)) { - exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); - exceptionState.throwIfNeeded(); + throwArityTypeError(exceptionState, 1, info.Length()); return; } - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]); - V8TRYCATCH_VOID(bool, defaultUndefinedOptionalBooleanArg, info[1]->BooleanValue()); - V8TRYCATCH_EXCEPTION_VOID(int, defaultUndefinedOptionalLongArg, toInt32(info[2], exceptionState), exceptionState); - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOptionalStringArg, info[3]); - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOptionalstringArg, argumentOrNull(info, 4)); - RefPtr impl = TestInterfaceNamedConstructor::createForJSConstructor(*document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalstringArg, exceptionState); + TOSTRING_VOID(V8StringResource<>, stringArg, info[0]); + TONATIVE_VOID(bool, defaultUndefinedOptionalBooleanArg, info[1]->BooleanValue()); + TONATIVE_VOID_EXCEPTIONSTATE(int, defaultUndefinedOptionalLongArg, toInt32(info[2], exceptionState), exceptionState); + TOSTRING_VOID(V8StringResource<>, defaultUndefinedOptionalStringArg, info[3]); + TOSTRING_VOID(V8StringResource<>, defaultNullStringOptionalstringArg, argumentOrNull(info, 4)); + if (UNLIKELY(info.Length() <= 5)) { + RefPtr impl = TestInterfaceNamedConstructor::createForJSConstructor(stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalstringArg); + v8::Handle wrapper = info.Holder(); + V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); + v8SetReturnValue(info, wrapper); + return; + } + TOSTRING_VOID(V8StringResource<>, optionalStringArg, info[5]); + RefPtr impl = TestInterfaceNamedConstructor::createForJSConstructor(*document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalstringArg, optionalStringArg, exceptionState); if (exceptionState.throwIfNeeded()) return; v8::Handle wrapper = info.Holder(); - V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent); + V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); v8SetReturnValue(info, wrapper); } @@ -138,11 +147,11 @@ static void configureV8TestInterfaceNamedConstructorTemplate(v8::Handle ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate(); - v8::Local ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate(); + v8::Local instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate(); + v8::Local prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate(); // Custom toString template - functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::current()->toStringTemplate()); + functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); } v8::Handle V8TestInterfaceNamedConstructor::domTemplate(v8::Isolate* isolate) @@ -184,7 +193,7 @@ v8::Handle V8TestInterfaceNamedConstructor::createWrapper(PassRefPtr ASSERT(impl); ASSERT(!DOMDataStore::containsWrapper(impl.get(), isolate)); if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { - const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(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);