OLD | NEW |
1 /* | 1 /* |
2 This file is part of the Blink open source project. | 2 This file is part of the Blink open source project. |
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! | 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
4 | 4 |
5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Library General Public | 6 modify it under the terms of the GNU Library General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
8 version 2 of the License, or (at your option) any later version. | 8 version 2 of the License, or (at your option) any later version. |
9 | 9 |
10 This library is distributed in the hope that it will be useful, | 10 This library is distributed in the hope that it will be useful, |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "config.h" | 21 #include "config.h" |
22 #include "V8TestActiveDOMObject.h" | 22 #include "V8TestActiveDOMObject.h" |
23 | 23 |
24 #include "RuntimeEnabledFeatures.h" | 24 #include "RuntimeEnabledFeatures.h" |
25 #include "V8Node.h" | 25 #include "V8Node.h" |
26 #include "bindings/v8/BindingSecurity.h" | 26 #include "bindings/v8/BindingSecurity.h" |
27 #include "bindings/v8/ExceptionMessages.h" | 27 #include "bindings/v8/ExceptionMessages.h" |
28 #include "bindings/v8/ExceptionState.h" | 28 #include "bindings/v8/ExceptionState.h" |
29 #include "bindings/v8/ScriptController.h" | 29 #include "bindings/v8/ScriptController.h" |
30 #include "bindings/v8/V8Binding.h" | 30 #include "bindings/v8/V8Binding.h" |
| 31 #include "bindings/v8/V8DOMActivityLogger.h" |
31 #include "bindings/v8/V8DOMConfiguration.h" | 32 #include "bindings/v8/V8DOMConfiguration.h" |
32 #include "bindings/v8/V8DOMWrapper.h" | 33 #include "bindings/v8/V8DOMWrapper.h" |
33 #include "core/dom/ContextFeatures.h" | 34 #include "core/dom/ContextFeatures.h" |
34 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
35 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
36 #include "wtf/UnusedParam.h" | 37 #include "wtf/UnusedParam.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 static void initializeScriptWrappableForInterface(TestActiveDOMObject* object) | 41 static void initializeScriptWrappableForInterface(TestActiveDOMObject* object) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 v8SetReturnValue(info, privateTemplate->GetFunction()); | 162 v8SetReturnValue(info, privateTemplate->GetFunction()); |
162 } | 163 } |
163 | 164 |
164 static void postMessageAttributeGetterCallback(v8::Local<v8::String> name, const
v8::PropertyCallbackInfo<v8::Value>& info) | 165 static void postMessageAttributeGetterCallback(v8::Local<v8::String> name, const
v8::PropertyCallbackInfo<v8::Value>& info) |
165 { | 166 { |
166 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 167 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
167 TestActiveDOMObjectV8Internal::postMessageAttributeGetter(name, info); | 168 TestActiveDOMObjectV8Internal::postMessageAttributeGetter(name, info); |
168 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 169 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
169 } | 170 } |
170 | 171 |
| 172 static void perWorldBindingsMethodWithDoNotCheckSecurityMethod(const v8::Functio
nCallbackInfo<v8::Value>& args) |
| 173 { |
| 174 if (UNLIKELY(args.Length() < 1)) { |
| 175 throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
dWithDoNotCheckSecurity", "TestActiveDOMObject", ExceptionMessages::notEnoughArg
uments(1, args.Length())), args.GetIsolate()); |
| 176 return; |
| 177 } |
| 178 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(args.Holder()); |
| 179 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, args[0]); |
| 180 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); |
| 181 } |
| 182 |
| 183 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodForMainWorld(const
v8::FunctionCallbackInfo<v8::Value>& args) |
| 184 { |
| 185 if (UNLIKELY(args.Length() < 1)) { |
| 186 throwTypeError(ExceptionMessages::failedToExecute("perWorldBindingsMetho
dWithDoNotCheckSecurity", "TestActiveDOMObject", ExceptionMessages::notEnoughArg
uments(1, args.Length())), args.GetIsolate()); |
| 187 return; |
| 188 } |
| 189 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(args.Holder()); |
| 190 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, url, args[0]); |
| 191 imp->perWorldBindingsMethodWithDoNotCheckSecurity(url); |
| 192 } |
| 193 |
| 194 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallback(const v8:
:FunctionCallbackInfo<v8::Value>& args) |
| 195 { |
| 196 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 197 V8PerContextData* contextData = V8PerContextData::from(args.GetIsolate()->Ge
tCurrentContext()); |
| 198 if (contextData && contextData->activityLogger()) { |
| 199 Vector<v8::Handle<v8::Value> > loggerArgs = toVectorOfArguments(args); |
| 200 contextData->activityLogger()->log("TestActiveDOMObject.perWorldBindings
MethodWithDoNotCheckSecurity", args.Length(), loggerArgs.data(), "Method"); |
| 201 } |
| 202 TestActiveDOMObjectV8Internal::perWorldBindingsMethodWithDoNotCheckSecurityM
ethod(args); |
| 203 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 204 } |
| 205 |
| 206 static void perWorldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWor
ld(const v8::FunctionCallbackInfo<v8::Value>& args) |
| 207 { |
| 208 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 209 TestActiveDOMObjectV8Internal::perWorldBindingsMethodWithDoNotCheckSecurityM
ethodForMainWorld(args); |
| 210 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 211 } |
| 212 |
| 213 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetter(v8::Loca
l<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 214 { |
| 215 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 216 static int privateTemplateUniqueKey; |
| 217 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 218 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 219 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestActiveDOMObjectV8Internal::perWorl
dBindingsMethodWithDoNotCheckSecurityMethodCallback, v8Undefined(), v8::Signatur
e::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestActiveDOMOb
ject::wrapperTypeInfo, currentWorldType)), 1); |
| 220 |
| 221 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestActiveDOMObject::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 222 if (holder.IsEmpty()) { |
| 223 // can only reach here by 'object.__proto__.func', and it should passed |
| 224 // domain security check already |
| 225 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 226 return; |
| 227 } |
| 228 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder); |
| 229 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 230 static int sharedTemplateUniqueKey; |
| 231 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestActiveDOMObjectV8Internal::perWo
rldBindingsMethodWithDoNotCheckSecurityMethodCallback, v8Undefined(), v8::Signat
ure::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8TestActiveDOM
Object::wrapperTypeInfo, currentWorldType)), 1); |
| 232 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 233 return; |
| 234 } |
| 235 |
| 236 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(name); |
| 237 if (!hiddenValue.IsEmpty()) { |
| 238 v8SetReturnValue(info, hiddenValue); |
| 239 return; |
| 240 } |
| 241 |
| 242 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 243 } |
| 244 |
| 245 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterCallback(
v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 246 { |
| 247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 248 TestActiveDOMObjectV8Internal::perWorldBindingsMethodWithDoNotCheckSecurityA
ttributeGetter(name, info); |
| 249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 250 } |
| 251 |
| 252 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterForMainWo
rld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 253 { |
| 254 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 255 static int privateTemplateUniqueKey; |
| 256 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
| 257 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
| 258 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, TestActiveDOMObjectV8Internal::perWorl
dBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWorld, v8Undefined(),
v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8Tes
tActiveDOMObject::wrapperTypeInfo, currentWorldType)), 1); |
| 259 |
| 260 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestActiveDOMObject::GetTemplate(info.GetIsolate(), currentWorldType)); |
| 261 if (holder.IsEmpty()) { |
| 262 // can only reach here by 'object.__proto__.func', and it should passed |
| 263 // domain security check already |
| 264 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 265 return; |
| 266 } |
| 267 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder); |
| 268 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu
rityError)) { |
| 269 static int sharedTemplateUniqueKey; |
| 270 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, TestActiveDOMObjectV8Internal::perWo
rldBindingsMethodWithDoNotCheckSecurityMethodCallbackForMainWorld, v8Undefined()
, v8::Signature::New(V8PerIsolateData::from(info.GetIsolate())->rawTemplate(&V8T
estActiveDOMObject::wrapperTypeInfo, currentWorldType)), 1); |
| 271 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 272 return; |
| 273 } |
| 274 |
| 275 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(name); |
| 276 if (!hiddenValue.IsEmpty()) { |
| 277 v8SetReturnValue(info, hiddenValue); |
| 278 return; |
| 279 } |
| 280 |
| 281 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 282 } |
| 283 |
| 284 static void perWorldBindingsMethodWithDoNotCheckSecurityAttributeGetterCallbackF
orMainWorld(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value
>& info) |
| 285 { |
| 286 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 287 TestActiveDOMObjectV8Internal::perWorldBindingsMethodWithDoNotCheckSecurityA
ttributeGetterForMainWorld(name, info); |
| 288 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 289 } |
| 290 |
171 static void TestActiveDOMObjectDomainSafeFunctionSetter(v8::Local<v8::String> na
me, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 291 static void TestActiveDOMObjectDomainSafeFunctionSetter(v8::Local<v8::String> na
me, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
172 { | 292 { |
173 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestActiveDOMObject::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate())
)); | 293 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8
TestActiveDOMObject::GetTemplate(info.GetIsolate(), worldType(info.GetIsolate())
)); |
174 if (holder.IsEmpty()) | 294 if (holder.IsEmpty()) |
175 return; | 295 return; |
176 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder); | 296 TestActiveDOMObject* imp = V8TestActiveDOMObject::toNative(holder); |
177 ExceptionState es(info.GetIsolate()); | 297 ExceptionState es(info.GetIsolate()); |
178 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), es)) { | 298 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), es)) { |
179 es.throwIfNeeded(); | 299 es.throwIfNeeded(); |
180 return; | 300 return; |
(...skipping 25 matching lines...) Expand all Loading... |
206 | 326 |
207 // Custom Signature 'excitingFunction' | 327 // Custom Signature 'excitingFunction' |
208 const int excitingFunctionArgc = 1; | 328 const int excitingFunctionArgc = 1; |
209 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc]
= { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre
ntWorldType) }; | 329 v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc]
= { V8PerIsolateData::from(isolate)->rawTemplate(&V8Node::wrapperTypeInfo, curre
ntWorldType) }; |
210 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(des
c, excitingFunctionArgc, excitingFunctionArgv); | 330 v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(des
c, excitingFunctionArgc, excitingFunctionArgv); |
211 proto->Set(v8::String::NewSymbol("excitingFunction"), v8::FunctionTemplate::
New(TestActiveDOMObjectV8Internal::excitingFunctionMethodCallback, v8Undefined()
, excitingFunctionSignature, 1)); | 331 proto->Set(v8::String::NewSymbol("excitingFunction"), v8::FunctionTemplate::
New(TestActiveDOMObjectV8Internal::excitingFunctionMethodCallback, v8Undefined()
, excitingFunctionSignature, 1)); |
212 | 332 |
213 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') | 333 // Function 'postMessage' (Extended Attributes: 'DoNotCheckSecurity') |
214 proto->SetAccessor(v8::String::NewSymbol("postMessage"), TestActiveDOMObject
V8Internal::postMessageAttributeGetterCallback, TestActiveDOMObjectV8Internal::T
estActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, sta
tic_cast<v8::PropertyAttribute>(v8::DontDelete)); | 334 proto->SetAccessor(v8::String::NewSymbol("postMessage"), TestActiveDOMObject
V8Internal::postMessageAttributeGetterCallback, TestActiveDOMObjectV8Internal::T
estActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, sta
tic_cast<v8::PropertyAttribute>(v8::DontDelete)); |
215 | 335 |
| 336 // Function 'perWorldBindingsMethodWithDoNotCheckSecurity' (Extended Attribu
tes: 'DoNotCheckSecurity PerWorldBindings ActivityLogging') |
| 337 if (currentWorldType == MainWorld) { |
| 338 proto->SetAccessor(v8::String::NewSymbol("perWorldBindingsMethodWithDoNo
tCheckSecurity"), TestActiveDOMObjectV8Internal::perWorldBindingsMethodWithDoNot
CheckSecurityAttributeGetterCallbackForMainWorld, TestActiveDOMObjectV8Internal:
:TestActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, s
tatic_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| 339 } else { |
| 340 proto->SetAccessor(v8::String::NewSymbol("perWorldBindingsMethodWithDoNo
tCheckSecurity"), TestActiveDOMObjectV8Internal::perWorldBindingsMethodWithDoNot
CheckSecurityAttributeGetterCallback, TestActiveDOMObjectV8Internal::TestActiveD
OMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v
8::PropertyAttribute>(v8::DontDelete)); |
| 341 } |
| 342 |
216 // Custom toString template | 343 // Custom toString template |
217 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 344 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
218 return desc; | 345 return desc; |
219 } | 346 } |
220 | 347 |
221 v8::Handle<v8::FunctionTemplate> V8TestActiveDOMObject::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 348 v8::Handle<v8::FunctionTemplate> V8TestActiveDOMObject::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) |
222 { | 349 { |
223 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 350 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
224 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 351 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
225 if (result != data->templateMap(currentWorldType).end()) | 352 if (result != data->templateMap(currentWorldType).end()) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObject>(impl, &wrapp
erTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 391 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObject>(impl, &wrapp
erTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
265 return wrapper; | 392 return wrapper; |
266 } | 393 } |
267 | 394 |
268 void V8TestActiveDOMObject::derefObject(void* object) | 395 void V8TestActiveDOMObject::derefObject(void* object) |
269 { | 396 { |
270 fromInternalPointer(object)->deref(); | 397 fromInternalPointer(object)->deref(); |
271 } | 398 } |
272 | 399 |
273 } // namespace WebCore | 400 } // namespace WebCore |
OLD | NEW |