WebIDL: Rename [ReturnNewObject] to [NewObject] and use it more consistently in DOM
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Sep 2015 23:01:09 +0000 (23:01 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Sep 2015 23:01:09 +0000 (23:01 +0000)
commit2847dfb139d6f1b37a7273d322cfee343db97dce
tree48b4a17b84bd6d653f411ca7aef7e531e4bcc1a9
parent8be9629d48efc8495a4bf985c45273fae0eba537
WebIDL: Rename [ReturnNewObject] to [NewObject] and use it more consistently in DOM
https://bugs.webkit.org/show_bug.cgi?id=149192

Reviewed by Darin Adler.

Rename [ReturnNewObject] to [NewObject] and use it more consistently in
DOM.

This aligns our IDL extended attribute naming with standard Web IDL:
https://heycam.github.io/webidl/#NewObject

We already have [ReturnNewObject] in most places that the DOM
specification uses [NewObject] but we are missing a few so I'll
fix this as well:
https://dom.spec.whatwg.org/#interface-document

Using [NewObject] lets the bindings generator know that the API in
question always returns new objects and that we can bypass the check
for existing wrappers and directly create a new wrapper for the
returned object.

This patch also adds support for generating the toJSNewlyCreated()
utility function for most types. Previously, to use [ReturnNewObject]
for a new type, you needed to add the type to a hard-coded list in
the bindings generator then provide your own implementation for
toJSNewlyCreated() as custom bindings.

No new-exposed behavior change.

* bindings/js/JSDocumentCustom.cpp:
* bindings/js/JSEventCustom.cpp:
* bindings/js/JSNodeListCustom.cpp:
Add toJSNewlyCreated() custom implementation for Node, Event and
Document, that shares code with the existing toJS() implementation for
those types.

* bindings/js/JSCDATASectionCustom.cpp: Removed.
* bindings/js/JSTextCustom.cpp: Removed.
* bindings/js/JSTouchCustom.cpp: Removed.
* bindings/js/JSTouchListCustom.cpp: Removed.
Drop several custom bindings files as the bindings generator is
now able to generate the toJSNewlyCreated() utility function for
most types.

* bindings/scripts/CodeGeneratorJS.pm:
- Rename [ReturnNewObject] to [NewObject].
- Generate a toJSNewlyCreated() whenever we generate a toJS() already.
  Get rid of the hard-coded list of types that need a
  toJSNewlyCreated().

* bindings/scripts/IDLAttributes.txt:
Rename [ReturnNewObject] to [NewObject].

* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestActiveDOMObject.h:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.h:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.h:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestException.h:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.h:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.h:
* bindings/scripts/test/JS/JSattribute.cpp:
* bindings/scripts/test/JS/JSattribute.h:
* bindings/scripts/test/JS/JSreadonly.cpp:
* bindings/scripts/test/JS/JSreadonly.h:
Rebaseline bindings tests.

* dom/Attr.idl:
* dom/CDATASection.idl:
* dom/Comment.idl:
* dom/DocumentFragment.idl:
* dom/DocumentType.idl:
* dom/EntityReference.idl:
* dom/ProcessingInstruction.idl:
Add [JSGenerateToJSObject] so that the bindings generator generates
a toJS() / toJSNewlyCreated() for this type. While it is not strictly
needed, it avoids falling back to using the toJS() from Node which
calls the virtual nodeType() function to determine the node type.
This change was made for efficiency purposes.

* dom/DOMImplementation.idl:
Rename [ReturnNewObject] to [NewObject] and add it to createHTMLDocument()
as well, as per the specification:
https://dom.spec.whatwg.org/#interface-domimplementation

* dom/Document.idl:
Rename [ReturnNewObject] to [NewObject] and add it to more operations
as per he DOM specification:
https://dom.spec.whatwg.org/#document

* dom/Node.idl:
Add [NewObject] to cloneNode() as per the DOM specification:
https://dom.spec.whatwg.org/#node

* dom/ParentNode.idl:
Add [NewObject] to querySelectorAll() as per the DOM specification:
https://dom.spec.whatwg.org/#parentnode

* dom/Range.idl:
Add [NewObject] for several operations, as per the DOM specification:
https://dom.spec.whatwg.org/#interface-range

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
64 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSCDATASectionCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSDocumentCustom.cpp
Source/WebCore/bindings/js/JSElementCustom.h
Source/WebCore/bindings/js/JSEventCustom.cpp
Source/WebCore/bindings/js/JSNodeListCustom.cpp
Source/WebCore/bindings/js/JSTextCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSTouchCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSTouchListCustom.cpp [deleted file]
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLAttributes.txt
Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h
Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h
Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h
Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h
Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestException.h
Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h
Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h
Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h
Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.h
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h
Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp
Source/WebCore/bindings/scripts/test/JS/JSattribute.h
Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp
Source/WebCore/bindings/scripts/test/JS/JSreadonly.h
Source/WebCore/dom/Attr.idl
Source/WebCore/dom/CDATASection.idl
Source/WebCore/dom/Comment.idl
Source/WebCore/dom/DOMImplementation.idl
Source/WebCore/dom/Document.idl
Source/WebCore/dom/DocumentFragment.idl
Source/WebCore/dom/DocumentType.idl
Source/WebCore/dom/EntityReference.idl
Source/WebCore/dom/Node.idl
Source/WebCore/dom/ParentNode.idl
Source/WebCore/dom/ProcessingInstruction.idl
Source/WebCore/dom/Range.idl