Make some bindings improvements, with smaller code size for error message generation
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Apr 2014 03:43:40 +0000 (03:43 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Apr 2014 03:43:40 +0000 (03:43 +0000)
commit1333520e731c7237e3dd4254ea9b58a50fe9607f
tree9733ec9e5c15b7f4387ca5ba74fd2efdf203e5f3
parentc5085668a3bf5ebb06f41a9d4263464ac921d6bd
Make some bindings improvements, with smaller code size for error message generation
https://bugs.webkit.org/show_bug.cgi?id=131285

Reviewed by Andreas Kling.

Source/WebCore:

* WebCore.exp.in: Updated to remove old and add new functions, for use by the Internals
JavaScript bindings.

* bindings/js/JSDOMBinding.cpp:
(WebCore::makeDOMBindingsTypeErrorStringInternal): Deleted.
(WebCore::throwTypeError): Added. Helper to avoid repeating throwVMError/createTypeError.
(WebCore::appendArgumentMustBe): Added. Helper for building up argument error strings.
(WebCore::reportDeprecatedGetterError): Added. For bindings to use.
(WebCore::throwArgumentMustBeEnumError): Ditto.
(WebCore::throwArgumentMustBeFunctionError): Ditto.
(WebCore::throwArgumentTypeError): Ditto.
(WebCore::throwArrayElementTypeError): Ditto.
(WebCore::throwAttributeTypeError): Ditto.
(WebCore::throwConstructorDocumentUnavailableError): Ditto.
(WebCore::throwGetterTypeError): Ditto.
(WebCore::throwSequenceTypeError): Ditto.
(WebCore::throwSetterTypeError): Ditto.
(WebCore::throwThisTypeError): Ditto.

* bindings/js/JSDOMBinding.h: Added declarations for new functions. Removed forward
declarations for things not used in this file. Use nullptr instead of 0. Format
templates consistently. Use a better for loop in the jsArray function. Removed
unused HasMemoryCostMemberFunction, makeDOMBindingsTypeErrorString, and
makeDOMBindingsTypeErrorStringInternal.

* bindings/js/JSNavigatorCustom.cpp: Fixed a hand-written binding that was using
makeDOMBindingsTypeErrorString to make a string.

* bindings/js/ScriptController.h: Updated forward declarations.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Cut down on use of UNUSED_PARAM. Use the new functions
for errors, keeping the code in the generated file to a minimum.
(GenerateParametersCheck): Ditto.
(GenerateConstructorDefinition): Ditto.

* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSattribute.cpp:
* bindings/scripts/test/JS/JSreadonly.cpp:
Updated expected results for changes above.

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Updated for
changes in JavaScript binding functions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSNavigatorCustom.cpp
Source/WebCore/bindings/js/ScriptController.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp
Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in