OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "config.h" | 33 #include "config.h" |
34 #include "V8TestObjectPython.h" | 34 #include "V8TestObjectPython.h" |
35 | 35 |
36 #include "HTMLNames.h" | 36 #include "HTMLNames.h" |
37 #include "RuntimeEnabledFeatures.h" | 37 #include "RuntimeEnabledFeatures.h" |
38 #include "V8Attr.h" | 38 #include "V8Attr.h" |
39 #include "V8Document.h" | 39 #include "V8Document.h" |
40 #include "V8DocumentFragment.h" | 40 #include "V8DocumentFragment.h" |
41 #include "V8DocumentType.h" | 41 #include "V8DocumentType.h" |
42 #include "V8Element.h" | 42 #include "V8Element.h" |
| 43 #include "V8Event.h" |
43 #include "V8EventTarget.h" | 44 #include "V8EventTarget.h" |
44 #include "V8HTMLCollection.h" | 45 #include "V8HTMLCollection.h" |
45 #include "V8HTMLElement.h" | 46 #include "V8HTMLElement.h" |
46 #include "V8Node.h" | 47 #include "V8Node.h" |
47 #include "V8NodeFilter.h" | 48 #include "V8NodeFilter.h" |
48 #include "V8ShadowRoot.h" | 49 #include "V8ShadowRoot.h" |
49 #include "V8TestCallbackInterface.h" | 50 #include "V8TestCallbackInterface.h" |
50 #include "V8TestInterface.h" | 51 #include "V8TestInterface.h" |
51 #include "V8TestInterfaceEmpty.h" | 52 #include "V8TestInterfaceEmpty.h" |
52 #include "V8TestInterfacePython.h" | 53 #include "V8TestInterfacePython.h" |
(...skipping 6221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6274 } | 6275 } |
6275 } | 6276 } |
6276 | 6277 |
6277 static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 6278 static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
6278 { | 6279 { |
6279 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 6280 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
6280 TestObjectPythonV8Internal::removeEventListenerMethod(info); | 6281 TestObjectPythonV8Internal::removeEventListenerMethod(info); |
6281 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 6282 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
6282 } | 6283 } |
6283 | 6284 |
| 6285 static void dispatchEventMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 6286 { |
| 6287 ExceptionState exceptionState(ExceptionState::ExecutionContext, "dispatchEve
nt", "TestObjectPython", info.Holder(), info.GetIsolate()); |
| 6288 EventTarget* impl = V8TestObjectPython::toNative(info.Holder()); |
| 6289 if (DOMWindow* window = impl->toDOMWindow()) { |
| 6290 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { |
| 6291 exceptionState.throwIfNeeded(); |
| 6292 return; |
| 6293 } |
| 6294 if (!window->document()) |
| 6295 return; |
| 6296 } |
| 6297 if (UNLIKELY(info.Length() < 1)) { |
| 6298 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 6299 exceptionState.throwIfNeeded(); |
| 6300 return; |
| 6301 } |
| 6302 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
| 6303 V8TRYCATCH_VOID(Event*, event, V8Event::hasInstance(info[0], info.GetIsolate
()) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); |
| 6304 bool result = imp->dispatchEvent(event, exceptionState); |
| 6305 if (exceptionState.throwIfNeeded()) |
| 6306 return; |
| 6307 v8SetReturnValueBool(info, result); |
| 6308 } |
| 6309 |
| 6310 static void dispatchEventMethodCallback(const v8::FunctionCallbackInfo<v8::Value
>& info) |
| 6311 { |
| 6312 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 6313 TestObjectPythonV8Internal::dispatchEventMethod(info); |
| 6314 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 6315 } |
| 6316 |
6284 static void voidMethodClampUnsignedShortArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) | 6317 static void voidMethodClampUnsignedShortArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) |
6285 { | 6318 { |
6286 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodC
lampUnsignedShortArg", "TestObjectPython", info.Holder(), info.GetIsolate()); | 6319 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodC
lampUnsignedShortArg", "TestObjectPython", info.Holder(), info.GetIsolate()); |
6287 if (UNLIKELY(info.Length() < 1)) { | 6320 if (UNLIKELY(info.Length() < 1)) { |
6288 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 6321 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
6289 exceptionState.throwIfNeeded(); | 6322 exceptionState.throwIfNeeded(); |
6290 return; | 6323 return; |
6291 } | 6324 } |
6292 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); | 6325 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
6293 unsigned clampUnsignedShortArg = 0; | 6326 unsigned clampUnsignedShortArg = 0; |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7462 {"overloadedMethodB", TestObjectPythonV8Internal::overloadedMethodBMethodCal
lback, 0, 1}, | 7495 {"overloadedMethodB", TestObjectPythonV8Internal::overloadedMethodBMethodCal
lback, 0, 1}, |
7463 {"overloadedMethodC", TestObjectPythonV8Internal::overloadedMethodCMethodCal
lback, 0, 1}, | 7496 {"overloadedMethodC", TestObjectPythonV8Internal::overloadedMethodCMethodCal
lback, 0, 1}, |
7464 {"overloadedMethodD", TestObjectPythonV8Internal::overloadedMethodDMethodCal
lback, 0, 1}, | 7497 {"overloadedMethodD", TestObjectPythonV8Internal::overloadedMethodDMethodCal
lback, 0, 1}, |
7465 {"overloadedMethodE", TestObjectPythonV8Internal::overloadedMethodEMethodCal
lback, 0, 1}, | 7498 {"overloadedMethodE", TestObjectPythonV8Internal::overloadedMethodEMethodCal
lback, 0, 1}, |
7466 {"overloadedMethodF", TestObjectPythonV8Internal::overloadedMethodFMethodCal
lback, 0, 1}, | 7499 {"overloadedMethodF", TestObjectPythonV8Internal::overloadedMethodFMethodCal
lback, 0, 1}, |
7467 {"overloadedMethodG", TestObjectPythonV8Internal::overloadedMethodGMethodCal
lback, 0, 0}, | 7500 {"overloadedMethodG", TestObjectPythonV8Internal::overloadedMethodGMethodCal
lback, 0, 0}, |
7468 {"overloadedMethodH", TestObjectPythonV8Internal::overloadedMethodHMethodCal
lback, 0, 0}, | 7501 {"overloadedMethodH", TestObjectPythonV8Internal::overloadedMethodHMethodCal
lback, 0, 0}, |
7469 {"overloadedPerWorldBindingsMethod", TestObjectPythonV8Internal::overloadedP
erWorldBindingsMethodMethodCallback, TestObjectPythonV8Internal::overloadedPerWo
rldBindingsMethodMethodCallbackForMainWorld, 0}, | 7502 {"overloadedPerWorldBindingsMethod", TestObjectPythonV8Internal::overloadedP
erWorldBindingsMethodMethodCallback, TestObjectPythonV8Internal::overloadedPerWo
rldBindingsMethodMethodCallbackForMainWorld, 0}, |
7470 {"addEventListener", TestObjectPythonV8Internal::addEventListenerMethodCallb
ack, 0, 2}, | 7503 {"addEventListener", TestObjectPythonV8Internal::addEventListenerMethodCallb
ack, 0, 2}, |
7471 {"removeEventListener", TestObjectPythonV8Internal::removeEventListenerMetho
dCallback, 0, 2}, | 7504 {"removeEventListener", TestObjectPythonV8Internal::removeEventListenerMetho
dCallback, 0, 2}, |
| 7505 {"dispatchEvent", TestObjectPythonV8Internal::dispatchEventMethodCallback, 0
, 1}, |
7472 {"voidMethodClampUnsignedShortArg", TestObjectPythonV8Internal::voidMethodCl
ampUnsignedShortArgMethodCallback, 0, 1}, | 7506 {"voidMethodClampUnsignedShortArg", TestObjectPythonV8Internal::voidMethodCl
ampUnsignedShortArgMethodCallback, 0, 1}, |
7473 {"voidMethodClampUnsignedLongArg", TestObjectPythonV8Internal::voidMethodCla
mpUnsignedLongArgMethodCallback, 0, 1}, | 7507 {"voidMethodClampUnsignedLongArg", TestObjectPythonV8Internal::voidMethodCla
mpUnsignedLongArgMethodCallback, 0, 1}, |
7474 {"voidMethodDefaultUndefinedTestInterfaceEmptyArg", TestObjectPythonV8Intern
al::voidMethodDefaultUndefinedTestInterfaceEmptyArgMethodCallback, 0, 0}, | 7508 {"voidMethodDefaultUndefinedTestInterfaceEmptyArg", TestObjectPythonV8Intern
al::voidMethodDefaultUndefinedTestInterfaceEmptyArgMethodCallback, 0, 0}, |
7475 {"voidMethodDefaultUndefinedLongArg", TestObjectPythonV8Internal::voidMethod
DefaultUndefinedLongArgMethodCallback, 0, 0}, | 7509 {"voidMethodDefaultUndefinedLongArg", TestObjectPythonV8Internal::voidMethod
DefaultUndefinedLongArgMethodCallback, 0, 0}, |
7476 {"voidMethodDefaultUndefinedStringArg", TestObjectPythonV8Internal::voidMeth
odDefaultUndefinedStringArgMethodCallback, 0, 0}, | 7510 {"voidMethodDefaultUndefinedStringArg", TestObjectPythonV8Internal::voidMeth
odDefaultUndefinedStringArgMethodCallback, 0, 0}, |
7477 {"voidMethodDefaultNullStringStringArg", TestObjectPythonV8Internal::voidMet
hodDefaultNullStringStringArgMethodCallback, 0, 0}, | 7511 {"voidMethodDefaultNullStringStringArg", TestObjectPythonV8Internal::voidMet
hodDefaultNullStringStringArgMethodCallback, 0, 0}, |
7478 {"voidMethodEnforceRangeLongArg", TestObjectPythonV8Internal::voidMethodEnfo
rceRangeLongArgMethodCallback, 0, 1}, | 7512 {"voidMethodEnforceRangeLongArg", TestObjectPythonV8Internal::voidMethodEnfo
rceRangeLongArgMethodCallback, 0, 1}, |
7479 {"voidMethodTreatNullAsNullStringStringArg", TestObjectPythonV8Internal::voi
dMethodTreatNullAsNullStringStringArgMethodCallback, 0, 1}, | 7513 {"voidMethodTreatNullAsNullStringStringArg", TestObjectPythonV8Internal::voi
dMethodTreatNullAsNullStringStringArgMethodCallback, 0, 1}, |
7480 {"voidMethodTreatNullAsNullStringTreatUndefinedAsNullStringStringArg", TestO
bjectPythonV8Internal::voidMethodTreatNullAsNullStringTreatUndefinedAsNullString
StringArgMethodCallback, 0, 1}, | 7514 {"voidMethodTreatNullAsNullStringTreatUndefinedAsNullStringStringArg", TestO
bjectPythonV8Internal::voidMethodTreatNullAsNullStringTreatUndefinedAsNullString
StringArgMethodCallback, 0, 1}, |
7481 {"activityLoggingAccessForAllWorldsMethod", TestObjectPythonV8Internal::acti
vityLoggingAccessForAllWorldsMethodMethodCallback, 0, 0}, | 7515 {"activityLoggingAccessForAllWorldsMethod", TestObjectPythonV8Internal::acti
vityLoggingAccessForAllWorldsMethodMethodCallback, 0, 0}, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7680 fromInternalPointer(object)->deref(); | 7714 fromInternalPointer(object)->deref(); |
7681 } | 7715 } |
7682 | 7716 |
7683 template<> | 7717 template<> |
7684 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) | 7718 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) |
7685 { | 7719 { |
7686 return toV8(impl, creationContext, isolate); | 7720 return toV8(impl, creationContext, isolate); |
7687 } | 7721 } |
7688 | 7722 |
7689 } // namespace WebCore | 7723 } // namespace WebCore |
OLD | NEW |