| OLD | NEW |
| 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
| 5 # Copyright (C) 2006 Apple Computer, Inc. | 5 # Copyright (C) 2006 Apple Computer, Inc. |
| 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. | 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. |
| 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
| 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. | 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 { | 1209 { |
| 1210 my $function = shift; | 1210 my $function = shift; |
| 1211 my $interface = shift; | 1211 my $interface = shift; |
| 1212 my $forMainWorldSuffix = shift; | 1212 my $forMainWorldSuffix = shift; |
| 1213 | 1213 |
| 1214 my $implClassName = GetImplName($interface); | 1214 my $implClassName = GetImplName($interface); |
| 1215 my $v8ClassName = GetV8ClassName($interface); | 1215 my $v8ClassName = GetV8ClassName($interface); |
| 1216 my $funcName = $function->name; | 1216 my $funcName = $function->name; |
| 1217 | 1217 |
| 1218 my $functionLength = GetFunctionLength($function); | 1218 my $functionLength = GetFunctionLength($function); |
| 1219 my $signature = "v8::Signature::New(info.GetIsolate(), V8PerIsolateData::fro
m(info.GetIsolate())->rawDOMTemplate(&" . $v8ClassName . "::wrapperTypeInfo, cur
rentWorldType))"; | 1219 my $signature = "v8::Signature::New(info.GetIsolate(), ${v8ClassName}::domTe
mplate(info.GetIsolate(), currentWorldType))"; |
| 1220 if ($function->extendedAttributes->{"DoNotCheckSignature"}) { | 1220 if ($function->extendedAttributes->{"DoNotCheckSignature"}) { |
| 1221 $signature = "v8::Local<v8::Signature>()"; | 1221 $signature = "v8::Local<v8::Signature>()"; |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 my $newTemplateParams = "${implClassName}V8Internal::${funcName}MethodCallba
ck${forMainWorldSuffix}, v8Undefined(), $signature"; | 1224 my $newTemplateParams = "${implClassName}V8Internal::${funcName}MethodCallba
ck${forMainWorldSuffix}, v8Undefined(), $signature"; |
| 1225 | 1225 |
| 1226 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 1226 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
| 1227 $implementation{nameSpaceInternal}->add(<<END); | 1227 $implementation{nameSpaceInternal}->add(<<END); |
| 1228 static void ${funcName}OriginSafeMethodGetter${forMainWorldSuffix}(const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 1228 static void ${funcName}OriginSafeMethodGetter${forMainWorldSuffix}(const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 1229 { | 1229 { |
| (...skipping 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4479 | 4479 |
| 4480 my $accessCheck = ""; | 4480 my $accessCheck = ""; |
| 4481 if ($interface->extendedAttributes->{"CheckSecurity"} && $interfaceName ne "
Window") { | 4481 if ($interface->extendedAttributes->{"CheckSecurity"} && $interfaceName ne "
Window") { |
| 4482 $accessCheck = "instanceTemplate->SetAccessCheckCallbacks(${implClassNam
e}V8Internal::namedSecurityCheck, ${implClassName}V8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&${v8ClassName}::wra
pperTypeInfo)));"; | 4482 $accessCheck = "instanceTemplate->SetAccessCheckCallbacks(${implClassNam
e}V8Internal::namedSecurityCheck, ${implClassName}V8Internal::indexedSecurityChe
ck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&${v8ClassName}::wra
pperTypeInfo)));"; |
| 4483 } | 4483 } |
| 4484 | 4484 |
| 4485 # For the Window interface, generate the shadow object template | 4485 # For the Window interface, generate the shadow object template |
| 4486 # configuration method. | 4486 # configuration method. |
| 4487 if ($interfaceName eq "Window") { | 4487 if ($interfaceName eq "Window") { |
| 4488 $implementation{nameSpaceWebCore}->add(<<END); | 4488 $implementation{nameSpaceWebCore}->add(<<END); |
| 4489 static void ConfigureShadowObjectTemplate(v8::Handle<v8::ObjectTemplate> templ,
v8::Isolate* isolate, WrapperWorldType currentWorldType) | 4489 static void configureShadowObjectTemplate(v8::Handle<v8::ObjectTemplate> templ,
v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 4490 { | 4490 { |
| 4491 V8DOMConfiguration::installAttributes(templ, v8::Handle<v8::ObjectTemplate>(
), shadowAttributes, WTF_ARRAY_LENGTH(shadowAttributes), isolate, currentWorldTy
pe); | 4491 V8DOMConfiguration::installAttributes(templ, v8::Handle<v8::ObjectTemplate>(
), shadowAttributes, WTF_ARRAY_LENGTH(shadowAttributes), isolate, currentWorldTy
pe); |
| 4492 | 4492 |
| 4493 // Install a security handler with V8. | 4493 // Install a security handler with V8. |
| 4494 templ->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom, V8Window:
:indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<WrapperTypeIn
fo*>(&V8Window::wrapperTypeInfo))); | 4494 templ->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom, V8Window:
:indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<WrapperTypeIn
fo*>(&V8Window::wrapperTypeInfo))); |
| 4495 templ->SetInternalFieldCount(V8Window::internalFieldCount); | 4495 templ->SetInternalFieldCount(V8Window::internalFieldCount); |
| 4496 } | 4496 } |
| 4497 END | 4497 END |
| 4498 } | 4498 } |
| 4499 | 4499 |
| 4500 if (!$parentClassTemplate) { | 4500 if (!$parentClassTemplate) { |
| 4501 $parentClassTemplate = "v8::Local<v8::FunctionTemplate>()"; | 4501 $parentClassTemplate = "v8::Local<v8::FunctionTemplate>()"; |
| 4502 } | 4502 } |
| 4503 | 4503 |
| 4504 # Generate the template configuration method | 4504 # Generate the template configuration method |
| 4505 $code = <<END; | 4505 $code = <<END; |
| 4506 static v8::Handle<v8::FunctionTemplate> Configure${v8ClassName}Template(v8::Hand
le<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldTyp
e currentWorldType) | 4506 static void configure${v8ClassName}Template(v8::Handle<v8::FunctionTemplate> fun
ctionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 4507 { | 4507 { |
| 4508 functionTemplate->ReadOnlyPrototype(); | 4508 functionTemplate->ReadOnlyPrototype(); |
| 4509 | 4509 |
| 4510 v8::Local<v8::Signature> defaultSignature; | 4510 v8::Local<v8::Signature> defaultSignature; |
| 4511 END | 4511 END |
| 4512 | 4512 |
| 4513 # Define constants, attributes, accessors and operations. | 4513 # Define constants, attributes, accessors and operations. |
| 4514 my $runtimeEnabledIndent = ""; | 4514 my $runtimeEnabledIndent = ""; |
| 4515 if ($interface->extendedAttributes->{"RuntimeEnabled"}) { | 4515 if ($interface->extendedAttributes->{"RuntimeEnabled"}) { |
| 4516 my $runtimeEnabledFunction = GetRuntimeEnabledFunctionName($interface); | 4516 my $runtimeEnabledFunction = GetRuntimeEnabledFunctionName($interface); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4635 if ($interfaceName eq "HTMLDocument" or $interfaceName eq "DedicatedWorkerGl
obalScope" or $interfaceName eq "SharedWorkerGlobalScope" or $interfaceName eq "
ServiceWorkerGlobalScope") { | 4635 if ($interfaceName eq "HTMLDocument" or $interfaceName eq "DedicatedWorkerGl
obalScope" or $interfaceName eq "SharedWorkerGlobalScope" or $interfaceName eq "
ServiceWorkerGlobalScope") { |
| 4636 $code .= <<END; | 4636 $code .= <<END; |
| 4637 functionTemplate->SetHiddenPrototype(true); | 4637 functionTemplate->SetHiddenPrototype(true); |
| 4638 END | 4638 END |
| 4639 } | 4639 } |
| 4640 | 4640 |
| 4641 $code .= <<END; | 4641 $code .= <<END; |
| 4642 | 4642 |
| 4643 // Custom toString template | 4643 // Custom toString template |
| 4644 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 4644 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 4645 return functionTemplate; | |
| 4646 } | 4645 } |
| 4647 | 4646 |
| 4648 END | 4647 END |
| 4649 $implementation{nameSpaceWebCore}->add($code); | 4648 $implementation{nameSpaceWebCore}->add($code); |
| 4650 | 4649 |
| 4650 AddToImplIncludes("bindings/v8/V8ObjectConstructor.h"); |
| 4651 $implementation{nameSpaceWebCore}->add(<<END); | 4651 $implementation{nameSpaceWebCore}->add(<<END); |
| 4652 v8::Handle<v8::FunctionTemplate> ${v8ClassName}::domTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) | 4652 v8::Handle<v8::FunctionTemplate> ${v8ClassName}::domTemplate(v8::Isolate* isolat
e, WrapperWorldType currentWorldType) |
| 4653 { | 4653 { |
| 4654 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 4654 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 4655 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 4655 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 4656 if (result != data->templateMap(currentWorldType).end()) | 4656 if (result != data->templateMap(currentWorldType).end()) |
| 4657 return result->value.newLocal(isolate); | 4657 return result->value.newLocal(isolate); |
| 4658 | 4658 |
| 4659 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 4659 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 4660 v8::EscapableHandleScope handleScope(isolate); | 4660 v8::EscapableHandleScope handleScope(isolate); |
| 4661 v8::Local<v8::FunctionTemplate> templ = | 4661 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 4662 Configure${v8ClassName}Template(data->rawDOMTemplate(&wrapperTypeInfo, c
urrentWorldType), isolate, currentWorldType); | 4662 configure${v8ClassName}Template(templ, isolate, currentWorldType); |
| 4663 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 4663 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 4664 return handleScope.Escape(templ); | 4664 return handleScope.Escape(templ); |
| 4665 } | 4665 } |
| 4666 | 4666 |
| 4667 END | 4667 END |
| 4668 $implementation{nameSpaceWebCore}->add(<<END); | 4668 $implementation{nameSpaceWebCore}->add(<<END); |
| 4669 bool ${v8ClassName}::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late, WrapperWorldType currentWorldType) | 4669 bool ${v8ClassName}::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late, WrapperWorldType currentWorldType) |
| 4670 { | 4670 { |
| 4671 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 4671 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 4672 } | 4672 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4764 | 4764 |
| 4765 if ($interfaceName eq "Window") { | 4765 if ($interfaceName eq "Window") { |
| 4766 $implementation{nameSpaceWebCore}->add(<<END); | 4766 $implementation{nameSpaceWebCore}->add(<<END); |
| 4767 v8::Handle<v8::ObjectTemplate> V8Window::GetShadowObjectTemplate(v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 4767 v8::Handle<v8::ObjectTemplate> V8Window::GetShadowObjectTemplate(v8::Isolate* is
olate, WrapperWorldType currentWorldType) |
| 4768 { | 4768 { |
| 4769 if (currentWorldType == MainWorld) { | 4769 if (currentWorldType == MainWorld) { |
| 4770 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForMainWorld, ()); | 4770 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForMainWorld, ()); |
| 4771 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) { | 4771 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) { |
| 4772 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 4772 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 4773 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola
te); | 4773 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola
te); |
| 4774 ConfigureShadowObjectTemplate(templ, isolate, currentWorldType); | 4774 configureShadowObjectTemplate(templ, isolate, currentWorldType); |
| 4775 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ); | 4775 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ); |
| 4776 return templ; | 4776 return templ; |
| 4777 } | 4777 } |
| 4778 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForMainWorld); | 4778 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForMainWorld); |
| 4779 } else { | 4779 } else { |
| 4780 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForNonMainWorld, ()); | 4780 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb
jectCacheForNonMainWorld, ()); |
| 4781 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) { | 4781 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) { |
| 4782 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 4782 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 4783 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola
te); | 4783 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola
te); |
| 4784 ConfigureShadowObjectTemplate(templ, isolate, currentWorldType); | 4784 configureShadowObjectTemplate(templ, isolate, currentWorldType); |
| 4785 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); | 4785 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); |
| 4786 return templ; | 4786 return templ; |
| 4787 } | 4787 } |
| 4788 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForNonMainWorld); | 4788 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC
acheForNonMainWorld); |
| 4789 } | 4789 } |
| 4790 } | 4790 } |
| 4791 | 4791 |
| 4792 END | 4792 END |
| 4793 } | 4793 } |
| 4794 | 4794 |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6307 | 6307 |
| 6308 foreach my $parameter (@{$function->parameters}) { | 6308 foreach my $parameter (@{$function->parameters}) { |
| 6309 if ($parameter->type eq "SerializedScriptValue") { | 6309 if ($parameter->type eq "SerializedScriptValue") { |
| 6310 return 1; | 6310 return 1; |
| 6311 } | 6311 } |
| 6312 } | 6312 } |
| 6313 return 0; | 6313 return 0; |
| 6314 } | 6314 } |
| 6315 | 6315 |
| 6316 1; | 6316 1; |
| OLD | NEW |