OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 #include "V8TestObject.h" | 8 #include "V8TestObject.h" |
9 | 9 |
10 #include "bindings/core/v8/V8HTMLCollection.h" | 10 #include "bindings/core/v8/V8HTMLCollection.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" | 28 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" |
29 #include "bindings/tests/v8/V8TestInterfaceGarbageCollected.h" | 29 #include "bindings/tests/v8/V8TestInterfaceGarbageCollected.h" |
30 #include "bindings/tests/v8/V8TestInterfaceWillBeGarbageCollected.h" | 30 #include "bindings/tests/v8/V8TestInterfaceWillBeGarbageCollected.h" |
31 #include "bindings/tests/v8/V8TestNode.h" | 31 #include "bindings/tests/v8/V8TestNode.h" |
32 #include "bindings/tests/v8/V8TestObject.h" | 32 #include "bindings/tests/v8/V8TestObject.h" |
33 #include "bindings/tests/v8/V8Window.h" | 33 #include "bindings/tests/v8/V8Window.h" |
34 #include "bindings/tests/v8/V8XPathNSResolver.h" | 34 #include "bindings/tests/v8/V8XPathNSResolver.h" |
35 #include "bindings/v8/BindingSecurity.h" | 35 #include "bindings/v8/BindingSecurity.h" |
36 #include "bindings/v8/Dictionary.h" | 36 #include "bindings/v8/Dictionary.h" |
37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
| 38 #include "bindings/v8/PrivateScriptRunner.h" |
38 #include "bindings/v8/ScriptCallStackFactory.h" | 39 #include "bindings/v8/ScriptCallStackFactory.h" |
39 #include "bindings/v8/ScriptPromise.h" | 40 #include "bindings/v8/ScriptPromise.h" |
40 #include "bindings/v8/ScriptState.h" | 41 #include "bindings/v8/ScriptState.h" |
41 #include "bindings/v8/ScriptValue.h" | 42 #include "bindings/v8/ScriptValue.h" |
42 #include "bindings/v8/SerializedScriptValue.h" | 43 #include "bindings/v8/SerializedScriptValue.h" |
43 #include "bindings/v8/V8AbstractEventListener.h" | 44 #include "bindings/v8/V8AbstractEventListener.h" |
44 #include "bindings/v8/V8DOMActivityLogger.h" | 45 #include "bindings/v8/V8DOMActivityLogger.h" |
45 #include "bindings/v8/V8DOMConfiguration.h" | 46 #include "bindings/v8/V8DOMConfiguration.h" |
46 #include "bindings/v8/V8EventListenerList.h" | 47 #include "bindings/v8/V8EventListenerList.h" |
47 #include "bindings/v8/V8HiddenValue.h" | 48 #include "bindings/v8/V8HiddenValue.h" |
48 #include "bindings/v8/V8ObjectConstructor.h" | 49 #include "bindings/v8/V8ObjectConstructor.h" |
49 #include "core/HTMLNames.h" | 50 #include "core/HTMLNames.h" |
50 #include "core/css/MediaQueryListListener.h" | 51 #include "core/css/MediaQueryListListener.h" |
51 #include "core/dom/ClassCollection.h" | 52 #include "core/dom/ClassCollection.h" |
52 #include "core/dom/ContextFeatures.h" | 53 #include "core/dom/ContextFeatures.h" |
53 #include "core/dom/Document.h" | 54 #include "core/dom/Document.h" |
54 #include "core/dom/TagCollection.h" | 55 #include "core/dom/TagCollection.h" |
55 #include "core/dom/custom/CustomElementCallbackDispatcher.h" | 56 #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
| 57 #include "core/frame/LocalFrame.h" |
56 #include "core/frame/UseCounter.h" | 58 #include "core/frame/UseCounter.h" |
57 #include "core/html/HTMLCollection.h" | 59 #include "core/html/HTMLCollection.h" |
58 #include "core/html/HTMLFormControlsCollection.h" | 60 #include "core/html/HTMLFormControlsCollection.h" |
59 #include "core/html/HTMLTableRowsCollection.h" | 61 #include "core/html/HTMLTableRowsCollection.h" |
60 #include "core/inspector/ScriptArguments.h" | 62 #include "core/inspector/ScriptArguments.h" |
61 #include "platform/RuntimeEnabledFeatures.h" | 63 #include "platform/RuntimeEnabledFeatures.h" |
62 #include "platform/TraceEvent.h" | 64 #include "platform/TraceEvent.h" |
63 #include "wtf/GetPtr.h" | 65 #include "wtf/GetPtr.h" |
64 #include "wtf/RefPtr.h" | 66 #include "wtf/RefPtr.h" |
65 | 67 |
(...skipping 9554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9620 impl->voidMethodTestInterfaceWillBeGarbageCollectedArrayArg(testInterfaceWil
lBeGarbageCollectedArrayArg); | 9622 impl->voidMethodTestInterfaceWillBeGarbageCollectedArrayArg(testInterfaceWil
lBeGarbageCollectedArrayArg); |
9621 } | 9623 } |
9622 | 9624 |
9623 static void voidMethodTestInterfaceWillBeGarbageCollectedArrayArgMethodCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) | 9625 static void voidMethodTestInterfaceWillBeGarbageCollectedArrayArgMethodCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) |
9624 { | 9626 { |
9625 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 9627 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
9626 TestObjectV8Internal::voidMethodTestInterfaceWillBeGarbageCollectedArrayArgM
ethod(info); | 9628 TestObjectV8Internal::voidMethodTestInterfaceWillBeGarbageCollectedArrayArgM
ethod(info); |
9627 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 9629 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
9628 } | 9630 } |
9629 | 9631 |
| 9632 static bool voidMethodImplementedInPrivateScriptMethodImplementedInPrivateScript
(LocalFrame* frame, TestObject* holderImpl) |
| 9633 { |
| 9634 if (!frame) |
| 9635 return false; |
| 9636 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
| 9637 if (context.IsEmpty()) |
| 9638 return false; |
| 9639 ScriptState* scriptState = ScriptState::from(context); |
| 9640 if (!scriptState->executionContext()) |
| 9641 return false; |
| 9642 |
| 9643 ScriptState::Scope scope(scriptState); |
| 9644 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9645 |
| 9646 v8::Handle<v8::Value> *argv = 0; |
| 9647 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 9648 v8::TryCatch block; |
| 9649 PrivateScriptRunner::runDOMMethod(scriptState, "TestObject", "voidMethodImpl
ementedInPrivateScript", holder, 0, argv); |
| 9650 if (block.HasCaught()) |
| 9651 return false; |
| 9652 return true; |
| 9653 } |
| 9654 |
| 9655 static void voidMethodImplementedInPrivateScriptMethod(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 9656 { |
| 9657 TestObject* impl = V8TestObject::toNative(info.Holder()); |
| 9658 voidMethodImplementedInPrivateScriptMethodImplementedInPrivateScript(toFrame
IfNotDetached(info.GetIsolate()->GetCurrentContext()), impl); |
| 9659 } |
| 9660 |
| 9661 static void voidMethodImplementedInPrivateScriptMethodCallback(const v8::Functio
nCallbackInfo<v8::Value>& info) |
| 9662 { |
| 9663 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 9664 TestObjectV8Internal::voidMethodImplementedInPrivateScriptMethod(info); |
| 9665 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 9666 } |
| 9667 |
| 9668 static bool shortMethodImplementedInPrivateScriptMethodImplementedInPrivateScrip
t(LocalFrame* frame, TestObject* holderImpl, int* result) |
| 9669 { |
| 9670 if (!frame) |
| 9671 return false; |
| 9672 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
| 9673 if (context.IsEmpty()) |
| 9674 return false; |
| 9675 ScriptState* scriptState = ScriptState::from(context); |
| 9676 if (!scriptState->executionContext()) |
| 9677 return false; |
| 9678 |
| 9679 ScriptState::Scope scope(scriptState); |
| 9680 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9681 |
| 9682 v8::Handle<v8::Value> *argv = 0; |
| 9683 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 9684 v8::TryCatch block; |
| 9685 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "TestObject", "shortMethodImplementedInPrivateScript", holder, 0, argv); |
| 9686 if (block.HasCaught()) |
| 9687 return false; |
| 9688 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod
ImplementedInPrivateScript", "TestObject", scriptState->context()->Global(), scr
iptState->isolate()); |
| 9689 int cppValue = toInt16(v8Value, exceptionState); |
| 9690 if (block.HasCaught()) |
| 9691 return false; |
| 9692 *result = cppValue; |
| 9693 return true; |
| 9694 } |
| 9695 |
| 9696 static void shortMethodImplementedInPrivateScriptMethod(const v8::FunctionCallba
ckInfo<v8::Value>& info) |
| 9697 { |
| 9698 TestObject* impl = V8TestObject::toNative(info.Holder()); |
| 9699 int result; |
| 9700 if (!shortMethodImplementedInPrivateScriptMethodImplementedInPrivateScript(t
oFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()), impl, &result)) |
| 9701 return; |
| 9702 v8SetReturnValueInt(info, result); |
| 9703 } |
| 9704 |
| 9705 static void shortMethodImplementedInPrivateScriptMethodCallback(const v8::Functi
onCallbackInfo<v8::Value>& info) |
| 9706 { |
| 9707 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 9708 TestObjectV8Internal::shortMethodImplementedInPrivateScriptMethod(info); |
| 9709 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 9710 } |
| 9711 |
| 9712 static bool shortMethodWithShortArgumentImplementedInPrivateScriptMethodImplemen
tedInPrivateScript(LocalFrame* frame, TestObject* holderImpl, int value, int* re
sult) |
| 9713 { |
| 9714 if (!frame) |
| 9715 return false; |
| 9716 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
| 9717 if (context.IsEmpty()) |
| 9718 return false; |
| 9719 ScriptState* scriptState = ScriptState::from(context); |
| 9720 if (!scriptState->executionContext()) |
| 9721 return false; |
| 9722 |
| 9723 ScriptState::Scope scope(scriptState); |
| 9724 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9725 |
| 9726 v8::Handle<v8::Value> valueHandle = v8::Integer::New(scriptState->isolate(),
value); |
| 9727 v8::Handle<v8::Value> argv[] = { valueHandle }; |
| 9728 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 9729 v8::TryCatch block; |
| 9730 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "TestObject", "shortMethodWithShortArgumentImplementedInPrivateScript", holde
r, 1, argv); |
| 9731 if (block.HasCaught()) |
| 9732 return false; |
| 9733 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod
WithShortArgumentImplementedInPrivateScript", "TestObject", scriptState->context
()->Global(), scriptState->isolate()); |
| 9734 int cppValue = toInt16(v8Value, exceptionState); |
| 9735 if (block.HasCaught()) |
| 9736 return false; |
| 9737 *result = cppValue; |
| 9738 return true; |
| 9739 } |
| 9740 |
| 9741 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethod(const v
8::FunctionCallbackInfo<v8::Value>& info) |
| 9742 { |
| 9743 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod
WithShortArgumentImplementedInPrivateScript", "TestObject", info.Holder(), info.
GetIsolate()); |
| 9744 if (UNLIKELY(info.Length() < 1)) { |
| 9745 throwMinimumArityTypeError(exceptionState, 1, info.Length()); |
| 9746 return; |
| 9747 } |
| 9748 TestObject* impl = V8TestObject::toNative(info.Holder()); |
| 9749 int value; |
| 9750 { |
| 9751 v8::TryCatch block; |
| 9752 V8RethrowTryCatchScope rethrow(block); |
| 9753 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(value, toInt16(info[0], exceptionS
tate), exceptionState); |
| 9754 } |
| 9755 int result; |
| 9756 if (!shortMethodWithShortArgumentImplementedInPrivateScriptMethodImplemented
InPrivateScript(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()), im
pl, value, &result)) |
| 9757 return; |
| 9758 v8SetReturnValueInt(info, result); |
| 9759 } |
| 9760 |
| 9761 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback
(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 9762 { |
| 9763 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 9764 TestObjectV8Internal::shortMethodWithShortArgumentImplementedInPrivateScript
Method(info); |
| 9765 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 9766 } |
| 9767 |
| 9768 static bool stringMethodWithStringArgumentImplementedInPrivateScriptMethodImplem
entedInPrivateScript(LocalFrame* frame, TestObject* holderImpl, String value, St
ring* result) |
| 9769 { |
| 9770 if (!frame) |
| 9771 return false; |
| 9772 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
| 9773 if (context.IsEmpty()) |
| 9774 return false; |
| 9775 ScriptState* scriptState = ScriptState::from(context); |
| 9776 if (!scriptState->executionContext()) |
| 9777 return false; |
| 9778 |
| 9779 ScriptState::Scope scope(scriptState); |
| 9780 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9781 |
| 9782 v8::Handle<v8::Value> valueHandle = v8String(scriptState->isolate(), value); |
| 9783 v8::Handle<v8::Value> argv[] = { valueHandle }; |
| 9784 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 9785 v8::TryCatch block; |
| 9786 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "TestObject", "stringMethodWithStringArgumentImplementedInPrivateScript", hol
der, 1, argv); |
| 9787 if (block.HasCaught()) |
| 9788 return false; |
| 9789 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringMetho
dWithStringArgumentImplementedInPrivateScript", "TestObject", scriptState->conte
xt()->Global(), scriptState->isolate()); |
| 9790 V8StringResource<> cppValue = v8Value; |
| 9791 if (block.HasCaught()) |
| 9792 return false; |
| 9793 *result = cppValue; |
| 9794 return true; |
| 9795 } |
| 9796 |
| 9797 static void stringMethodWithStringArgumentImplementedInPrivateScriptMethod(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 9798 { |
| 9799 if (UNLIKELY(info.Length() < 1)) { |
| 9800 throwMinimumArityTypeErrorForMethod("stringMethodWithStringArgumentImple
mentedInPrivateScript", "TestObject", 1, info.Length(), info.GetIsolate()); |
| 9801 return; |
| 9802 } |
| 9803 TestObject* impl = V8TestObject::toNative(info.Holder()); |
| 9804 V8StringResource<> value; |
| 9805 { |
| 9806 TOSTRING_VOID_INTERNAL(value, info[0]); |
| 9807 } |
| 9808 String result; |
| 9809 if (!stringMethodWithStringArgumentImplementedInPrivateScriptMethodImplement
edInPrivateScript(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()),
impl, value, &result)) |
| 9810 return; |
| 9811 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 9812 } |
| 9813 |
| 9814 static void stringMethodWithStringArgumentImplementedInPrivateScriptMethodCallba
ck(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 9815 { |
| 9816 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 9817 TestObjectV8Internal::stringMethodWithStringArgumentImplementedInPrivateScri
ptMethod(info); |
| 9818 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 9819 } |
| 9820 |
| 9821 static bool nodeMethodWithNodeArgumentImplementedInPrivateScriptMethodImplemente
dInPrivateScript(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBeRawP
tr<Node> value, RefPtrWillBeRawPtr<Node>* result) |
| 9822 { |
| 9823 if (!frame) |
| 9824 return false; |
| 9825 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
| 9826 if (context.IsEmpty()) |
| 9827 return false; |
| 9828 ScriptState* scriptState = ScriptState::from(context); |
| 9829 if (!scriptState->executionContext()) |
| 9830 return false; |
| 9831 |
| 9832 ScriptState::Scope scope(scriptState); |
| 9833 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9834 |
| 9835 v8::Handle<v8::Value> valueHandle = toV8(value, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9836 v8::Handle<v8::Value> argv[] = { valueHandle }; |
| 9837 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 9838 v8::TryCatch block; |
| 9839 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "TestObject", "nodeMethodWithNodeArgumentImplementedInPrivateScript", holder,
1, argv); |
| 9840 if (block.HasCaught()) |
| 9841 return false; |
| 9842 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW
ithNodeArgumentImplementedInPrivateScript", "TestObject", scriptState->context()
->Global(), scriptState->isolate()); |
| 9843 Node* cppValue = V8Node::toNativeWithTypeCheck(scriptState->isolate(), v8Val
ue); |
| 9844 if (block.HasCaught()) |
| 9845 return false; |
| 9846 *result = cppValue; |
| 9847 return true; |
| 9848 } |
| 9849 |
| 9850 static void nodeMethodWithNodeArgumentImplementedInPrivateScriptMethod(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
| 9851 { |
| 9852 if (UNLIKELY(info.Length() < 1)) { |
| 9853 throwMinimumArityTypeErrorForMethod("nodeMethodWithNodeArgumentImplement
edInPrivateScript", "TestObject", 1, info.Length(), info.GetIsolate()); |
| 9854 return; |
| 9855 } |
| 9856 TestObject* impl = V8TestObject::toNative(info.Holder()); |
| 9857 Node* value; |
| 9858 { |
| 9859 v8::TryCatch block; |
| 9860 V8RethrowTryCatchScope rethrow(block); |
| 9861 TONATIVE_VOID_INTERNAL(value, V8Node::toNativeWithTypeCheck(info.GetIsol
ate(), info[0])); |
| 9862 } |
| 9863 RefPtrWillBeRawPtr<Node> result; |
| 9864 if (!nodeMethodWithNodeArgumentImplementedInPrivateScriptMethodImplementedIn
PrivateScript(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()), impl
, value, &result)) |
| 9865 return; |
| 9866 v8SetReturnValue(info, result.release()); |
| 9867 } |
| 9868 |
| 9869 static void nodeMethodWithNodeArgumentImplementedInPrivateScriptMethodCallback(c
onst v8::FunctionCallbackInfo<v8::Value>& info) |
| 9870 { |
| 9871 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 9872 TestObjectV8Internal::nodeMethodWithNodeArgumentImplementedInPrivateScriptMe
thod(info); |
| 9873 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 9874 } |
| 9875 |
| 9876 static bool nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethodImplem
entedInPrivateScript(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBe
RawPtr<Document> document, PassRefPtrWillBeRawPtr<Node> node, int value1, double
value2, String string, RefPtrWillBeRawPtr<Node>* result) |
| 9877 { |
| 9878 if (!frame) |
| 9879 return false; |
| 9880 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat
eScriptIsolatedWorld()); |
| 9881 if (context.IsEmpty()) |
| 9882 return false; |
| 9883 ScriptState* scriptState = ScriptState::from(context); |
| 9884 if (!scriptState->executionContext()) |
| 9885 return false; |
| 9886 |
| 9887 ScriptState::Scope scope(scriptState); |
| 9888 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
| 9889 |
| 9890 v8::Handle<v8::Value> documentHandle = toV8(document, scriptState->context()
->Global(), scriptState->isolate()); |
| 9891 v8::Handle<v8::Value> nodeHandle = toV8(node, scriptState->context()->Global
(), scriptState->isolate()); |
| 9892 v8::Handle<v8::Value> value1Handle = v8::Integer::New(scriptState->isolate()
, value1); |
| 9893 v8::Handle<v8::Value> value2Handle = v8::Number::New(scriptState->isolate(),
value2); |
| 9894 v8::Handle<v8::Value> stringHandle = v8String(scriptState->isolate(), string
); |
| 9895 v8::Handle<v8::Value> argv[] = { documentHandle, nodeHandle, value1Handle, v
alue2Handle, stringHandle }; |
| 9896 // FIXME: Support exceptions thrown from Blink-in-JS. |
| 9897 v8::TryCatch block; |
| 9898 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "TestObject", "nodeMethodWithVariousArgumentsImplementedInPrivateScript", hol
der, 5, argv); |
| 9899 if (block.HasCaught()) |
| 9900 return false; |
| 9901 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW
ithVariousArgumentsImplementedInPrivateScript", "TestObject", scriptState->conte
xt()->Global(), scriptState->isolate()); |
| 9902 Node* cppValue = V8Node::toNativeWithTypeCheck(scriptState->isolate(), v8Val
ue); |
| 9903 if (block.HasCaught()) |
| 9904 return false; |
| 9905 *result = cppValue; |
| 9906 return true; |
| 9907 } |
| 9908 |
| 9909 static void nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethod(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 9910 { |
| 9911 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeMethodW
ithVariousArgumentsImplementedInPrivateScript", "TestObject", info.Holder(), inf
o.GetIsolate()); |
| 9912 if (UNLIKELY(info.Length() < 5)) { |
| 9913 throwMinimumArityTypeError(exceptionState, 5, info.Length()); |
| 9914 return; |
| 9915 } |
| 9916 TestObject* impl = V8TestObject::toNative(info.Holder()); |
| 9917 Document* document; |
| 9918 Node* node; |
| 9919 int value1; |
| 9920 double value2; |
| 9921 V8StringResource<> string; |
| 9922 { |
| 9923 v8::TryCatch block; |
| 9924 V8RethrowTryCatchScope rethrow(block); |
| 9925 TONATIVE_VOID_INTERNAL(document, V8Document::toNativeWithTypeCheck(info.
GetIsolate(), info[0])); |
| 9926 TONATIVE_VOID_INTERNAL(node, V8Node::toNativeWithTypeCheck(info.GetIsola
te(), info[1])); |
| 9927 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(value1, toInt16(info[2], exception
State), exceptionState); |
| 9928 TONATIVE_VOID_INTERNAL(value2, static_cast<double>(info[3]->NumberValue(
))); |
| 9929 TOSTRING_VOID_INTERNAL(string, info[4]); |
| 9930 } |
| 9931 RefPtrWillBeRawPtr<Node> result; |
| 9932 if (!nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethodImplement
edInPrivateScript(toFrameIfNotDetached(info.GetIsolate()->GetCurrentContext()),
impl, document, node, value1, value2, string, &result)) |
| 9933 return; |
| 9934 v8SetReturnValue(info, result.release()); |
| 9935 } |
| 9936 |
| 9937 static void nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethodCallba
ck(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 9938 { |
| 9939 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 9940 TestObjectV8Internal::nodeMethodWithVariousArgumentsImplementedInPrivateScri
ptMethod(info); |
| 9941 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 9942 } |
| 9943 |
9630 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 9944 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
9631 { | 9945 { |
9632 TestObject* impl = V8TestObject::toNative(info.Holder()); | 9946 TestObject* impl = V8TestObject::toNative(info.Holder()); |
9633 v8SetReturnValueString(info, impl->stringifierAttribute(), info.GetIsolate()
); | 9947 v8SetReturnValueString(info, impl->stringifierAttribute(), info.GetIsolate()
); |
9634 } | 9948 } |
9635 | 9949 |
9636 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 9950 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
9637 { | 9951 { |
9638 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 9952 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
9639 TestObjectV8Internal::toStringMethod(info); | 9953 TestObjectV8Internal::toStringMethod(info); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9991 {"treatReturnedNullStringAsUndefinedByteStringMethod", TestObjectV8Internal:
:treatReturnedNullStringAsUndefinedByteStringMethodMethodCallback, 0, 0}, | 10305 {"treatReturnedNullStringAsUndefinedByteStringMethod", TestObjectV8Internal:
:treatReturnedNullStringAsUndefinedByteStringMethodMethodCallback, 0, 0}, |
9992 {"treatReturnedNullStringAsNullScalarValueStringMethod", TestObjectV8Interna
l::treatReturnedNullStringAsNullScalarValueStringMethodMethodCallback, 0, 0}, | 10306 {"treatReturnedNullStringAsNullScalarValueStringMethod", TestObjectV8Interna
l::treatReturnedNullStringAsNullScalarValueStringMethodMethodCallback, 0, 0}, |
9993 {"treatReturnedNullStringAsUndefinedScalarValueStringMethod", TestObjectV8In
ternal::treatReturnedNullStringAsUndefinedScalarValueStringMethodMethodCallback,
0, 0}, | 10307 {"treatReturnedNullStringAsUndefinedScalarValueStringMethod", TestObjectV8In
ternal::treatReturnedNullStringAsUndefinedScalarValueStringMethodMethodCallback,
0, 0}, |
9994 {"typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", TestObjectV8Interna
l::typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMethodCallback, 0, 1}, | 10308 {"typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", TestObjectV8Interna
l::typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMethodCallback, 0, 1}, |
9995 {"typeCheckingInterfaceVoidMethodTestInterfaceEmptyVariadicArg", TestObjectV
8Internal::typeCheckingInterfaceVoidMethodTestInterfaceEmptyVariadicArgMethodCal
lback, 0, 0}, | 10309 {"typeCheckingInterfaceVoidMethodTestInterfaceEmptyVariadicArg", TestObjectV
8Internal::typeCheckingInterfaceVoidMethodTestInterfaceEmptyVariadicArgMethodCal
lback, 0, 0}, |
9996 {"typeCheckingUnrestrictedVoidMethodFloatArgDoubleArg", TestObjectV8Internal
::typeCheckingUnrestrictedVoidMethodFloatArgDoubleArgMethodCallback, 0, 2}, | 10310 {"typeCheckingUnrestrictedVoidMethodFloatArgDoubleArg", TestObjectV8Internal
::typeCheckingUnrestrictedVoidMethodFloatArgDoubleArgMethodCallback, 0, 2}, |
9997 {"voidMethodTestInterfaceGarbageCollectedSequenceArg", TestObjectV8Internal:
:voidMethodTestInterfaceGarbageCollectedSequenceArgMethodCallback, 0, 1}, | 10311 {"voidMethodTestInterfaceGarbageCollectedSequenceArg", TestObjectV8Internal:
:voidMethodTestInterfaceGarbageCollectedSequenceArgMethodCallback, 0, 1}, |
9998 {"voidMethodTestInterfaceGarbageCollectedArrayArg", TestObjectV8Internal::vo
idMethodTestInterfaceGarbageCollectedArrayArgMethodCallback, 0, 1}, | 10312 {"voidMethodTestInterfaceGarbageCollectedArrayArg", TestObjectV8Internal::vo
idMethodTestInterfaceGarbageCollectedArrayArgMethodCallback, 0, 1}, |
9999 {"voidMethodTestInterfaceWillBeGarbageCollectedSequenceArg", TestObjectV8Int
ernal::voidMethodTestInterfaceWillBeGarbageCollectedSequenceArgMethodCallback, 0
, 1}, | 10313 {"voidMethodTestInterfaceWillBeGarbageCollectedSequenceArg", TestObjectV8Int
ernal::voidMethodTestInterfaceWillBeGarbageCollectedSequenceArgMethodCallback, 0
, 1}, |
10000 {"voidMethodTestInterfaceWillBeGarbageCollectedArrayArg", TestObjectV8Intern
al::voidMethodTestInterfaceWillBeGarbageCollectedArrayArgMethodCallback, 0, 1}, | 10314 {"voidMethodTestInterfaceWillBeGarbageCollectedArrayArg", TestObjectV8Intern
al::voidMethodTestInterfaceWillBeGarbageCollectedArrayArgMethodCallback, 0, 1}, |
| 10315 {"voidMethodImplementedInPrivateScript", TestObjectV8Internal::voidMethodImp
lementedInPrivateScriptMethodCallback, 0, 0}, |
| 10316 {"shortMethodImplementedInPrivateScript", TestObjectV8Internal::shortMethodI
mplementedInPrivateScriptMethodCallback, 0, 0}, |
| 10317 {"shortMethodWithShortArgumentImplementedInPrivateScript", TestObjectV8Inter
nal::shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback, 0, 1}
, |
| 10318 {"stringMethodWithStringArgumentImplementedInPrivateScript", TestObjectV8Int
ernal::stringMethodWithStringArgumentImplementedInPrivateScriptMethodCallback, 0
, 1}, |
| 10319 {"nodeMethodWithNodeArgumentImplementedInPrivateScript", TestObjectV8Interna
l::nodeMethodWithNodeArgumentImplementedInPrivateScriptMethodCallback, 0, 1}, |
| 10320 {"nodeMethodWithVariousArgumentsImplementedInPrivateScript", TestObjectV8Int
ernal::nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethodCallback, 0
, 5}, |
10001 {"toString", TestObjectV8Internal::toStringMethodCallback, 0, 0}, | 10321 {"toString", TestObjectV8Internal::toStringMethodCallback, 0, 0}, |
10002 }; | 10322 }; |
10003 | 10323 |
10004 static void configureV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> funct
ionTemplate, v8::Isolate* isolate) | 10324 static void configureV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> funct
ionTemplate, v8::Isolate* isolate) |
10005 { | 10325 { |
10006 functionTemplate->ReadOnlyPrototype(); | 10326 functionTemplate->ReadOnlyPrototype(); |
10007 | 10327 |
10008 v8::Local<v8::Signature> defaultSignature; | 10328 v8::Local<v8::Signature> defaultSignature; |
10009 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestObject", v8::Local<v8::FunctionTemplate>(), V8TestObject::internalFiel
dCount, | 10329 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestObject", v8::Local<v8::FunctionTemplate>(), V8TestObject::internalFiel
dCount, |
10010 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes), | 10330 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes), |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10194 fromInternalPointer(object)->deref(); | 10514 fromInternalPointer(object)->deref(); |
10195 } | 10515 } |
10196 | 10516 |
10197 template<> | 10517 template<> |
10198 v8::Handle<v8::Value> toV8NoInline(TestObject* impl, v8::Handle<v8::Object> crea
tionContext, v8::Isolate* isolate) | 10518 v8::Handle<v8::Value> toV8NoInline(TestObject* impl, v8::Handle<v8::Object> crea
tionContext, v8::Isolate* isolate) |
10199 { | 10519 { |
10200 return toV8(impl, creationContext, isolate); | 10520 return toV8(impl, creationContext, isolate); |
10201 } | 10521 } |
10202 | 10522 |
10203 } // namespace WebCore | 10523 } // namespace WebCore |
OLD | NEW |