[WebIDL] Generate named property deleters
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 May 2017 23:54:51 +0000 (23:54 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 May 2017 23:54:51 +0000 (23:54 +0000)
commitb0323632b0b9c435be49b29c35583f71aced71b2
tree35ea387fa6e28d3c7356fdb2bcd727810ac3cb53
parent53f917a70d7af92a0c3e711f884952f34020704b
[WebIDL] Generate named property deleters
https://bugs.webkit.org/show_bug.cgi?id=172688

Reviewed by Chris Dumez.

Source/WebCore:

Test: js/dom/named-property-deleter.html

* WebCore.xcodeproj/project.pbxproj:
Add new file, JSDOMAbstractOperations.h

* bindings/js/JSDOMAbstractOperations.h: Added.
(WebCore::isVisibleNamedProperty):
Add an implementation of the abstract operation WebIDL calls the 'named property visibility algorithm'.
It is used by many WebIDL algorithms, but currently I am only using this implementation for deleters.
In the future, we should try and move the other property access generators to use it as well.

* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::deleteProperty): Deleted.
(WebCore::JSDOMStringMap::deletePropertyByIndex): Deleted.
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::deleteProperty): Deleted.
(WebCore::JSStorage::deletePropertyByIndex): Deleted.
Remove now generated deleteProperty and deletePropertyByIndex implementations.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDeletePropertyCommon):
(GenerateDeletePropertyDefinition):
(GenerateDeletePropertyByIndexDefinition):
(GenerateNamedDeleterDefinition):
Added generation for named deleters. We generate both deleteProperty and deletePropertyByIndex.

(InstanceOverridesDelete):
Add predicate for whether the header should declare deleteProperty and deletePropertyByIndex.

(GenerateHeader):
Move property access hook declarations closer to each other. Use new InstanceOverridesDelete
predicate for deleteProperty and deletePropertyByIndex.

(GenerateImplementation):
Add call to generate named deleter if one exists.

(GenerateConstructorHelperMethods):
Remove an old FIXME that that was no longer true, there are no more interfaces that inherit from
an interface with [NoInterfaceObject].

* dom/DOMStringMap.idl:
Removes CustomDeleteProperty and sorts extended attributes.

* dom/DatasetDOMStringMap.h:
* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::isSupportedPropertyName):
Added. This is a bindings support function (much like supportedPropertyNames()) that is
used JSDOMAbstractOperations.h's isVisibleNamedProperty.

(WebCore::DatasetDOMStringMap::supportedPropertyNames):
Convert to an early return.

(WebCore::DatasetDOMStringMap::deleteNamedProperty):
(WebCore::DatasetDOMStringMap::deleteItem): Deleted.
Renamed deleteItem to deleteNamedProperty, which is the name the bindings use for deleter
operations without an identifier.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::sessionStorage):
Fix incorrect indentation that bothered me.

* storage/Storage.cpp:
* storage/Storage.h:
- Remove isDisabledByPrivateBrowsing(), which had no definition.
- Add isSupportedPropertyName(), which the deleter code (via the isVisibleNamedProperty algorithm)
  needs.

* storage/Storage.idl:
Removes CustomDeleteProperty, sorts the extended attributes, adds 'deleter' special
to the removeItem operation and adds a commented out 'setter' special to the 'setItem'
operation.

* bindings/scripts/test/JS/JSTestObj.h:
Update result for declarations moving around.

* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: Added.
* bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: Added.
* bindings/scripts/test/TestNamedDeleterNoIdentifier.idl: Added.
* bindings/scripts/test/TestNamedDeleterThrowingException.idl: Added.
* bindings/scripts/test/TestNamedDeleterWithIdentifier.idl: Added.
* bindings/scripts/test/TestNamedDeleterWithIndexedGetter.idl: Added.
Add new tests for named deleters.

LayoutTests:

* js/dom/named-property-deleter-expected.txt: Added.
* js/dom/named-property-deleter.html: Added.
Add test for various named deleter conditions.

* storage/domstorage/localstorage/delete-defineproperty-removal-expected.txt:
* storage/domstorage/localstorage/delete-defineproperty-removal.html:
Update test to log more information about what its doing and log it to the DOM rather
than the console, to make comparing results in browsers easier. Also, note in the
bug that the results are wrong, and have been wrong, due to https://webkit.org/b/172687.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/named-property-deleter-expected.txt [new file with mode: 0644]
LayoutTests/js/dom/named-property-deleter.html [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/delete-defineproperty-removal-expected.txt
LayoutTests/storage/domstorage/localstorage/delete-defineproperty-removal.html
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSDOMAbstractOperations.h [new file with mode: 0644]
Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
Source/WebCore/bindings/js/JSStorageCustom.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
Source/WebCore/bindings/scripts/test/TestNamedDeleterNoIdentifier.idl [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/TestNamedDeleterThrowingException.idl [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/TestNamedDeleterWithIdentifier.idl [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/TestNamedDeleterWithIndexedGetter.idl [new file with mode: 0644]
Source/WebCore/crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp
Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h
Source/WebCore/dom/DOMStringMap.idl
Source/WebCore/dom/DatasetDOMStringMap.cpp
Source/WebCore/dom/DatasetDOMStringMap.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/storage/Storage.cpp
Source/WebCore/storage/Storage.h
Source/WebCore/storage/Storage.idl