Skip to content
  • haraken@chromium.org's avatar
    Rename [Optional=CallWithDefalutValue] and [Optional=CallWithNullValue] · c76764bd
    haraken@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=78200
    
    Reviewed by Adam Barth.
    
    [Optional=CallWithDefalutValue] and [Optional=CallWithNullValue] are confusing.
    
    - [Optional=CallWithDefalutValue] indicates that a missing value should be treated
    as if the JavaScript undefined is passed.
    - [Optional=CallWithNullValue] indicates that a missing value should be treated as
    the WebKit null value (i.e. JSValue() or v8::Local<v8::Value>()).
    - Actually, the difference between [Optional=CallWithDefalutValue] and
    [Optional=CallWithNullValue] appears only when the type of the missing value is DOMString.
    In case of [Optional=CallWithDefalutValue], the missing value is converted to the string
    "undefined". On the other hand, in case of [Optional=CallWithNullValue], the missing
    value is converted to the WebKit null string.
    
    With these observations, this patch renames them as follows:
    
    - Rename [Optional=CallWithDefalutValue] to [Optional=TreatAsUndefined].
    - Remove [Optional=CallWithNullValue]. Instead, we use
    [Optional=TreatAsUndefined, TreatUndefinedAs=NullString].
    
    Test: bindings/scripts/test/TestInterface.idl
    
    * bindings/js/JSDOMBinding.h: Renamed MissingIsUndefined to MissingIsUndefinedValue,
    renamed MissingIsEmpty to MissingIsNullValue.
    * bindings/v8/V8Binding.h: Ditto.
    * bindings/v8/custom/V8BindingMacros.h: Ditto.
    
    * bindings/scripts/CodeGeneratorJS.pm: Modified to support the IDL attribute renaming.
    (GenerateParametersCheck):
    (GenerateConstructorDefinition):
    * bindings/scripts/CodeGeneratorV8.pm: Ditto.
    (GenerateParametersCheck):
    (RequiresCustomSignature):
    
    * Modules/gamepad/GamepadList.idl: Renamed IDL attributes as described above.
    * Modules/intents/Intent.idl:
    * css/CSSMediaRule.idl:
    * css/CSSPrimitiveValue.idl:
    * css/CSSRuleList.idl:
    * css/CSSStyleDeclaration.idl:
    * css/CSSStyleSheet.idl:
    * css/CSSValueList.idl:
    * css/MediaList.idl:
    * css/MediaQueryList.idl:
    * css/MediaQueryListListener.idl:
    * css/StyleMedia.idl:
    * css/StyleSheetList.idl:
    * css/WebKitCSSKeyframesRule.idl:
    * css/WebKitCSSMatrix.idl:
    * dom/CharacterData.idl:
    * dom/ClientRectList.idl:
    * dom/CompositionEvent.idl:
    * dom/CustomEvent.idl:
    * dom/DOMImplementation.idl:
    * dom/DOMStringList.idl:
    * dom/DataTransferItem.idl:
    * dom/DataTransferItemList.idl:
    * dom/DeviceMotionEvent.idl:
    * dom/DeviceOrientationEvent.idl:
    * dom/Document.idl:
    * dom/Element.idl:
    * dom/Event.idl:
    * dom/HashChangeEvent.idl:
    * dom/KeyboardEvent.idl:
    * dom/MessageEvent.idl:
    * dom/MouseEvent.idl:
    * dom/MutationEvent.idl:
    * dom/NamedNodeMap.idl:
    * dom/Node.idl:
    * dom/NodeFilter.idl:
    * dom/NodeList.idl:
    * dom/OverflowEvent.idl:
    * dom/Range.idl:
    * dom/ShadowRoot.idl:
    * dom/Text.idl:
    * dom/TextEvent.idl:
    * dom/TouchEvent.idl:
    * dom/UIEvent.idl:
    * dom/WheelEvent.idl:
    * html/DOMFormData.idl:
    * html/HTMLAllCollection.idl:
    * html/HTMLAudioElement.idl:
    * html/HTMLCanvasElement.idl:
    * html/HTMLCollection.idl:
    * html/HTMLDocument.idl:
    * html/HTMLElement.idl:
    * html/HTMLInputElement.idl:
    * html/HTMLMediaElement.idl:
    * html/HTMLOptionElement.idl:
    * html/HTMLOptionsCollection.idl:
    * html/HTMLSelectElement.idl:
    * html/HTMLTableElement.idl:
    * html/HTMLTableRowElement.idl:
    * html/HTMLTableSectionElement.idl:
    * html/HTMLTextAreaElement.idl:
    * html/TextTrackCue.idl:
    * html/canvas/CanvasGradient.idl:
    * html/canvas/CanvasRenderingContext2D.idl:
    * html/canvas/Float32Array.idl:
    * html/canvas/Float64Array.idl:
    * html/canvas/Int16Array.idl:
    * html/canvas/Int32Array.idl:
    * html/canvas/Int8Array.idl:
    * html/canvas/OESVertexArrayObject.idl:
    * html/canvas/Uint16Array.idl:
    * html/canvas/Uint32Array.idl:
    * html/canvas/Uint8Array.idl:
    * html/canvas/Uint8ClampedArray.idl:
    * page/Console.idl:
    * page/DOMSelection.idl:
    * page/DOMWindow.idl:
    * page/History.idl:
    * page/Location.idl:
    * plugins/DOMMimeTypeArray.idl:
    * plugins/DOMPlugin.idl:
    * plugins/DOMPluginArray.idl:
    * storage/IDBDatabase.idl:
    * storage/StorageEvent.idl:
    * svg/ElementTimeControl.idl:
    * svg/SVGDocument.idl:
    * svg/SVGElementInstanceList.idl:
    * svg/SVGFEDropShadowElement.idl:
    * svg/SVGFEGaussianBlurElement.idl:
    * svg/SVGFEMorphologyElement.idl:
    * svg/SVGFilterElement.idl:
    * svg/SVGLocatable.idl:
    * svg/SVGMarkerElement.idl:
    * svg/SVGPathElement.idl:
    * svg/SVGSVGElement.idl:
    * svg/SVGStylable.idl:
    * svg/SVGTests.idl:
    * svg/SVGTextContentElement.idl:
    * webaudio/AudioNode.idl:
    * workers/SharedWorker.idl:
    * workers/WorkerContext.idl:
    * xml/DOMParser.idl:
    * xml/XMLSerializer.idl:
    * xml/XPathEvaluator.idl:
    * xml/XPathExpression.idl:
    * xml/XPathNSResolver.idl:
    * xml/XPathResult.idl:
    
    * bindings/scripts/test/TestInterface.idl: Added test cases for [Optional],
    [Optional=TreatAsUndefined] and [Optional=TreatAsUndefined, TreatUndefinedAs=NullString]
    * bindings/scripts/test/TestNamedConstructor.idl: Renamed IDL attributes as described above.
    * bindings/scripts/test/TestObj.idl: Ditto.
    
    * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated run-bindings-tests results.
    (WebDOMTestObj::methodWithOptionalString):
    (WebDOMTestObj::methodWithOptionalIsTreatAsUndefinedString):
    (WebDOMTestObj::methodWithOptionalIsNullStringString):
    * bindings/scripts/test/CPP/WebDOMTestObj.h: Ditto.
    * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto.
    (webkit_dom_test_obj_method_with_optional_string):
    (webkit_dom_test_obj_method_with_optional_is_treat_as_undefined_string):
    (webkit_dom_test_obj_method_with_optional_is_null_string_string):
    * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Ditto.
    * bindings/scripts/test/JS/JSFloat64Array.cpp: Ditto.
    (WebCore::jsFloat64ArrayPrototypeFunctionFoo):
    * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: Ditto.
    (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
    (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
    * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: Ditto.
    (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
    * bindings/scripts/test/JS/JSTestEventTarget.cpp: Ditto.
    (WebCore::jsTestEventTargetPrototypeFunctionItem):
    (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent):
    * bindings/scripts/test/JS/JSTestInterface.cpp: Ditto.
    (WebCore::JSTestInterfaceConstructor::constructJSTestInterface):
    (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
    * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: Ditto.
    (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
    * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: Ditto.
    (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor):
    * bindings/scripts/test/JS/JSTestObj.cpp: Ditto.
    (WebCore):
    (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
    (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs):
    (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
    (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
    (WebCore::jsTestObjPrototypeFunctionSerializedValue):
    (WebCore::jsTestObjPrototypeFunctionIdbKey):
    (WebCore::jsTestObjPrototypeFunctionOptionsObject):
    (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException):
    (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
    (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
    (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
    (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString):
    (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalIsTreatAsUndefinedString):
    (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalIsNullStringString):
    (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
    (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
    (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
    (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
    (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
    (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
    (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
    (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
    (WebCore::jsTestObjConstructorFunctionOverloadedMethod11):
    (WebCore::jsTestObjConstructorFunctionOverloadedMethod12):
    (WebCore::jsTestObjPrototypeFunctionConvert1):
    (WebCore::jsTestObjPrototypeFunctionConvert2):
    (WebCore::jsTestObjPrototypeFunctionConvert3):
    (WebCore::jsTestObjPrototypeFunctionConvert4):
    (WebCore::jsTestObjPrototypeFunctionConvert5):
    (WebCore::jsTestObjPrototypeFunctionStrictFunction):
    * bindings/scripts/test/JS/JSTestObj.h: Ditto.
    (WebCore):
    * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: Ditto.
    (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface):
    * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto.
    * bindings/scripts/test/ObjC/DOMTestObj.mm: Ditto.
    (-[DOMTestObj methodWithOptionalString:]):
    (-[DOMTestObj methodWithOptionalIsTreatAsUndefinedString:]):
    (-[DOMTestObj methodWithOptionalIsNullStringString:]):
    * bindings/scripts/test/V8/V8Float64Array.cpp: Ditto.
    (WebCore::Float64ArrayInternal::fooCallback):
    * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: Ditto.
    (WebCore::TestActiveDOMObjectInternal::excitingFunctionCallback):
    (WebCore::TestActiveDOMObjectInternal::postMessageCallback):
    * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: Ditto.
    (WebCore::TestCustomNamedGetterInternal::anotherFunctionCallback):
    * bindings/scripts/test/V8/V8TestEventTarget.cpp: Ditto.
    (WebCore::TestEventTargetInternal::itemCallback):
    (WebCore::TestEventTargetInternal::dispatchEventCallback):
    * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto.
    (WebCore::TestInterfaceInternal::supplementalMethod2Callback):
    (WebCore::V8TestInterface::constructorCallback):
    * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: Ditto.
    (WebCore::TestMediaQueryListListenerInternal::methodCallback):
    * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: Ditto.
    (WebCore::V8TestNamedConstructorConstructorCallback):
    * bindings/scripts/test/V8/V8TestObj.cpp: Ditto.
    (WebCore::TestObjInternal::voidMethodWithArgsCallback):
    (WebCore::TestObjInternal::intMethodWithArgsCallback):
    (WebCore::TestObjInternal::objMethodWithArgsCallback):
    (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback):
    (WebCore::TestObjInternal::idbKeyCallback):
    (WebCore::TestObjInternal::optionsObjectCallback):
    (WebCore::TestObjInternal::customArgsAndExceptionCallback):
    (WebCore::TestObjInternal::methodWithOptionalArgCallback):
    (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback):
    (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback):
    (WebCore::TestObjInternal::methodWithOptionalStringCallback):
    (TestObjInternal):
    (WebCore::TestObjInternal::methodWithOptionalIsTreatAsUndefinedStringCallback):
    (WebCore::TestObjInternal::methodWithOptionalIsNullStringStringCallback):
    (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback):
    (WebCore::TestObjInternal::overloadedMethod1Callback):
    (WebCore::TestObjInternal::overloadedMethod2Callback):
    (WebCore::TestObjInternal::overloadedMethod3Callback):
    (WebCore::TestObjInternal::overloadedMethod4Callback):
    (WebCore::TestObjInternal::overloadedMethod6Callback):
    (WebCore::TestObjInternal::overloadedMethod7Callback):
    (WebCore::TestObjInternal::classMethodWithOptionalCallback):
    (WebCore::TestObjInternal::overloadedMethod11Callback):
    (WebCore::TestObjInternal::overloadedMethod12Callback):
    (WebCore::TestObjInternal::enabledAtRuntimeMethod1Callback):
    (WebCore::TestObjInternal::enabledAtRuntimeMethod2Callback):
    (WebCore::TestObjInternal::convert1Callback):
    (WebCore::TestObjInternal::convert2Callback):
    (WebCore::TestObjInternal::convert3Callback):
    (WebCore::TestObjInternal::convert4Callback):
    (WebCore::TestObjInternal::convert5Callback):
    (WebCore::TestObjInternal::strictFunctionCallback):
    (WebCore):
    * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: Ditto.
    (WebCore::V8TestSerializedScriptValueInterface::constructorCallback):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    c76764bd