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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 TestInterfacePythonImplementationV8Internal::TestInterfacePythonImplementati
onReplaceableAttributeSetter(name, jsValue, info); | 684 TestInterfacePythonImplementationV8Internal::TestInterfacePythonImplementati
onReplaceableAttributeSetter(name, jsValue, info); |
685 } | 685 } |
686 | 686 |
687 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) | 687 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo
<v8::Value>& info) |
688 { | 688 { |
689 if (UNLIKELY(info.Length() < 1)) { | 689 if (UNLIKELY(info.Length() < 1)) { |
690 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa
ceEmptyArg", "TestInterfacePython", ExceptionMessages::notEnoughArguments(1, inf
o.Length())), info.GetIsolate()); | 690 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa
ceEmptyArg", "TestInterfacePython", ExceptionMessages::notEnoughArguments(1, inf
o.Length())), info.GetIsolate()); |
691 return; | 691 return; |
692 } | 692 } |
693 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 693 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
694 if (info.Length() > 0 && !info[0]->IsUndefined() && !V8TestInterfaceEmpty::h
asInstance(info[0], info.GetIsolate())) { | 694 if (info.Length() > 0 && (isUndefinedOrNull(info[0]) || !V8TestInterfaceEmpt
y::hasInstance(info[0], info.GetIsolate()))) { |
695 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa
ceEmptyArg", "TestInterfacePython", "parameter 1 is not of type 'TestInterfaceEm
pty'."), info.GetIsolate()); | 695 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa
ceEmptyArg", "TestInterfacePython", "parameter 1 is not of type 'TestInterfaceEm
pty'."), info.GetIsolate()); |
696 return; | 696 return; |
697 } | 697 } |
698 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::hasInstance(info[0], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v
8::Handle<v8::Object>::Cast(info[0])) : 0); | 698 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::hasInstance(info[0], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v
8::Handle<v8::Object>::Cast(info[0])) : 0); |
699 imp->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); | 699 imp->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); |
700 } | 700 } |
701 | 701 |
702 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall
backInfo<v8::Value>& info) | 702 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall
backInfo<v8::Value>& info) |
703 { | 703 { |
704 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 704 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 748 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
749 { | 749 { |
750 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC
omplexMethod", "TestInterfacePython", info.Holder(), info.GetIsolate()); | 750 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC
omplexMethod", "TestInterfacePython", info.Holder(), info.GetIsolate()); |
751 if (UNLIKELY(info.Length() < 2)) { | 751 if (UNLIKELY(info.Length() < 2)) { |
752 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 752 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
753 exceptionState.throwIfNeeded(); | 753 exceptionState.throwIfNeeded(); |
754 return; | 754 return; |
755 } | 755 } |
756 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); | 756 TestInterfacePythonImplementation* imp = V8TestInterfacePython::toNative(inf
o.Holder()); |
757 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); | 757 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); |
758 if (info.Length() > 1 && !info[1]->IsUndefined() && !V8TestInterfaceEmpty::h
asInstance(info[1], info.GetIsolate())) { | 758 if (info.Length() > 1 && (isUndefinedOrNull(info[1]) || !V8TestInterfaceEmpt
y::hasInstance(info[1], info.GetIsolate()))) { |
759 exceptionState.throwTypeError("parameter 2 is not of type 'TestInterface
Empty'."); | 759 exceptionState.throwTypeError("parameter 2 is not of type 'TestInterface
Empty'."); |
760 exceptionState.throwIfNeeded(); | 760 exceptionState.throwIfNeeded(); |
761 return; | 761 return; |
762 } | 762 } |
763 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::hasInstance(info[1], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v
8::Handle<v8::Object>::Cast(info[1])) : 0); | 763 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::hasInstance(info[1], info.GetIsolate()) ? V8TestInterfaceEmpty::toNative(v
8::Handle<v8::Object>::Cast(info[1])) : 0); |
764 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate())
; | 764 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate())
; |
765 RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod(
scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState); | 765 RefPtr<TestInterfaceEmpty> result = TestImplements::implementsComplexMethod(
scriptContext, imp, strArg, testInterfaceEmptyArg, exceptionState); |
766 if (exceptionState.throwIfNeeded()) | 766 if (exceptionState.throwIfNeeded()) |
767 return; | 767 return; |
768 v8SetReturnValue(info, result.release()); | 768 v8SetReturnValue(info, result.release()); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 } | 1106 } |
1107 | 1107 |
1108 template<> | 1108 template<> |
1109 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) | 1109 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8::
Handle<v8::Object> creationContext, v8::Isolate* isolate) |
1110 { | 1110 { |
1111 return toV8(impl, creationContext, isolate); | 1111 return toV8(impl, creationContext, isolate); |
1112 } | 1112 } |
1113 | 1113 |
1114 } // namespace WebCore | 1114 } // namespace WebCore |
1115 #endif // ENABLE(CONDITION) | 1115 #endif // ENABLE(CONDITION) |
OLD | NEW |