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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 157013006: Update HTMLFormControlsCollection's named getter to behave according to spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove legacycaller Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 431
432 #if ENABLE(CONDITION_PARTIAL) 432 #if ENABLE(CONDITION_PARTIAL)
433 static void Node13AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info) 433 static void Node13AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::V alue> jsValue, const v8::PropertyCallbackInfo<void>& info)
434 { 434 {
435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
436 TestInterfaceV8Internal::Node13AttributeSetter(jsValue, info); 436 TestInterfaceV8Internal::Node13AttributeSetter(jsValue, info);
437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
438 } 438 }
439 #endif // ENABLE(CONDITION_PARTIAL) 439 #endif // ENABLE(CONDITION_PARTIAL)
440 440
441 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
442 {
443 if (UNLIKELY(info.Length() < 1)) {
444 throwTypeError(ExceptionMessages::failedToExecute("namedItem", "TestInte rface", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolat e());
445 return;
446 }
447 TestInterface* imp = V8TestInterface::toNative(info.Holder());
448 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
449 bool result0Enabled = false;
450 RefPtr<Node> result0;
451 bool result1Enabled = false;
452 RefPtr<NodeList> result1;
453 imp->getItem(name, result0Enabled, result0, result1Enabled, result1);
454 if (result0Enabled) {
455 v8SetReturnValue(info, result0.release());
456 return;
457 }
458
459 if (result1Enabled) {
460 v8SetReturnValue(info, result1.release());
461 return;
462 }
463
464 v8SetReturnValueNull(info);
465 }
466
467 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
468 {
469 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
470 TestInterfaceV8Internal::namedItemMethod(info);
471 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
472 }
473
441 static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info) 474 static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info)
442 { 475 {
443 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 476 TestInterface* imp = V8TestInterface::toNative(info.Holder());
444 TestImplements::implementsVoidMethod(imp); 477 TestImplements::implementsVoidMethod(imp);
445 } 478 }
446 479
447 static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info) 480 static void implementsVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info)
448 { 481 {
449 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 482 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
450 TestInterfaceV8Internal::implementsVoidMethodMethod(info); 483 TestInterfaceV8Internal::implementsVoidMethodMethod(info);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 if (info.Holder()->HasRealNamedProperty(name)) 628 if (info.Holder()->HasRealNamedProperty(name))
596 return; 629 return;
597 630
598 TestInterface* collection = V8TestInterface::toNative(info.Holder()); 631 TestInterface* collection = V8TestInterface::toNative(info.Holder());
599 AtomicString propertyName = toCoreAtomicString(name); 632 AtomicString propertyName = toCoreAtomicString(name);
600 bool element0Enabled = false; 633 bool element0Enabled = false;
601 RefPtr<Node> element0; 634 RefPtr<Node> element0;
602 bool element1Enabled = false; 635 bool element1Enabled = false;
603 RefPtr<NodeList> element1; 636 RefPtr<NodeList> element1;
604 collection->getItem(propertyName, element0Enabled, element0, element1Enabled , element1); 637 collection->getItem(propertyName, element0Enabled, element0, element1Enabled , element1);
638 if (!element0Enabled && !element1Enabled)
639 return;
605 if (element0Enabled) { 640 if (element0Enabled) {
606 v8SetReturnValueFast(info, element0.release(), collection); 641 v8SetReturnValueFast(info, element0.release(), collection);
607 return; 642 return;
608 } 643 }
609 644
610 if (element1Enabled) { 645 if (element1Enabled) {
611 v8SetReturnValueFast(info, element1.release(), collection); 646 v8SetReturnValueFast(info, element1.release(), collection);
612 return; 647 return;
613 } 648 }
614 649
615 return; 650 v8SetReturnValueNull(info);
616 } 651 }
617 652
618 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 653 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
619 { 654 {
620 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 655 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
621 TestInterfaceV8Internal::namedPropertyGetter(name, info); 656 TestInterfaceV8Internal::namedPropertyGetter(name, info);
622 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 657 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
623 } 658 }
624 659
625 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 660 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 #endif // ENABLE(CONDITION_PARTIAL) 731 #endif // ENABLE(CONDITION_PARTIAL)
697 #if ENABLE(CONDITION_PARTIAL) 732 #if ENABLE(CONDITION_PARTIAL)
698 {"supplementalStr2", TestInterfaceV8Internal::supplementalStr2AttributeGette rCallback, TestInterfaceV8Internal::supplementalStr2AttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttri bute>(v8::None), 0 /* on instance */}, 733 {"supplementalStr2", TestInterfaceV8Internal::supplementalStr2AttributeGette rCallback, TestInterfaceV8Internal::supplementalStr2AttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttri bute>(v8::None), 0 /* on instance */},
699 #endif // ENABLE(CONDITION_PARTIAL) 734 #endif // ENABLE(CONDITION_PARTIAL)
700 #if ENABLE(CONDITION_PARTIAL) 735 #if ENABLE(CONDITION_PARTIAL)
701 {"supplementalNode", TestInterfaceV8Internal::supplementalNodeAttributeGette rCallback, TestInterfaceV8Internal::supplementalNodeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttri bute>(v8::None), 0 /* on instance */}, 736 {"supplementalNode", TestInterfaceV8Internal::supplementalNodeAttributeGette rCallback, TestInterfaceV8Internal::supplementalNodeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttri bute>(v8::None), 0 /* on instance */},
702 #endif // ENABLE(CONDITION_PARTIAL) 737 #endif // ENABLE(CONDITION_PARTIAL)
703 }; 738 };
704 739
705 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = { 740 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = {
741 {"namedItem", TestInterfaceV8Internal::namedItemMethodCallback, 0, 1},
706 {"implementsVoidMethod", TestInterfaceV8Internal::implementsVoidMethodMethod Callback, 0, 0}, 742 {"implementsVoidMethod", TestInterfaceV8Internal::implementsVoidMethodMethod Callback, 0, 0},
707 {"implementsComplexMethod", TestInterfaceV8Internal::implementsComplexMethod MethodCallback, 0, 2}, 743 {"implementsComplexMethod", TestInterfaceV8Internal::implementsComplexMethod MethodCallback, 0, 2},
708 {"implementsCustomVoidMethod", TestInterfaceV8Internal::implementsCustomVoid MethodMethodCallback, 0, 0}, 744 {"implementsCustomVoidMethod", TestInterfaceV8Internal::implementsCustomVoid MethodMethodCallback, 0, 0},
709 #if ENABLE(CONDITION_PARTIAL) 745 #if ENABLE(CONDITION_PARTIAL)
710 {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCa llback, 0, 0}, 746 {"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCa llback, 0, 0},
711 #endif // ENABLE(CONDITION_PARTIAL) 747 #endif // ENABLE(CONDITION_PARTIAL)
712 #if ENABLE(CONDITION_PARTIAL) 748 #if ENABLE(CONDITION_PARTIAL)
713 {"supplementalMethod2", TestInterfaceV8Internal::supplementalMethod2MethodCa llback, 0, 2}, 749 {"supplementalMethod2", TestInterfaceV8Internal::supplementalMethod2MethodCa llback, 0, 2},
714 #endif // ENABLE(CONDITION_PARTIAL) 750 #endif // ENABLE(CONDITION_PARTIAL)
715 #if ENABLE(CONDITION_PARTIAL) 751 #if ENABLE(CONDITION_PARTIAL)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 886 }
851 887
852 template<> 888 template<>
853 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 889 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
854 { 890 {
855 return toV8(impl, creationContext, isolate); 891 return toV8(impl, creationContext, isolate);
856 } 892 }
857 893
858 } // namespace WebCore 894 } // namespace WebCore
859 #endif // ENABLE(Condition1) || ENABLE(Condition2) 895 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW
« no previous file with comments | « Source/bindings/tests/idls/TestInterface.idl ('k') | Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698