Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp

Issue 2607433002: bindings: Throw a TypeError when a given callback function isn't callable (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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. 5 // This file has been auto-generated by code_generator_v8.py.
6 // DO NOT MODIFY! 6 // DO NOT MODIFY!
7 7
8 // This file has been generated from the Jinja2 template in 8 // This file has been generated from the Jinja2 template in
9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl 9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
10 10
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 static void voidMethodVoidCallbackFunctionModulesArgMethod(const v8::FunctionCal lbackInfo<v8::Value>& info) { 575 static void voidMethodVoidCallbackFunctionModulesArgMethod(const v8::FunctionCal lbackInfo<v8::Value>& info) {
576 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); 576 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
577 577
578 if (UNLIKELY(info.Length() < 1)) { 578 if (UNLIKELY(info.Length() < 1)) {
579 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::faile dToExecute("voidMethodVoidCallbackFunctionModulesArg", "TestInterface5", Excepti onMessages::notEnoughArguments(1, info.Length()))); 579 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::faile dToExecute("voidMethodVoidCallbackFunctionModulesArg", "TestInterface5", Excepti onMessages::notEnoughArguments(1, info.Length())));
580 return; 580 return;
581 } 581 }
582 582
583 VoidCallbackFunctionModules* arg; 583 VoidCallbackFunctionModules* arg;
584 if (!info[0]->IsFunction()) { 584 if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable( )) {
585 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::faile dToExecute("voidMethodVoidCallbackFunctionModulesArg", "TestInterface5", "The ca llback provided as parameter 1 is not a function.")); 585 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::faile dToExecute("voidMethodVoidCallbackFunctionModulesArg", "TestInterface5", "The ca llback provided as parameter 1 is not a function."));
586 586
587 return; 587 return;
588 } 588 }
589 arg = VoidCallbackFunctionModules::create(ScriptState::current(info.GetIsolate ()), v8::Local<v8::Function>::Cast(info[0])); 589 arg = VoidCallbackFunctionModules::create(ScriptState::current(info.GetIsolate ()), v8::Local<v8::Function>::Cast(info[0]));
590 590
591 impl->voidMethodVoidCallbackFunctionModulesArg(arg); 591 impl->voidMethodVoidCallbackFunctionModulesArg(arg);
592 } 592 }
593 593
594 void voidMethodVoidCallbackFunctionModulesArgMethodCallback(const v8::FunctionCa llbackInfo<v8::Value>& info) { 594 void voidMethodVoidCallbackFunctionModulesArgMethodCallback(const v8::FunctionCa llbackInfo<v8::Value>& info) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 656
657 ScriptState* scriptState = ScriptState::forReceiverObject(info); 657 ScriptState* scriptState = ScriptState::forReceiverObject(info);
658 658
659 if (UNLIKELY(info.Length() < 1)) { 659 if (UNLIKELY(info.Length() < 1)) {
660 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info. Length())); 660 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info. Length()));
661 return; 661 return;
662 } 662 }
663 663
664 ScriptValue callback; 664 ScriptValue callback;
665 ScriptValue thisArg; 665 ScriptValue thisArg;
666 if (!info[0]->IsFunction()) { 666 if (!info[0]->IsObject() || !v8::Local<v8::Object>::Cast(info[0])->IsCallable( )) {
667 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function."); 667 exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
668 668
669 return; 669 return;
670 } 670 }
671 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]); 671 callback = ScriptValue(ScriptState::current(info.GetIsolate()), info[0]);
672 672
673 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]); 673 thisArg = ScriptValue(ScriptState::current(info.GetIsolate()), info[1]);
674 674
675 impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.Holder()), callback, thisArg, exceptionState); 675 impl->forEachForBinding(scriptState, ScriptValue(scriptState, info.Holder()), callback, thisArg, exceptionState);
676 if (exceptionState.hadException()) { 676 if (exceptionState.hadException()) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMetho dConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV8Int ernal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfigurati on::OnInterface, V8DOMConfiguration::CheckHolder}; 980 const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMetho dConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV8Int ernal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfigurati on::OnInterface, V8DOMConfiguration::CheckHolder};
981 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodConfi guration); 981 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodConfi guration);
982 } 982 }
983 if (executionContext && (executionContext->isDocument() || executionContext->i sServiceWorkerGlobalScope())) { 983 if (executionContext && (executionContext->isDocument() || executionContext->i sServiceWorkerGlobalScope())) {
984 const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedM ethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInterface 5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder}; 984 const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedM ethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInterface 5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
985 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMethodM ethodConfiguration); 985 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMethodM ethodConfiguration);
986 } 986 }
987 } 987 }
988 988
989 } // namespace blink 989 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698