| 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" | |
| 44 #include "V8EventTarget.h" | 43 #include "V8EventTarget.h" |
| 45 #include "V8HTMLCollection.h" | 44 #include "V8HTMLCollection.h" |
| 46 #include "V8HTMLElement.h" | 45 #include "V8HTMLElement.h" |
| 47 #include "V8Node.h" | 46 #include "V8Node.h" |
| 48 #include "V8NodeFilter.h" | 47 #include "V8NodeFilter.h" |
| 49 #include "V8ShadowRoot.h" | 48 #include "V8ShadowRoot.h" |
| 50 #include "V8TestCallbackInterface.h" | 49 #include "V8TestCallbackInterface.h" |
| 51 #include "V8TestInterface.h" | 50 #include "V8TestInterface.h" |
| 52 #include "V8TestInterfaceEmpty.h" | 51 #include "V8TestInterfaceEmpty.h" |
| 53 #include "V8TestInterfacePython.h" | 52 #include "V8TestInterfacePython.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 72 #include "bindings/v8/V8ObjectConstructor.h" | 71 #include "bindings/v8/V8ObjectConstructor.h" |
| 73 #include "bindings/v8/custom/V8ArrayBufferCustom.h" | 72 #include "bindings/v8/custom/V8ArrayBufferCustom.h" |
| 74 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" | 73 #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" |
| 75 #include "bindings/v8/custom/V8Float32ArrayCustom.h" | 74 #include "bindings/v8/custom/V8Float32ArrayCustom.h" |
| 76 #include "bindings/v8/custom/V8Int32ArrayCustom.h" | 75 #include "bindings/v8/custom/V8Int32ArrayCustom.h" |
| 77 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" | 76 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" |
| 78 #include "core/css/MediaQueryListListener.h" | 77 #include "core/css/MediaQueryListListener.h" |
| 79 #include "core/dom/ContextFeatures.h" | 78 #include "core/dom/ContextFeatures.h" |
| 80 #include "core/dom/Document.h" | 79 #include "core/dom/Document.h" |
| 81 #include "core/dom/custom/CustomElementCallbackDispatcher.h" | 80 #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
| 82 #include "core/frame/DOMWindow.h" | |
| 83 #include "core/frame/UseCounter.h" | 81 #include "core/frame/UseCounter.h" |
| 84 #include "core/inspector/ScriptArguments.h" | 82 #include "core/inspector/ScriptArguments.h" |
| 85 #include "platform/TraceEvent.h" | 83 #include "platform/TraceEvent.h" |
| 86 #include "wtf/GetPtr.h" | 84 #include "wtf/GetPtr.h" |
| 87 #include "wtf/RefPtr.h" | 85 #include "wtf/RefPtr.h" |
| 88 | 86 |
| 89 namespace WebCore { | 87 namespace WebCore { |
| 90 | 88 |
| 91 static void initializeScriptWrappableForInterface(TestObjectPython* object) | 89 static void initializeScriptWrappableForInterface(TestObjectPython* object) |
| 92 { | 90 { |
| (...skipping 6212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6305 exceptionState.throwIfNeeded(); | 6303 exceptionState.throwIfNeeded(); |
| 6306 } | 6304 } |
| 6307 | 6305 |
| 6308 static void overloadedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) | 6306 static void overloadedStaticMethodMethodCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) |
| 6309 { | 6307 { |
| 6310 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 6308 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 6311 TestObjectPythonV8Internal::overloadedStaticMethodMethod(info); | 6309 TestObjectPythonV8Internal::overloadedStaticMethodMethod(info); |
| 6312 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 6310 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 6313 } | 6311 } |
| 6314 | 6312 |
| 6315 static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | |
| 6316 { | |
| 6317 ExceptionState exceptionState(ExceptionState::ExecutionContext, "addEventLis
tener", "TestObjectPython", info.Holder(), info.GetIsolate()); | |
| 6318 EventTarget* impl = V8TestObjectPython::toNative(info.Holder()); | |
| 6319 if (DOMWindow* window = impl->toDOMWindow()) { | |
| 6320 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { | |
| 6321 exceptionState.throwIfNeeded(); | |
| 6322 return; | |
| 6323 } | |
| 6324 if (!window->document()) | |
| 6325 return; | |
| 6326 } | |
| 6327 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[
1], false, ListenerFindOrCreate); | |
| 6328 if (listener) { | |
| 6329 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev
entName, info[0]); | |
| 6330 impl->addEventListener(eventName, listener, info[2]->BooleanValue()); | |
| 6331 if (!impl->toNode()) | |
| 6332 addHiddenValueToArray(info.Holder(), info[1], V8TestObjectPython::ev
entListenerCacheIndex, info.GetIsolate()); | |
| 6333 } | |
| 6334 } | |
| 6335 | |
| 6336 static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | |
| 6337 { | |
| 6338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 6339 TestObjectPythonV8Internal::addEventListenerMethod(info); | |
| 6340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 6341 } | |
| 6342 | |
| 6343 static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | |
| 6344 { | |
| 6345 ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeEvent
Listener", "TestObjectPython", info.Holder(), info.GetIsolate()); | |
| 6346 EventTarget* impl = V8TestObjectPython::toNative(info.Holder()); | |
| 6347 if (DOMWindow* window = impl->toDOMWindow()) { | |
| 6348 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { | |
| 6349 exceptionState.throwIfNeeded(); | |
| 6350 return; | |
| 6351 } | |
| 6352 if (!window->document()) | |
| 6353 return; | |
| 6354 } | |
| 6355 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[
1], false, ListenerFindOnly); | |
| 6356 if (listener) { | |
| 6357 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev
entName, info[0]); | |
| 6358 impl->removeEventListener(eventName, listener.get(), info[2]->BooleanVal
ue()); | |
| 6359 if (!impl->toNode()) | |
| 6360 removeHiddenValueFromArray(info.Holder(), info[1], V8TestObjectPytho
n::eventListenerCacheIndex, info.GetIsolate()); | |
| 6361 } | |
| 6362 } | |
| 6363 | |
| 6364 static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | |
| 6365 { | |
| 6366 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 6367 TestObjectPythonV8Internal::removeEventListenerMethod(info); | |
| 6368 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 6369 } | |
| 6370 | |
| 6371 static void dispatchEventMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 6372 { | |
| 6373 ExceptionState exceptionState(ExceptionState::ExecutionContext, "dispatchEve
nt", "TestObjectPython", info.Holder(), info.GetIsolate()); | |
| 6374 EventTarget* impl = V8TestObjectPython::toNative(info.Holder()); | |
| 6375 if (DOMWindow* window = impl->toDOMWindow()) { | |
| 6376 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window
->frame(), exceptionState)) { | |
| 6377 exceptionState.throwIfNeeded(); | |
| 6378 return; | |
| 6379 } | |
| 6380 if (!window->document()) | |
| 6381 return; | |
| 6382 } | |
| 6383 if (UNLIKELY(info.Length() < 1)) { | |
| 6384 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | |
| 6385 exceptionState.throwIfNeeded(); | |
| 6386 return; | |
| 6387 } | |
| 6388 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); | |
| 6389 V8TRYCATCH_VOID(Event*, event, V8Event::toNativeWithTypeCheck(info.GetIsolat
e(), info[0])); | |
| 6390 bool result = imp->dispatchEvent(event, exceptionState); | |
| 6391 if (exceptionState.throwIfNeeded()) | |
| 6392 return; | |
| 6393 v8SetReturnValueBool(info, result); | |
| 6394 } | |
| 6395 | |
| 6396 static void dispatchEventMethodCallback(const v8::FunctionCallbackInfo<v8::Value
>& info) | |
| 6397 { | |
| 6398 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 6399 TestObjectPythonV8Internal::dispatchEventMethod(info); | |
| 6400 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 6401 } | |
| 6402 | |
| 6403 static void voidMethodClampUnsignedShortArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) | 6313 static void voidMethodClampUnsignedShortArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 6404 { | 6314 { |
| 6405 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodC
lampUnsignedShortArg", "TestObjectPython", info.Holder(), info.GetIsolate()); | 6315 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodC
lampUnsignedShortArg", "TestObjectPython", info.Holder(), info.GetIsolate()); |
| 6406 if (UNLIKELY(info.Length() < 1)) { | 6316 if (UNLIKELY(info.Length() < 1)) { |
| 6407 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | 6317 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 6408 exceptionState.throwIfNeeded(); | 6318 exceptionState.throwIfNeeded(); |
| 6409 return; | 6319 return; |
| 6410 } | 6320 } |
| 6411 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); | 6321 TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); |
| 6412 unsigned clampUnsignedShortArg = 0; | 6322 unsigned clampUnsignedShortArg = 0; |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7619 {"voidMethodVariadicTestInterfaceWillBeGarbageCollectedArg", TestObjectPytho
nV8Internal::voidMethodVariadicTestInterfaceWillBeGarbageCollectedArgMethodCallb
ack, 0, 1}, | 7529 {"voidMethodVariadicTestInterfaceWillBeGarbageCollectedArg", TestObjectPytho
nV8Internal::voidMethodVariadicTestInterfaceWillBeGarbageCollectedArgMethodCallb
ack, 0, 1}, |
| 7620 {"overloadedMethodA", TestObjectPythonV8Internal::overloadedMethodAMethodCal
lback, 0, 1}, | 7530 {"overloadedMethodA", TestObjectPythonV8Internal::overloadedMethodAMethodCal
lback, 0, 1}, |
| 7621 {"overloadedMethodB", TestObjectPythonV8Internal::overloadedMethodBMethodCal
lback, 0, 1}, | 7531 {"overloadedMethodB", TestObjectPythonV8Internal::overloadedMethodBMethodCal
lback, 0, 1}, |
| 7622 {"overloadedMethodC", TestObjectPythonV8Internal::overloadedMethodCMethodCal
lback, 0, 1}, | 7532 {"overloadedMethodC", TestObjectPythonV8Internal::overloadedMethodCMethodCal
lback, 0, 1}, |
| 7623 {"overloadedMethodD", TestObjectPythonV8Internal::overloadedMethodDMethodCal
lback, 0, 1}, | 7533 {"overloadedMethodD", TestObjectPythonV8Internal::overloadedMethodDMethodCal
lback, 0, 1}, |
| 7624 {"overloadedMethodE", TestObjectPythonV8Internal::overloadedMethodEMethodCal
lback, 0, 1}, | 7534 {"overloadedMethodE", TestObjectPythonV8Internal::overloadedMethodEMethodCal
lback, 0, 1}, |
| 7625 {"overloadedMethodF", TestObjectPythonV8Internal::overloadedMethodFMethodCal
lback, 0, 1}, | 7535 {"overloadedMethodF", TestObjectPythonV8Internal::overloadedMethodFMethodCal
lback, 0, 1}, |
| 7626 {"overloadedMethodG", TestObjectPythonV8Internal::overloadedMethodGMethodCal
lback, 0, 0}, | 7536 {"overloadedMethodG", TestObjectPythonV8Internal::overloadedMethodGMethodCal
lback, 0, 0}, |
| 7627 {"overloadedMethodH", TestObjectPythonV8Internal::overloadedMethodHMethodCal
lback, 0, 0}, | 7537 {"overloadedMethodH", TestObjectPythonV8Internal::overloadedMethodHMethodCal
lback, 0, 0}, |
| 7628 {"overloadedPerWorldBindingsMethod", TestObjectPythonV8Internal::overloadedP
erWorldBindingsMethodMethodCallback, TestObjectPythonV8Internal::overloadedPerWo
rldBindingsMethodMethodCallbackForMainWorld, 0}, | 7538 {"overloadedPerWorldBindingsMethod", TestObjectPythonV8Internal::overloadedP
erWorldBindingsMethodMethodCallback, TestObjectPythonV8Internal::overloadedPerWo
rldBindingsMethodMethodCallbackForMainWorld, 0}, |
| 7629 {"addEventListener", TestObjectPythonV8Internal::addEventListenerMethodCallb
ack, 0, 2}, | |
| 7630 {"removeEventListener", TestObjectPythonV8Internal::removeEventListenerMetho
dCallback, 0, 2}, | |
| 7631 {"dispatchEvent", TestObjectPythonV8Internal::dispatchEventMethodCallback, 0
, 1}, | |
| 7632 {"voidMethodClampUnsignedShortArg", TestObjectPythonV8Internal::voidMethodCl
ampUnsignedShortArgMethodCallback, 0, 1}, | 7539 {"voidMethodClampUnsignedShortArg", TestObjectPythonV8Internal::voidMethodCl
ampUnsignedShortArgMethodCallback, 0, 1}, |
| 7633 {"voidMethodClampUnsignedLongArg", TestObjectPythonV8Internal::voidMethodCla
mpUnsignedLongArgMethodCallback, 0, 1}, | 7540 {"voidMethodClampUnsignedLongArg", TestObjectPythonV8Internal::voidMethodCla
mpUnsignedLongArgMethodCallback, 0, 1}, |
| 7634 {"voidMethodDefaultUndefinedTestInterfaceEmptyArg", TestObjectPythonV8Intern
al::voidMethodDefaultUndefinedTestInterfaceEmptyArgMethodCallback, 0, 0}, | 7541 {"voidMethodDefaultUndefinedTestInterfaceEmptyArg", TestObjectPythonV8Intern
al::voidMethodDefaultUndefinedTestInterfaceEmptyArgMethodCallback, 0, 0}, |
| 7635 {"voidMethodDefaultUndefinedLongArg", TestObjectPythonV8Internal::voidMethod
DefaultUndefinedLongArgMethodCallback, 0, 0}, | 7542 {"voidMethodDefaultUndefinedLongArg", TestObjectPythonV8Internal::voidMethod
DefaultUndefinedLongArgMethodCallback, 0, 0}, |
| 7636 {"voidMethodDefaultUndefinedStringArg", TestObjectPythonV8Internal::voidMeth
odDefaultUndefinedStringArgMethodCallback, 0, 0}, | 7543 {"voidMethodDefaultUndefinedStringArg", TestObjectPythonV8Internal::voidMeth
odDefaultUndefinedStringArgMethodCallback, 0, 0}, |
| 7637 {"voidMethodDefaultNullStringStringArg", TestObjectPythonV8Internal::voidMet
hodDefaultNullStringStringArgMethodCallback, 0, 0}, | 7544 {"voidMethodDefaultNullStringStringArg", TestObjectPythonV8Internal::voidMet
hodDefaultNullStringStringArgMethodCallback, 0, 0}, |
| 7638 {"voidMethodEnforceRangeLongArg", TestObjectPythonV8Internal::voidMethodEnfo
rceRangeLongArgMethodCallback, 0, 1}, | 7545 {"voidMethodEnforceRangeLongArg", TestObjectPythonV8Internal::voidMethodEnfo
rceRangeLongArgMethodCallback, 0, 1}, |
| 7639 {"voidMethodTreatNullAsNullStringStringArg", TestObjectPythonV8Internal::voi
dMethodTreatNullAsNullStringStringArgMethodCallback, 0, 1}, | 7546 {"voidMethodTreatNullAsNullStringStringArg", TestObjectPythonV8Internal::voi
dMethodTreatNullAsNullStringStringArgMethodCallback, 0, 1}, |
| 7640 {"voidMethodTreatNullAsNullStringTreatUndefinedAsNullStringStringArg", TestO
bjectPythonV8Internal::voidMethodTreatNullAsNullStringTreatUndefinedAsNullString
StringArgMethodCallback, 0, 1}, | 7547 {"voidMethodTreatNullAsNullStringTreatUndefinedAsNullStringStringArg", TestO
bjectPythonV8Internal::voidMethodTreatNullAsNullStringTreatUndefinedAsNullString
StringArgMethodCallback, 0, 1}, |
| 7641 {"activityLoggingAccessForAllWorldsMethod", TestObjectPythonV8Internal::acti
vityLoggingAccessForAllWorldsMethodMethodCallback, 0, 0}, | 7548 {"activityLoggingAccessForAllWorldsMethod", TestObjectPythonV8Internal::acti
vityLoggingAccessForAllWorldsMethodMethodCallback, 0, 0}, |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7850 fromInternalPointer(object)->deref(); | 7757 fromInternalPointer(object)->deref(); |
| 7851 } | 7758 } |
| 7852 | 7759 |
| 7853 template<> | 7760 template<> |
| 7854 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) | 7761 v8::Handle<v8::Value> toV8NoInline(TestObjectPython* impl, v8::Handle<v8::Object
> creationContext, v8::Isolate* isolate) |
| 7855 { | 7762 { |
| 7856 return toV8(impl, creationContext, isolate); | 7763 return toV8(impl, creationContext, isolate); |
| 7857 } | 7764 } |
| 7858 | 7765 |
| 7859 } // namespace WebCore | 7766 } // namespace WebCore |
| OLD | NEW |