Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
WebIDL: Rename [ReturnNewObject] to [NewObject] and use it more consi…
…stently 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 Canonical link: https://commits.webkit.org/167334@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
64 changed files
with
408 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.