[WebIDL] Move plugin object customization into the generator
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Jul 2017 18:27:26 +0000 (18:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Jul 2017 18:27:26 +0000 (18:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174238

Patch by Sam Weinig <sam@webkit.org> on 2017-07-10
Reviewed by Chris Dumez.

- Added [Plugin] extended attribute to forward the necessary hooks
  for get/set/delete to the plugin code.
- Removed [CustomNamedSetter] and replaced it's remaining uses
  [CustomPut] (formally called [CustomPutFunction]).
- Renamed [CustomNamedGetterOnPrototype] to [CustomPutOnPrototype]
  because that is actually what it does.
- Removed [CustomGetOwnPropertySlotByIndex] and made
  [CustomGetOwnPropertySlot] imply it, as the other custom hooks
  do.
- Renamed [CustomEnumerateProperty] to [CustomGetOwnPropertyNames]
  to conform with other attribute names.
- Renamed [CustomCall] to [CustomGetCallData] to conform with other
  attribute names.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSHTMLAppletElementCustom.cpp: Removed.
* bindings/js/JSHTMLEmbedElementCustom.cpp: Removed.
* bindings/js/JSHTMLObjectElementCustom.cpp: Removed.
Remove custom bindings.

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::putCommon):
(WebCore::JSCSSStyleDeclaration::put):
(WebCore::JSCSSStyleDeclaration::putByIndex):
(WebCore::JSCSSStyleDeclaration::putDelegate): Deleted.
Use [CustomPut] rather than [CustomNamedSetter] to allow us
to get rid of [CustomNamedSetter]. Reuse put delegate as
common code to share between put and putByIndex.

* bindings/js/JSLocationCustom.cpp:
(WebCore::getOwnPropertySlotCommon):
(WebCore::JSLocation::getOwnPropertySlot):
(WebCore::JSLocation::getOwnPropertySlotByIndex):
Replace [CustomGetOwnPropertySlotAndDescriptor] with [CustomGetOwnPropertySlot]
which is more clear and reduces the number of variants of this hook override
we need.

(WebCore::putCommon):
(WebCore::JSLocation::put):
(WebCore::JSLocation::putByIndex):
Use [CustomPut] rather than [CustomNamedSetter] to allow us
to get rid of [CustomNamedSetter]. Reuse put delegate as
common code to share between put and putByIndex.

(WebCore::JSLocationPrototype::put):
[CustomPutOnPrototype] (which weirdly used incorrectly be called
[CustomNamedGetterOnPrototype]) now works like [CustomPut] meaning
you need to call Base.

* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginElementPropertyGetter):
(WebCore::pluginElementCustomGetOwnPropertySlot):
(WebCore::pluginElementCustomPut):
* bindings/js/JSPluginElementFunctions.h:
(WebCore::pluginElementCustomGetOwnPropertySlot): Deleted.
Remove templatized pluginElementCustomGetOwnPropertySlot, which was
completely unnecessary and merge its functionality into the out of
line overload. Remove pluginElementPropertyGetter from the header,
since it is only used in implementation, and unify the naming and
argument position (JSHTMLElement* comes first) of the hooks.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateIndexedGetter):
(GenerateNamedGetter):
(GenerateGetOwnPropertySlot):
(GenerateGetOwnPropertySlotByIndex):
(GenerateGetOwnPropertyNames):
(GeneratePut):
(GeneratePutByIndex):
(GenerateDeleteProperty):
(GenerateDeletePropertyByIndex):
(GenerateNamedDeleterDefinition):
(InstanceOverridesGetOwnPropertySlot):
(InstanceOverridesGetOwnPropertyNames):
(InstanceOverridesPut):
(InstanceOverridesDeleteProperty):
(GenerateHeader):
(GenerateImplementation):
(GenerateGetCallData):
(GeneratePluginCall):
(GenerateLegacyCallerDefinitions):
(GenerateLegacyCallerDefinition):
(GeneratePrototypeDeclaration):
(InstanceOverridesGetCallData):
(HeaderNeedsPrototypeDeclaration):
- Add support for [Plugin]
- Remove support for [CustomNamedSetter]
- Replace [CustomGetOwnPropertySlotByIndex] with [CustomGetOwnPropertySlot]
- Replace [CustomEnumerateProperty] with [CustomGetOwnPropertyNames]
- Replace [CustomPutFunction] with [CustomPut].
- Make subroutine names more consistent (remove a few Definition suffixes)

* bindings/scripts/IDLAttributes.json:
Update for new / removed attributes.

* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestPluginInterface.cpp: Added.
* bindings/scripts/test/JS/JSTestPluginInterface.h: Added.
* bindings/scripts/test/TestInterface.idl:
* bindings/scripts/test/TestPluginInterface.idl: Added.
Update / add tests.

* css/CSSStyleDeclaration.idl:
* html/HTMLAppletElement.idl:
* html/HTMLEmbedElement.idl:
* html/HTMLObjectElement.idl:
* page/DOMWindow.idl:
* page/Location.idl:
* storage/Storage.idl:
Update for new / renamed attributes.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@219302 268f45cc-cd09-0410-ab3c-d52691b4dbfc

26 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSLocationCustom.cpp
Source/WebCore/bindings/js/JSPluginElementFunctions.cpp
Source/WebCore/bindings/js/JSPluginElementFunctions.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLAttributes.json
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/TestInterface.idl
Source/WebCore/bindings/scripts/test/TestPluginInterface.idl [new file with mode: 0644]
Source/WebCore/css/CSSStyleDeclaration.idl
Source/WebCore/html/HTMLAppletElement.idl
Source/WebCore/html/HTMLEmbedElement.idl
Source/WebCore/html/HTMLObjectElement.idl
Source/WebCore/page/DOMWindow.idl
Source/WebCore/page/Location.idl
Source/WebCore/storage/Storage.idl

index 7001a1b..288fe65 100644 (file)
@@ -1189,13 +1189,10 @@ set(WebCore_SOURCES
     bindings/js/JSEventListener.cpp
     bindings/js/JSEventTargetCustom.cpp
     bindings/js/JSExceptionBase.cpp
-    bindings/js/JSHTMLAppletElementCustom.cpp
     bindings/js/JSHTMLCanvasElementCustom.cpp
     bindings/js/JSHTMLCollectionCustom.cpp
     bindings/js/JSHTMLDocumentCustom.cpp
     bindings/js/JSHTMLElementCustom.cpp
-    bindings/js/JSHTMLEmbedElementCustom.cpp
-    bindings/js/JSHTMLObjectElementCustom.cpp
     bindings/js/JSHTMLTemplateElementCustom.cpp
     bindings/js/JSHistoryCustom.cpp
     bindings/js/JSIDBCursorCustom.cpp
index 1e1a43b..5047dcb 100644 (file)
@@ -1,3 +1,124 @@
+2017-07-10  Sam Weinig  <sam@webkit.org>
+
+        [WebIDL] Move plugin object customization into the generator
+        https://bugs.webkit.org/show_bug.cgi?id=174238
+
+        Reviewed by Chris Dumez.
+
+        - Added [Plugin] extended attribute to forward the necessary hooks
+          for get/set/delete to the plugin code.
+        - Removed [CustomNamedSetter] and replaced it's remaining uses
+          [CustomPut] (formally called [CustomPutFunction]).
+        - Renamed [CustomNamedGetterOnPrototype] to [CustomPutOnPrototype]
+          because that is actually what it does.
+        - Removed [CustomGetOwnPropertySlotByIndex] and made 
+          [CustomGetOwnPropertySlot] imply it, as the other custom hooks
+          do.
+        - Renamed [CustomEnumerateProperty] to [CustomGetOwnPropertyNames]
+          to conform with other attribute names.
+        - Renamed [CustomCall] to [CustomGetCallData] to conform with other 
+          attribute names.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSHTMLAppletElementCustom.cpp: Removed.
+        * bindings/js/JSHTMLEmbedElementCustom.cpp: Removed.
+        * bindings/js/JSHTMLObjectElementCustom.cpp: Removed.
+        Remove custom bindings.
+
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::putCommon):
+        (WebCore::JSCSSStyleDeclaration::put):
+        (WebCore::JSCSSStyleDeclaration::putByIndex):
+        (WebCore::JSCSSStyleDeclaration::putDelegate): Deleted.
+        Use [CustomPut] rather than [CustomNamedSetter] to allow us
+        to get rid of [CustomNamedSetter]. Reuse put delegate as
+        common code to share between put and putByIndex.
+
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::getOwnPropertySlotCommon):
+        (WebCore::JSLocation::getOwnPropertySlot):
+        (WebCore::JSLocation::getOwnPropertySlotByIndex):
+        Replace [CustomGetOwnPropertySlotAndDescriptor] with [CustomGetOwnPropertySlot]
+        which is more clear and reduces the number of variants of this hook override
+        we need.
+
+        (WebCore::putCommon):
+        (WebCore::JSLocation::put):
+        (WebCore::JSLocation::putByIndex):
+        Use [CustomPut] rather than [CustomNamedSetter] to allow us
+        to get rid of [CustomNamedSetter]. Reuse put delegate as
+        common code to share between put and putByIndex.
+
+        (WebCore::JSLocationPrototype::put):
+        [CustomPutOnPrototype] (which weirdly used incorrectly be called 
+        [CustomNamedGetterOnPrototype]) now works like [CustomPut] meaning
+        you need to call Base.
+
+        * bindings/js/JSPluginElementFunctions.cpp:
+        (WebCore::pluginElementPropertyGetter):
+        (WebCore::pluginElementCustomGetOwnPropertySlot):
+        (WebCore::pluginElementCustomPut):
+        * bindings/js/JSPluginElementFunctions.h:
+        (WebCore::pluginElementCustomGetOwnPropertySlot): Deleted.
+        Remove templatized pluginElementCustomGetOwnPropertySlot, which was 
+        completely unnecessary and merge its functionality into the out of
+        line overload. Remove pluginElementPropertyGetter from the header,
+        since it is only used in implementation, and unify the naming and
+        argument position (JSHTMLElement* comes first) of the hooks.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateIndexedGetter):
+        (GenerateNamedGetter):
+        (GenerateGetOwnPropertySlot):
+        (GenerateGetOwnPropertySlotByIndex):
+        (GenerateGetOwnPropertyNames):
+        (GeneratePut):
+        (GeneratePutByIndex):
+        (GenerateDeleteProperty):
+        (GenerateDeletePropertyByIndex):
+        (GenerateNamedDeleterDefinition):
+        (InstanceOverridesGetOwnPropertySlot):
+        (InstanceOverridesGetOwnPropertyNames):
+        (InstanceOverridesPut):
+        (InstanceOverridesDeleteProperty):
+        (GenerateHeader):
+        (GenerateImplementation):
+        (GenerateGetCallData):
+        (GeneratePluginCall):
+        (GenerateLegacyCallerDefinitions):
+        (GenerateLegacyCallerDefinition):
+        (GeneratePrototypeDeclaration):
+        (InstanceOverridesGetCallData):
+        (HeaderNeedsPrototypeDeclaration):
+        - Add support for [Plugin]
+        - Remove support for [CustomNamedSetter]
+        - Replace [CustomGetOwnPropertySlotByIndex] with [CustomGetOwnPropertySlot]
+        - Replace [CustomEnumerateProperty] with [CustomGetOwnPropertyNames]
+        - Replace [CustomPutFunction] with [CustomPut].
+        - Make subroutine names more consistent (remove a few Definition suffixes)
+
+        * bindings/scripts/IDLAttributes.json:
+        Update for new / removed attributes.
+
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.h:
+        * bindings/scripts/test/JS/JSTestPluginInterface.cpp: Added.
+        * bindings/scripts/test/JS/JSTestPluginInterface.h: Added.
+        * bindings/scripts/test/TestInterface.idl:
+        * bindings/scripts/test/TestPluginInterface.idl: Added.
+        Update / add tests.
+
+        * css/CSSStyleDeclaration.idl:
+        * html/HTMLAppletElement.idl:
+        * html/HTMLEmbedElement.idl:
+        * html/HTMLObjectElement.idl:
+        * page/DOMWindow.idl:
+        * page/Location.idl:
+        * storage/Storage.idl:
+        Update for new / renamed attributes.
+
 2017-07-03  Brian Burg  <bburg@apple.com>
 
         Web Replay: remove some unused code
index 2af38c5..1c07b6f 100644 (file)
                BC2ED6BC0C6BD2F000920BFF /* JSAttrCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */; };
                BC305C790C076BB300CD20F0 /* JSHTMLObjectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC305C770C076BB300CD20F0 /* JSHTMLObjectElement.cpp */; };
                BC305C7A0C076BB300CD20F0 /* JSHTMLObjectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC305C780C076BB300CD20F0 /* JSHTMLObjectElement.h */; };
-               BC305CA40C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */; };
                BC33FB1B0F30EE85002CDD7C /* RenderLineBoxList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC33FB1A0F30EE85002CDD7C /* RenderLineBoxList.cpp */; };
                BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */; };
                BC348BD30DB7F804004ABAB9 /* JSXMLHttpRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BD10DB7F804004ABAB9 /* JSXMLHttpRequest.cpp */; };
                BC4918C90BFEA050009D6316 /* JSHTMLIFrameElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4918C30BFEA050009D6316 /* JSHTMLIFrameElement.h */; };
                BC491B780C023EFD009D6316 /* JSHTMLMarqueeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC491B760C023EFD009D6316 /* JSHTMLMarqueeElement.cpp */; };
                BC491B790C023EFD009D6316 /* JSHTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC491B770C023EFD009D6316 /* JSHTMLMarqueeElement.h */; };
-               BC4EDEF40C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */; };
                BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */; };
                BC51580B0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */; };
                BC53C5F50DA56B920021EB5D /* Gradient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53C5F40DA56B920021EB5D /* Gradient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC64B4DC0CB4298A005F2B62 /* CSSFontSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4D40CB4298A005F2B62 /* CSSFontSelector.h */; };
                BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6932710D7E293900AE44D1 /* JSDOMWindowBase.cpp */; };
                BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6932720D7E293900AE44D1 /* JSDOMWindowBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */; };
                BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */; };
                BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */; };
                BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAttrCustom.cpp; sourceTree = "<group>"; };
                BC305C770C076BB300CD20F0 /* JSHTMLObjectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLObjectElement.cpp; sourceTree = "<group>"; };
                BC305C780C076BB300CD20F0 /* JSHTMLObjectElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLObjectElement.h; sourceTree = "<group>"; };
-               BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLObjectElementCustom.cpp; sourceTree = "<group>"; };
                BC33FB1A0F30EE85002CDD7C /* RenderLineBoxList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLineBoxList.cpp; sourceTree = "<group>"; };
                BC348BA70DB7F1B8004ABAB9 /* XMLHttpRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLHttpRequest.idl; sourceTree = "<group>"; };
                BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestCustom.cpp; sourceTree = "<group>"; };
                BC491B4E0C023E2D009D6316 /* HTMLMarqueeElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMarqueeElement.idl; sourceTree = "<group>"; };
                BC491B760C023EFD009D6316 /* JSHTMLMarqueeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMarqueeElement.cpp; sourceTree = "<group>"; };
                BC491B770C023EFD009D6316 /* JSHTMLMarqueeElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLMarqueeElement.h; sourceTree = "<group>"; };
-               BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAppletElementCustom.cpp; sourceTree = "<group>"; };
                BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollAnimatorMac.mm; sourceTree = "<group>"; };
                BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDocumentCustom.cpp; sourceTree = "<group>"; };
                BC53C5F40DA56B920021EB5D /* Gradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gradient.h; sourceTree = "<group>"; };
                BC64B4D40CB4298A005F2B62 /* CSSFontSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSFontSelector.h; sourceTree = "<group>"; };
                BC6932710D7E293900AE44D1 /* JSDOMWindowBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowBase.cpp; sourceTree = "<group>"; };
                BC6932720D7E293900AE44D1 /* JSDOMWindowBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowBase.h; sourceTree = "<group>"; };
-               BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElementCustom.cpp; sourceTree = "<group>"; };
                BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElement.cpp; sourceTree = "<group>"; };
                BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLEmbedElement.h; sourceTree = "<group>"; };
                BC6D6E2509AF943500F59759 /* ScrollView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ScrollView.h; sourceTree = "<group>"; };
                                BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
                                652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
                                BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
-                               BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,
                                9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */,
                                BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */,
-                               BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */,
-                               BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */,
                                D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
                                7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
                                BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
                                BC97E412109154FA0010D361 /* JSHTMLAllCollection.cpp in Sources */,
                                1A4A2DEF0A1B852A00C807F8 /* JSHTMLAnchorElement.cpp in Sources */,
                                1A4A2DF10A1B852A00C807F8 /* JSHTMLAppletElement.cpp in Sources */,
-                               BC4EDEF40C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp in Sources */,
                                1AE2AA1E0A1CDAB400B42B25 /* JSHTMLAreaElement.cpp in Sources */,
                                7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */,
                                E44614370CD689C400FADA75 /* JSHTMLAudioElement.cpp in Sources */,
                                BC5823F50C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp in Sources */,
                                938E65F709F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp in Sources */,
                                BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */,
-                               BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */,
                                1AE2AA260A1CDAB400B42B25 /* JSHTMLFieldSetElement.cpp in Sources */,
                                1AE2AA280A1CDAB400B42B25 /* JSHTMLFontElement.cpp in Sources */,
                                9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */,
                                A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */,
                                1AE2AB290A1CE63B00B42B25 /* JSHTMLModElement.cpp in Sources */,
                                BC305C790C076BB300CD20F0 /* JSHTMLObjectElement.cpp in Sources */,
-                               BC305CA40C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp in Sources */,
                                1A85B1EA0A1B240500D8C87C /* JSHTMLOListElement.cpp in Sources */,
                                A80E7E9C0A1A83E3007FB8C5 /* JSHTMLOptGroupElement.cpp in Sources */,
                                A80E7E9A0A1A83E3007FB8C5 /* JSHTMLOptionElement.cpp in Sources */,
index 452db5a..5192e96 100644 (file)
 #include "JSEventListener.cpp"
 #include "JSEventTargetCustom.cpp"
 #include "JSExceptionBase.cpp"
-#include "JSHTMLAppletElementCustom.cpp"
 #include "JSHTMLCanvasElementCustom.cpp"
 #include "JSHTMLCollectionCustom.cpp"
 #include "JSHTMLDocumentCustom.cpp"
 #include "JSHTMLElementCustom.cpp"
-#include "JSHTMLEmbedElementCustom.cpp"
-#include "JSHTMLObjectElementCustom.cpp"
 #include "JSHTMLTemplateElementCustom.cpp"
 #include "JSHistoryCustom.cpp"
 #include "JSImageDataCustom.cpp"
index bfa3f47..254896d 100644 (file)
@@ -313,6 +313,7 @@ static inline JSValue stylePropertyGetter(ExecState& state, JSCSSStyleDeclaratio
     return stylePropertyGetter(state, thisObject, propertyInfo.propertyID);
 }
 
+// FIXME: This should be converted to be a named getter.
 bool JSCSSStyleDeclaration::getOwnPropertySlotDelegate(ExecState* state, PropertyName propertyName, PropertySlot& slot)
 {
     auto propertyInfo = parseJavaScriptCSSPropertyName(propertyName);
@@ -322,14 +323,15 @@ bool JSCSSStyleDeclaration::getOwnPropertySlotDelegate(ExecState* state, Propert
     return true;
 }
 
-bool JSCSSStyleDeclaration::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult)
+// FIXME: This should be converted to be a named setter.
+static bool putCommon(JSCSSStyleDeclaration& thisObject, ExecState& state, PropertyName propertyName, JSValue value, bool& putResult)
 {
     CustomElementReactionStack customElementReactionStack;
     auto propertyInfo = parseJavaScriptCSSPropertyName(propertyName);
     if (!propertyInfo.propertyID)
         return false;
 
-    auto propertyValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(*state, value);
+    auto propertyValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value);
     if (propertyInfo.hadPixelOrPosPrefix)
         propertyValue.append("px");
 
@@ -342,17 +344,41 @@ bool JSCSSStyleDeclaration::putDelegate(ExecState* state, PropertyName propertyN
         }
     }
 
-    auto setPropertyInternalResult = wrapped().setPropertyInternal(propertyInfo.propertyID, propertyValue, important);
+    auto setPropertyInternalResult = thisObject.wrapped().setPropertyInternal(propertyInfo.propertyID, propertyValue, important);
     if (setPropertyInternalResult.hasException()) {
-        auto& vm = state->vm();
+        auto& vm = state.vm();
         auto scope = DECLARE_THROW_SCOPE(vm);
-        propagateException(*state, scope, setPropertyInternalResult.releaseException());
+        propagateException(state, scope, setPropertyInternalResult.releaseException());
         return true;
     }
     putResult = setPropertyInternalResult.releaseReturnValue();
     return true;
 }
 
+bool JSCSSStyleDeclaration::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
+{
+    auto* thisObject = jsCast<JSCSSStyleDeclaration*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    bool putResult = false;
+    if (putCommon(*thisObject, *state, propertyName, value, putResult))
+        return putResult;
+
+    return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);
+}
+
+bool JSCSSStyleDeclaration::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
+{
+    auto* thisObject = jsCast<JSCSSStyleDeclaration*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    bool putResult = false;
+    if (putCommon(*thisObject, *state, Identifier::from(state, index), value, putResult))
+        return putResult;
+
+    return JSObject::putByIndex(cell, state, index, value, shouldThrow);
+}
+
 JSValue JSCSSStyleDeclaration::getPropertyCSSValue(ExecState& state)
 {
     VM& vm = state.vm();
diff --git a/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLAppletElementCustom.cpp
deleted file mode 100644 (file)
index 229e683..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "JSHTMLAppletElement.h"
-
-#include "HTMLAppletElement.h"
-#include "JSPluginElementFunctions.h"
-
-namespace WebCore {
-
-using namespace JSC;
-
-bool JSHTMLAppletElement::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
-    return pluginElementCustomGetOwnPropertySlot<JSHTMLAppletElement, Base>(exec, propertyName, slot, this);
-}
-
-bool JSHTMLAppletElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot, bool& putResult)
-{
-    return pluginElementCustomPut(exec, propertyName, value, this, slot, putResult);
-}
-
-CallType JSHTMLAppletElement::getCallData(JSCell* cell, CallData& callData)
-{
-    return pluginElementGetCallData(jsCast<JSHTMLAppletElement*>(cell), callData);
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp
deleted file mode 100644 (file)
index 919f686..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "JSHTMLEmbedElement.h"
-
-#include "HTMLEmbedElement.h"
-#include "JSPluginElementFunctions.h"
-
-namespace WebCore {
-
-using namespace JSC;
-
-bool JSHTMLEmbedElement::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
-    return pluginElementCustomGetOwnPropertySlot<JSHTMLEmbedElement, Base>(exec, propertyName, slot, this);
-}
-
-bool JSHTMLEmbedElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot, bool& putResult)
-{
-    return pluginElementCustomPut(exec, propertyName, value, this, slot, putResult);
-}
-
-CallType JSHTMLEmbedElement::getCallData(JSCell* cell, CallData& callData)
-{
-    return pluginElementGetCallData(jsCast<JSHTMLEmbedElement*>(cell), callData);
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLObjectElementCustom.cpp
deleted file mode 100644 (file)
index 4a8647f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "JSHTMLObjectElement.h"
-
-#include "HTMLObjectElement.h"
-#include "JSPluginElementFunctions.h"
-
-namespace WebCore {
-
-using namespace JSC;
-
-bool JSHTMLObjectElement::getOwnPropertySlotDelegate(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
-    return pluginElementCustomGetOwnPropertySlot<JSHTMLObjectElement, Base>(exec, propertyName, slot, this);
-}
-
-bool JSHTMLObjectElement::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot, bool& putResult)
-{
-    return pluginElementCustomPut(exec, propertyName, value, this, slot, putResult);
-}
-
-CallType JSHTMLObjectElement::getCallData(JSCell* cell, CallData& callData)
-{
-    return pluginElementGetCallData(jsCast<JSHTMLObjectElement*>(cell), callData);
-}
-
-} // namespace WebCore
index 4e6c144..0b469ef 100644 (file)
@@ -34,12 +34,12 @@ using namespace JSC;
 
 namespace WebCore {
 
-bool JSLocation::getOwnPropertySlotDelegate(ExecState* state, PropertyName propertyName, PropertySlot& slot)
+static bool getOwnPropertySlotCommon(JSLocation& thisObject, ExecState& state, PropertyName propertyName, PropertySlot& slot)
 {
-    VM& vm = state->vm();
+    VM& vm = state.vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
-    Frame* frame = wrapped().frame();
+    Frame* frame = thisObject.wrapped().frame();
     if (!frame) {
         slot.setUndefined();
         return true;
@@ -51,60 +51,100 @@ bool JSLocation::getOwnPropertySlotDelegate(ExecState* state, PropertyName prope
     // Our custom code is only needed to implement the Window cross-domain scheme, so if access is
     // allowed, return false so the normal lookup will take place.
     String message;
-    if (BindingSecurity::shouldAllowAccessToFrame(*state, *frame, message))
+    if (BindingSecurity::shouldAllowAccessToFrame(state, *frame, message))
         return false;
 
     // https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-)
-    if (propertyName == state->propertyNames().toStringTagSymbol || propertyName == state->propertyNames().hasInstanceSymbol || propertyName == state->propertyNames().isConcatSpreadableSymbol) {
-        slot.setValue(this, ReadOnly | DontEnum, jsUndefined());
+    if (propertyName == state.propertyNames().toStringTagSymbol || propertyName == state.propertyNames().hasInstanceSymbol || propertyName == state.propertyNames().isConcatSpreadableSymbol) {
+        slot.setValue(&thisObject, ReadOnly | DontEnum, jsUndefined());
         return true;
     }
 
     // We only allow access to Location.replace() cross origin.
-    if (propertyName == state->propertyNames().replace) {
-        slot.setCustom(this, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>);
+    if (propertyName == state.propertyNames().replace) {
+        slot.setCustom(&thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>);
         return true;
     }
 
     // Getting location.href cross origin needs to throw. However, getOwnPropertyDescriptor() needs to return
     // a descriptor that has a setter but no getter.
-    if (slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty && propertyName == state->propertyNames().href) {
+    if (slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty && propertyName == state.propertyNames().href) {
         auto* entry = JSLocation::info()->staticPropHashTable->entry(propertyName);
         CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, nullptr, entry->propertyPutter());
-        slot.setCustomGetterSetter(this, DontEnum | CustomAccessor, customGetterSetter);
+        slot.setCustomGetterSetter(&thisObject, DontEnum | CustomAccessor, customGetterSetter);
         return true;
     }
 
-    throwSecurityError(*state, scope, message);
+    throwSecurityError(state, scope, message);
     slot.setUndefined();
     return true;
 }
 
-bool JSLocation::putDelegate(ExecState* state, PropertyName propertyName, JSValue, PutPropertySlot&, bool& putResult)
+bool JSLocation::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
 {
-    putResult = false;
+    auto* thisObject = jsCast<JSLocation*>(object);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
 
-    Frame* frame = wrapped().frame();
+    if (getOwnPropertySlotCommon(*thisObject, *state, propertyName, slot))
+        return true;
+    return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
+}
+
+bool JSLocation::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
+{
+    auto* thisObject = jsCast<JSLocation*>(object);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    if (getOwnPropertySlotCommon(*thisObject, *state, Identifier::from(state, index), slot))
+        return true;
+    return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
+}
+
+static bool putCommon(JSLocation& thisObject, ExecState& state, PropertyName propertyName)
+{
+    Frame* frame = thisObject.wrapped().frame();
     if (!frame)
         return true;
 
     // Silently block access to toString and valueOf.
-    if (propertyName == state->propertyNames().toString || propertyName == state->propertyNames().valueOf)
+    if (propertyName == state.propertyNames().toString || propertyName == state.propertyNames().valueOf)
         return true;
 
     // Always allow assigning to the whole location.
     // However, alllowing assigning of pieces might inadvertently disclose parts of the original location.
     // So fall through to the access check for those.
-    if (propertyName == state->propertyNames().href)
+    if (propertyName == state.propertyNames().href)
         return false;
 
     // Block access and throw if there is a security error.
-    if (!BindingSecurity::shouldAllowAccessToFrame(state, frame, ThrowSecurityError))
+    if (!BindingSecurity::shouldAllowAccessToFrame(&state, frame, ThrowSecurityError))
         return true;
 
     return false;
 }
 
+bool JSLocation::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
+{
+    auto* thisObject = jsCast<JSLocation*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    if (putCommon(*thisObject, *state, propertyName))
+        return false;
+
+    return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);
+}
+
+bool JSLocation::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
+{
+    auto* thisObject = jsCast<JSLocation*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    if (putCommon(*thisObject, *state, Identifier::from(state, index)))
+        return false;
+
+    return JSObject::putByIndex(cell, state, index, value, shouldThrow);
+}
+
 bool JSLocation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
 {
     JSLocation* thisObject = jsCast<JSLocation*>(cell);
@@ -188,10 +228,12 @@ String JSLocation::toStringName(const JSObject* object, ExecState* exec)
     return ASCIILiteral("Location");
 }
 
-bool JSLocationPrototype::putDelegate(ExecState* exec, PropertyName propertyName, JSValue, PutPropertySlot&, bool& putResult)
+bool JSLocationPrototype::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
 {
-    putResult = false;
-    return (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf);
+    auto* thisObject = jsCast<JSLocationPrototype*>(cell);
+    if (propertyName == state->propertyNames().toString || propertyName == state->propertyNames().valueOf)
+        return false;
+    return Base::put(thisObject, state, propertyName, value, slot);
 }
 
 bool JSLocationPrototype::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool throwException)
index 88b5b12..d0930c2 100644 (file)
@@ -94,7 +94,7 @@ JSObject* pluginScriptObject(ExecState* exec, JSHTMLElement* jsHTMLElement)
     return instance->createRuntimeObject(exec);
 }
     
-EncodedJSValue pluginElementPropertyGetter(ExecState* exec, EncodedJSValue thisValue, PropertyName propertyName)
+static EncodedJSValue pluginElementPropertyGetter(ExecState* exec, EncodedJSValue thisValue, PropertyName propertyName)
 {
     VM& vm = exec->vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
@@ -109,19 +109,26 @@ EncodedJSValue pluginElementPropertyGetter(ExecState* exec, EncodedJSValue thisV
     return JSValue::encode(scriptObject->get(exec, propertyName));
 }
 
-bool pluginElementCustomGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot, JSHTMLElement* element)
+bool pluginElementCustomGetOwnPropertySlot(JSHTMLElement* element, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
+    if (!element->globalObject()->world().isNormal()) {
+        JSC::JSValue proto = element->getPrototypeDirect();
+        if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName))
+            return false;
+    }
+
     JSObject* scriptObject = pluginScriptObject(exec, element);
     if (!scriptObject)
         return false;
 
     if (!scriptObject->hasProperty(exec, propertyName))
         return false;
+
     slot.setCustom(element, DontDelete | DontEnum, pluginElementPropertyGetter);
     return true;
 }
 
-bool pluginElementCustomPut(ExecState* exec, PropertyName propertyName, JSValue value, JSHTMLElement* element, PutPropertySlot& slot, bool& putResult)
+bool pluginElementCustomPut(JSHTMLElement* element, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot, bool& putResult)
 {
     JSObject* scriptObject = pluginScriptObject(exec, element);
     if (!scriptObject)
@@ -154,7 +161,7 @@ static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec)
     return JSValue::encode(result);
 }
 
-CallType pluginElementGetCallData(JSHTMLElement* element, CallData& callData)
+CallType pluginElementCustomGetCallData(JSHTMLElement* element, CallData& callData)
 {
     // First, ask the plug-in view base for its runtime object.
     if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) {
index f4f5f4c..127f16a 100644 (file)
@@ -37,20 +37,8 @@ namespace WebCore {
     JSC::Bindings::Instance* pluginInstance(HTMLElement&);
     WEBCORE_EXPORT JSC::JSObject* pluginScriptObject(JSC::ExecState*, JSHTMLElement*);
 
-    JSC::EncodedJSValue pluginElementPropertyGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-    bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&, JSHTMLElement*);
-    bool pluginElementCustomPut(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSHTMLElement*, JSC::PutPropertySlot&, bool& putResult);
-    JSC::CallType pluginElementGetCallData(JSHTMLElement*, JSC::CallData&);
-
-    template <class Type, class Base> bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertySlot& slot, Type* element)
-    {
-        if (!element->globalObject()->world().isNormal()) {
-            JSC::JSValue proto = element->getPrototypeDirect();
-            if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName))
-                return false;
-        }
-
-        return pluginElementCustomGetOwnPropertySlot(exec, propertyName, slot, element);
-    }
+    bool pluginElementCustomGetOwnPropertySlot(JSHTMLElement*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
+    bool pluginElementCustomPut(JSHTMLElement*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);
+    JSC::CallType pluginElementCustomGetCallData(JSHTMLElement*, JSC::CallData&);
 
 } // namespace WebCore
index 59c750f..9503b84 100644 (file)
@@ -535,7 +535,7 @@ sub GenerateIndexedGetter
     # 1.2.8 Return desc.
     
     my @attributes = ();
-    push(@attributes, "ReadOnly") if !GetIndexedSetterOperation($interface) && !$interface->extendedAttributes->{CustomNamedSetter};
+    push(@attributes, "ReadOnly") if !GetIndexedSetterOperation($interface) && !$interface->extendedAttributes->{Plugin};
     
     my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0");
 
@@ -572,7 +572,7 @@ sub GenerateNamedGetter
     # 2.10 Return desc.
     
     my @attributes = ();
-    push(@attributes, "ReadOnly") if !GetNamedSetterOperation($interface) && !$interface->extendedAttributes->{CustomNamedSetter};
+    push(@attributes, "ReadOnly") if !GetNamedSetterOperation($interface) && !$interface->extendedAttributes->{Plugin};
     push(@attributes, "DontEnum") if $interface->extendedAttributes->{LegacyUnenumerableNamedProperties};
     
     my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0");
@@ -667,7 +667,7 @@ sub GenerateGetOwnPropertySlot
         # 1.3. Set ignoreNamedProps to true.
         # NOTE: Setting ignoreNamedProps has the effect of skipping step 2, so we can early return here
         #       rather than going through the paces of having an actual ignoreNamedProps update.
-        if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
+        if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} || $interface->extendedAttributes->{Plugin}) {
             push(@$outputArray, "        return JSObject::getOwnPropertySlot(object, state, propertyName, slot);\n");
         }
         push(@$outputArray, "    }\n");
@@ -701,12 +701,19 @@ sub GenerateGetOwnPropertySlot
         push(@$outputArray, "        return true;\n");
         push(@$outputArray, "    }\n");
     }
-    
+
+    # FIXME: There is only one remaining user of this, CSSStyleDeclaration.idl. Let's get them onto named / indexed getters.
     if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
         push(@$outputArray, "    if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n");
         push(@$outputArray, "        return true;\n");
     }
-    
+
+    if ($interface->extendedAttributes->{Plugin}) {
+        AddToImplIncludes("JSPluginElementFunctions.h");
+        push(@$outputArray, "    if (pluginElementCustomGetOwnPropertySlot(thisObject, state, propertyName, slot))\n");
+        push(@$outputArray, "        return true;\n");
+    }
+
     # 3. Return OrdinaryGetOwnProperty(O, P).
     push(@$outputArray, "    return JSObject::getOwnPropertySlot(object, state, propertyName, slot);\n");
     
@@ -718,7 +725,7 @@ sub GenerateGetOwnPropertySlotByIndex
 {
     my ($outputArray, $interface, $className) = @_;
     
-    return if $interface->extendedAttributes->{CustomGetOwnPropertySlotByIndex};
+    return if $interface->extendedAttributes->{CustomGetOwnPropertySlot};
 
     # Sink the int-to-string conversion that happens when we create a PropertyName
     # to the point where we actually need it.
@@ -772,7 +779,7 @@ sub GenerateGetOwnPropertySlotByIndex
         # 1.3. Set ignoreNamedProps to true.
         # NOTE: Setting ignoreNamedProps has the effect of skipping step 2, so we can early return here
         #       rather than going through the paces of having an actual ignoreNamedProps update.
-        if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
+        if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} || $interface->extendedAttributes->{Plugin}) {
             push(@$outputArray, "        return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);\n");
         }
         push(@$outputArray, "    }\n");
@@ -809,13 +816,22 @@ sub GenerateGetOwnPropertySlotByIndex
         push(@$outputArray, "    }\n");
     }
     
+    # FIXME: There is only one remaining user of this, CSSStyleDeclaration.idl. Let's get them onto named / indexed getters.
     if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
         &$propertyNameGeneration();
     
         push(@$outputArray, "    if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n");
         push(@$outputArray, "        return true;\n");
     }
-    
+
+    if ($interface->extendedAttributes->{Plugin}) {
+        &$propertyNameGeneration();
+
+        AddToImplIncludes("JSPluginElementFunctions.h");
+        push(@$outputArray, "    if (pluginElementCustomGetOwnPropertySlot(thisObject, state, propertyName, slot))\n");
+        push(@$outputArray, "        return true;\n");
+    }
+
     # 3. Return OrdinaryGetOwnProperty(O, P).
     push(@$outputArray, "    return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);\n");
     
@@ -827,7 +843,7 @@ sub GenerateGetOwnPropertyNames
 {
     my ($outputArray, $interface, $className) = @_;
     
-    return if $interface->extendedAttributes->{CustomEnumerateProperty};
+    return if $interface->extendedAttributes->{CustomGetOwnPropertyNames};
     
     my $namedGetterOperation = GetNamedGetterOperation($interface);
     my $indexedGetterOperation = GetIndexedGetterOperation($interface);
@@ -913,7 +929,7 @@ sub GeneratePut
 {
     my ($outputArray, $interface, $className) = @_;
     
-    return if $interface->extendedAttributes->{CustomPutFunction};
+    return if $interface->extendedAttributes->{CustomPut};
     
     my $namedSetterOperation = GetNamedSetterOperation($interface);
     my $indexedSetterOperation = GetIndexedSetterOperation($interface);
@@ -961,13 +977,15 @@ sub GeneratePut
         push(@$outputArray, "    }\n\n");
     }
     
-    assert("Using both a named property setter and [CustomNamedSetter] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{CustomNamedSetter};
-    if ($interface->extendedAttributes->{CustomNamedSetter}) {
+    assert("Using both a named property setter and [Plugin] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{Plugin};
+    if ($interface->extendedAttributes->{Plugin}) {
+        AddToImplIncludes("JSPluginElementFunctions.h");
+
         push(@$outputArray, "    bool putResult = false;\n");
-        push(@$outputArray, "    if (thisObject->putDelegate(state, propertyName, value, putPropertySlot, putResult))\n");
+        push(@$outputArray, "    if (pluginElementCustomPut(thisObject, state, propertyName, value, putPropertySlot, putResult))\n");
         push(@$outputArray, "        return putResult;\n\n");
     }
-    
+
     push(@$outputArray, "    return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);\n");
     push(@$outputArray, "}\n\n");
 }
@@ -976,13 +994,13 @@ sub GeneratePutByIndex
 {
     my ($outputArray, $interface, $className) = @_;
     
-    return if $interface->extendedAttributes->{CustomPutFunction};
-    
+    return if $interface->extendedAttributes->{CustomPut};
+
     my $namedSetterOperation = GetNamedSetterOperation($interface);
     my $indexedSetterOperation = GetIndexedSetterOperation($interface);
     
     my $overrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins");
-    my $ellidesCallsToBase = ($namedSetterOperation && $overrideBuiltins) && !$interface->extendedAttributes->{CustomNamedSetter};
+    my $ellidesCallsToBase = ($namedSetterOperation && $overrideBuiltins) && !$interface->extendedAttributes->{Plugin};
     
     push(@$outputArray, "bool ${className}::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool" . (!$ellidesCallsToBase ? " shouldThrow" : "") . ")\n");
     push(@$outputArray, "{\n");
@@ -1021,16 +1039,17 @@ sub GeneratePutByIndex
             push(@$outputArray, "    }\n\n");
         }
     }
-    
-    assert("Using both a named property setter and [CustomNamedSetter] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{CustomNamedSetter};
-    if ($interface->extendedAttributes->{CustomNamedSetter}) {
+
+    assert("Using both a named property setter and [Plugin] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{Plugin};
+    if ($interface->extendedAttributes->{Plugin}) {
+        AddToImplIncludes("JSPluginElementFunctions.h");
         push(@$outputArray, "    auto propertyName = Identifier::from(state, index);\n");
-        push(@$outputArray, "    PutPropertySlot slot(thisObject, shouldThrow);\n");
+        push(@$outputArray, "    PutPropertySlot putPropertySlot(thisObject, shouldThrow);\n");
         push(@$outputArray, "    bool putResult = false;\n");
-        push(@$outputArray, "    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");
+        push(@$outputArray, "    if (pluginElementCustomPut(thisObject, state, propertyName, value, putPropertySlot, putResult))\n");
         push(@$outputArray, "        return putResult;\n\n");
     }
-    
+
     if (!$ellidesCallsToBase) {
         push(@$outputArray, "    return JSObject::putByIndex(cell, state, index, value, shouldThrow);\n");
     }
@@ -1252,7 +1271,7 @@ sub GenerateDeletePropertyCommon
     push(@$outputArray, "    }\n");
 }
 
-sub GenerateDeletePropertyDefinition
+sub GenerateDeleteProperty
 {
     my ($outputArray, $interface, $className, $operation, $conditional) = @_;
 
@@ -1283,7 +1302,7 @@ sub GenerateDeletePropertyDefinition
     push(@$outputArray, "}\n\n");
 }
 
-sub GenerateDeletePropertyByIndexDefinition
+sub GenerateDeletePropertyByIndex
 {
     my ($outputArray, $interface, $className, $operation, $conditional) = @_;
 
@@ -1347,8 +1366,8 @@ sub GenerateNamedDeleterDefinition
         push(@$outputArray, "#if ${conditionalString}\n\n");;
     }
 
-    GenerateDeletePropertyDefinition($outputArray, $interface, $className, $namedDeleterOperation, $conditional);
-    GenerateDeletePropertyByIndexDefinition($outputArray, $interface, $className, $namedDeleterOperation, $conditional);
+    GenerateDeleteProperty($outputArray, $interface, $className, $namedDeleterOperation, $conditional);
+    GenerateDeletePropertyByIndex($outputArray, $interface, $className, $namedDeleterOperation, $conditional);
 
     push(@implContent, "#endif\n\n") if $conditional;
 }
@@ -1808,8 +1827,8 @@ sub InstanceOverridesGetOwnPropertySlot
 {
     my $interface = shift;
     return $interface->extendedAttributes->{CustomGetOwnPropertySlot}
-        || $interface->extendedAttributes->{CustomGetOwnPropertySlotByIndex}
         || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}
+        || $interface->extendedAttributes->{Plugin}
         || GetIndexedGetterOperation($interface)
         || GetNamedGetterOperation($interface);
 }
@@ -1817,7 +1836,7 @@ sub InstanceOverridesGetOwnPropertySlot
 sub InstanceOverridesGetOwnPropertyNames
 {
     my $interface = shift;
-    return $interface->extendedAttributes->{CustomEnumerateProperty}
+    return $interface->extendedAttributes->{CustomGetOwnPropertyNames}
         || GetIndexedGetterOperation($interface)
         || GetNamedGetterOperation($interface);
 }
@@ -1825,8 +1844,8 @@ sub InstanceOverridesGetOwnPropertyNames
 sub InstanceOverridesPut
 {
     my $interface = shift;
-    return $interface->extendedAttributes->{CustomNamedSetter}
-        || $interface->extendedAttributes->{CustomPutFunction}
+    return $interface->extendedAttributes->{CustomPut}
+        || $interface->extendedAttributes->{Plugin}
         || GetIndexedSetterOperation($interface)
         || GetNamedSetterOperation($interface);
 }
@@ -1839,7 +1858,7 @@ sub InstanceOverridesDefineOwnProperty
         || GetNamedSetterOperation($interface);
 }
 
-sub InstanceOverridesDelete
+sub InstanceOverridesDeleteProperty
 {
     my $interface = shift;
     return $interface->extendedAttributes->{CustomDeleteProperty}
@@ -2572,12 +2591,12 @@ sub GenerateHeader
         push(@headerContent, "    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);\n");
     }
 
-    if (InstanceOverridesDelete($interface)) {
+    if (InstanceOverridesDeleteProperty($interface)) {
         push(@headerContent, "    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);\n");
         push(@headerContent, "    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);\n");
     }
 
-    if (InstanceOverridesCall($interface)) {
+    if (InstanceOverridesGetCallData($interface)) {
         push(@headerContent, "    static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);\n\n");
         $headerIncludes{"<runtime/CallData.h>"} = 1;
         $structureFlags{"JSC::TypeOfShouldCallGetCallData"} = 1;
@@ -2796,11 +2815,7 @@ sub GenerateHeader
     if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
         push(@headerContent, "    bool getOwnPropertySlotDelegate(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n");
     }
-    
-    if ($interface->extendedAttributes->{CustomNamedSetter}) {
-        push(@headerContent, "    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n");
-    }
-    
+
     push(@headerContent, "};\n\n");
 
     if (ShouldGenerateWrapperOwnerCode($hasParent, $interface)) {
@@ -4100,17 +4115,6 @@ sub GenerateImplementation
         push(@implContent, "}\n\n");
     }
 
-    if ($interface->extendedAttributes->{CustomNamedGetterOnPrototype}) {
-        push(@implContent, "bool ${className}Prototype::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");
-        push(@implContent, "{\n");
-        push(@implContent, "    auto* thisObject = jsCast<${className}Prototype*>(cell);\n");
-        push(@implContent, "    bool putResult = false;\n");
-        push(@implContent, "    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");
-        push(@implContent, "        return putResult;\n");
-        push(@implContent, "    return Base::put(thisObject, state, propertyName, value, slot);\n");
-        push(@implContent, "}\n\n");
-    }
-
     # - Initialize static ClassInfo object
     push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleInterfaceName}\", &Base::s_info, ");
 
@@ -4297,12 +4301,12 @@ sub GenerateImplementation
         GenerateDefineOwnProperty(\@implContent, $interface, $className);
     }
 
-    if (InstanceOverridesDelete($interface)) {
+    if (InstanceOverridesDeleteProperty($interface)) {
         GenerateNamedDeleterDefinition(\@implContent, $interface, $className);
     }
     
-    if (InstanceOverridesCall($interface)) {
-        GenerateLegacyCallerDefinitions($interface, $className);
+    if (InstanceOverridesGetCallData($interface)) {
+        GenerateGetCallData(\@implContent, $interface, $className);
     }
     
     if ($numAttributes > 0) {
@@ -5250,70 +5254,97 @@ sub GenerateSerializerDefinition
     push(@implContent, "\n");
 }
 
+sub GenerateGetCallData
+{
+    my ($outputArray, $interface, $className) = @_;
+
+    return if $interface->extendedAttributes->{CustomGetCallData};
+
+    if ($interface->extendedAttributes->{Plugin}) {
+        GeneratePluginCall($outputArray, $interface, $className);
+    } else {
+        GenerateLegacyCallerDefinitions($outputArray, $interface, $className);
+    }
+}
+
+sub GeneratePluginCall
+{
+    my ($outputArray, $interface, $className) = @_;
+
+    AddToImplIncludes("JSPluginElementFunctions.h");
+
+    push(@$outputArray, "CallType ${className}::getCallData(JSCell* cell, CallData& callData)\n");
+    push(@$outputArray, "{\n");
+    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(cell);\n");
+    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n");
+
+    push(@$outputArray, "    return pluginElementCustomGetCallData(thisObject, callData);\n");
+    push(@$outputArray, "}\n");
+    push(@$outputArray, "\n");
+}
+
 sub GenerateLegacyCallerDefinitions
 {
-    my ($interface, $className) = @_;
+    my ($outputArray, $interface, $className) = @_;
 
-    return if $interface->extendedAttributes->{CustomCall};
-    
     my @legacyCallers = @{$interface->{LegacyCallers}};
     if (@legacyCallers > 1) {
         foreach my $legacyCaller (@legacyCallers) {
-            GenerateLegacyCallerDefinition($interface, $className, $legacyCaller);
+            GenerateLegacyCallerDefinition($outputArray, $interface, $className, $legacyCaller);
         }
 
         my $overloadFunctionPrefix = "call${className}";
 
-        push(@implContent, "EncodedJSValue JSC_HOST_CALL ${overloadFunctionPrefix}(ExecState* state)\n");
-        push(@implContent, "{\n");
-        push(@implContent, "    VM& vm = state->vm();\n");
-        push(@implContent, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
-        push(@implContent, "    UNUSED_PARAM(throwScope);\n");
+        push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${overloadFunctionPrefix}(ExecState* state)\n");
+        push(@$outputArray, "{\n");
+        push(@$outputArray, "    VM& vm = state->vm();\n");
+        push(@$outputArray, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
+        push(@$outputArray, "    UNUSED_PARAM(throwScope);\n");
 
         GenerateOverloadDispatcher($legacyCallers[0], $interface, $overloadFunctionPrefix, "", "state");
 
-        push(@implContent, "}\n\n");
+        push(@$outputArray, "}\n\n");
     } else {
-        GenerateLegacyCallerDefinition($interface, $className, $legacyCallers[0]);
+        GenerateLegacyCallerDefinition($outputArray, $interface, $className, $legacyCallers[0]);
     }
 
-    push(@implContent, "CallType ${className}::getCallData(JSCell*, CallData& callData)\n");
-    push(@implContent, "{\n");
-    push(@implContent, "    callData.native.function = call${className};\n");
-    push(@implContent, "    return CallType::Host;\n");
-    push(@implContent, "}\n");
-    push(@implContent, "\n");
+    push(@$outputArray, "CallType ${className}::getCallData(JSCell*, CallData& callData)\n");
+    push(@$outputArray, "{\n");
+    push(@$outputArray, "    callData.native.function = call${className};\n");
+    push(@$outputArray, "    return CallType::Host;\n");
+    push(@$outputArray, "}\n");
+    push(@$outputArray, "\n");
 }
 
 sub GenerateLegacyCallerDefinition
 {
-    my ($interface, $className, $operation) = @_;
+    my ($outputArray, $interface, $className, $operation) = @_;
 
     my $isOverloaded = $operation->{overloads} && @{$operation->{overloads}} > 1;
     if ($isOverloaded) {
-        push(@implContent, "static inline EncodedJSValue call${className}$operation->{overloadIndex}(ExecState* state)\n");
+        push(@$outputArray, "static inline EncodedJSValue call${className}$operation->{overloadIndex}(ExecState* state)\n");
     } else {
-        push(@implContent, "static EncodedJSValue JSC_HOST_CALL call${className}(ExecState* state)\n");
+        push(@$outputArray, "static EncodedJSValue JSC_HOST_CALL call${className}(ExecState* state)\n");
     }
 
-    push(@implContent, "{\n");
-    push(@implContent, "    VM& vm = state->vm();\n");
-    push(@implContent, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
-    push(@implContent, "    UNUSED_PARAM(throwScope);\n");
+    push(@$outputArray, "{\n");
+    push(@$outputArray, "    VM& vm = state->vm();\n");
+    push(@$outputArray, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
+    push(@$outputArray, "    UNUSED_PARAM(throwScope);\n");
 
     my $indent = "    ";
-    GenerateArgumentsCountCheck(\@implContent, $operation, $interface, $indent);
+    GenerateArgumentsCountCheck($outputArray, $operation, $interface, $indent);
 
-    push(@implContent, "    auto* castedThis = jsCast<${className}*>(state->jsCallee());\n");
-    push(@implContent, "    ASSERT(castedThis);\n");
-    push(@implContent, "    auto& impl = castedThis->wrapped();\n");
+    push(@$outputArray, "    auto* castedThis = jsCast<${className}*>(state->jsCallee());\n");
+    push(@$outputArray, "    ASSERT(castedThis);\n");
+    push(@$outputArray, "    auto& impl = castedThis->wrapped();\n");
 
     my $functionImplementationName = $operation->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($operation->name) || "legacyCallerOperationFromBindings";
-    my $functionString = GenerateParametersCheck(\@implContent, $operation, $interface, $functionImplementationName, $indent);
+    my $functionString = GenerateParametersCheck($outputArray, $operation, $interface, $functionImplementationName, $indent);
 
-    GenerateImplementationFunctionCall(\@implContent, $operation, $interface, $functionString, $indent);
+    GenerateImplementationFunctionCall($outputArray, $operation, $interface, $functionString, $indent);
 
-    push(@implContent, "}\n\n");
+    push(@$outputArray, "}\n\n");
 }
 
 sub GenerateCallWithUsingReferences
@@ -6818,13 +6849,12 @@ sub GeneratePrototypeDeclaration
         }
     }
 
-    if ($interface->extendedAttributes->{CustomNamedGetterOnPrototype}) {
+    # FIXME: Should this override putByIndex as well?
+    if ($interface->extendedAttributes->{CustomPutOnPrototype}) {
         push(@$outputArray, "\n");
         push(@$outputArray, "    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);\n");
-        push(@$outputArray, "    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n");
     }
 
-    # Custom defineOwnProperty function
     if ($interface->extendedAttributes->{CustomDefineOwnPropertyOnPrototype}) {
         push(@$outputArray, "\n");
         push(@$outputArray, "    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);\n");
@@ -7086,17 +7116,17 @@ sub IsConstructable
         || $interface->extendedAttributes->{JSBuiltinConstructor};
 }
 
-sub InstanceOverridesCall
+sub InstanceOverridesGetCallData
 {
     my $interface = shift;
-    return $interface->extendedAttributes->{CustomCall} || $interface->{LegacyCallers}
+    return $interface->{LegacyCallers} || $interface->extendedAttributes->{CustomGetCallData} || $interface->extendedAttributes->{Plugin};
 }
 
 sub HeaderNeedsPrototypeDeclaration
 {
     my $interface = shift;
     return IsDOMGlobalObject($interface)
-        || $interface->extendedAttributes->{CustomNamedGetterOnPrototype}
+        || $interface->extendedAttributes->{CustomPutOnPrototype}
         || $interface->extendedAttributes->{CustomDefineOwnPropertyOnPrototype};
 }
 
index d38f4d0..456452f 100644 (file)
@@ -78,9 +78,6 @@
         "Custom": {
             "contextsAllowed": ["attribute", "operation"]
         },
-        "CustomCall": {
-            "contextsAllowed": ["interface"]
-        },
         "CustomConstructor": {
             "contextsAllowed": ["interface"]
         },
         "CustomDeleteProperty": {
             "contextsAllowed": ["interface"]
         },
-        "CustomEnumerateProperty": {
+        "CustomGetCallData": {
             "contextsAllowed": ["interface"]
         },
-        "CustomGetOwnPropertySlot": {
+        "CustomGetOwnPropertyNames": {
             "contextsAllowed": ["interface"]
         },
-        "CustomGetOwnPropertySlotByIndex": {
+        "CustomGetOwnPropertySlot": {
             "contextsAllowed": ["interface"]
         },
         "CustomGetOwnPropertySlotAndDescriptor": {
         "CustomIsReachable": {
             "contextsAllowed": ["interface"]
         },
-        "CustomNamedGetterOnPrototype": {
-            "contextsAllowed": ["interface"]
-        },
-        "CustomNamedSetter": {
-            "contextsAllowed": ["interface"]
-        },
         "CustomPreventExtensions": {
             "contextsAllowed": ["interface"]
         },
         "CustomPushEventHandlerScope": {
             "contextsAllowed": ["interface"]
         },
-        "CustomPutFunction": {
+        "CustomPut": {
+            "contextsAllowed": ["interface"]
+        },
+        "CustomPutOnPrototype": {
             "contextsAllowed": ["interface"]
         },
         "CustomSetter": {
             "contextsAllowed": ["operation"],
             "notes" : "Only used by WebKitTestRunner and DumpRenderTree"
         },
+        "Plugin": {
+            "contextsAllowed": ["interface"],
+            "notes" : "Should only be used by elements that forward to Netscape plug-ins"
+        },
         "PrimaryGlobal": {
             "contextsAllowed": ["interface"],
             "values": ["*"],
index 9f991cc..8ccc23b 100644 (file)
@@ -413,32 +413,6 @@ void JSTestInterface::destroy(JSC::JSCell* cell)
     thisObject->JSTestInterface::~JSTestInterface();
 }
 
-bool JSTestInterface::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
-{
-    auto* thisObject = jsCast<JSTestInterface*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-
-    bool putResult = false;
-    if (thisObject->putDelegate(state, propertyName, value, putPropertySlot, putResult))
-        return putResult;
-
-    return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);
-}
-
-bool JSTestInterface::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
-{
-    auto* thisObject = jsCast<JSTestInterface*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-
-    auto propertyName = Identifier::from(state, index);
-    PutPropertySlot slot(thisObject, shouldThrow);
-    bool putResult = false;
-    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))
-        return putResult;
-
-    return JSObject::putByIndex(cell, state, index, value, shouldThrow);
-}
-
 template<> inline JSTestInterface* IDLAttribute<JSTestInterface>::cast(ExecState& state, EncodedJSValue thisValue)
 {
     return jsDynamicDowncast<JSTestInterface*>(state.vm(), JSValue::decode(thisValue));
index 7153907..be94dc5 100644 (file)
@@ -79,7 +79,6 @@ protected:
     JSTestInterface(JSC::Structure*, JSDOMGlobalObject&, Ref<TestInterface>&&);
 
     void finishCreation(JSC::VM&);
-    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);
 };
 
 class JSTestInterfaceOwner : public JSC::WeakHandleOwner {
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.cpp
new file mode 100644 (file)
index 0000000..ca69cf5
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestPluginInterface.h"
+
+#include "JSDOMBinding.h"
+#include "JSDOMConstructorNotConstructable.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMWrapperCache.h"
+#include "JSPluginElementFunctions.h"
+#include <runtime/FunctionPrototype.h>
+#include <runtime/JSCInlines.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Attributes
+
+JSC::EncodedJSValue jsTestPluginInterfaceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestPluginInterfaceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
+class JSTestPluginInterfacePrototype : public JSC::JSNonFinalObject {
+public:
+    using Base = JSC::JSNonFinalObject;
+    static JSTestPluginInterfacePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSTestPluginInterfacePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestPluginInterfacePrototype>(vm.heap)) JSTestPluginInterfacePrototype(vm, globalObject, structure);
+        ptr->finishCreation(vm);
+        return ptr;
+    }
+
+    DECLARE_INFO;
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+private:
+    JSTestPluginInterfacePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+
+using JSTestPluginInterfaceConstructor = JSDOMConstructorNotConstructable<JSTestPluginInterface>;
+
+template<> JSValue JSTestPluginInterfaceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSTestPluginInterfaceConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSTestPluginInterface::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestPluginInterface"))), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSTestPluginInterfaceConstructor::s_info = { "TestPluginInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestPluginInterfaceConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestPluginInterfacePrototypeTableValues[] =
+{
+    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestPluginInterfaceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestPluginInterfaceConstructor) } },
+};
+
+const ClassInfo JSTestPluginInterfacePrototype::s_info = { "TestPluginInterfacePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestPluginInterfacePrototype) };
+
+void JSTestPluginInterfacePrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSTestPluginInterfacePrototypeTableValues, *this);
+}
+
+const ClassInfo JSTestPluginInterface::s_info = { "TestPluginInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestPluginInterface) };
+
+JSTestPluginInterface::JSTestPluginInterface(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestPluginInterface>&& impl)
+    : JSDOMWrapper<TestPluginInterface>(structure, globalObject, WTFMove(impl))
+{
+}
+
+void JSTestPluginInterface::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(vm, info()));
+
+}
+
+JSObject* JSTestPluginInterface::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return JSTestPluginInterfacePrototype::create(vm, &globalObject, JSTestPluginInterfacePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
+}
+
+JSObject* JSTestPluginInterface::prototype(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    return getDOMPrototype<JSTestPluginInterface>(vm, globalObject);
+}
+
+JSValue JSTestPluginInterface::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestPluginInterfaceConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+void JSTestPluginInterface::destroy(JSC::JSCell* cell)
+{
+    JSTestPluginInterface* thisObject = static_cast<JSTestPluginInterface*>(cell);
+    thisObject->JSTestPluginInterface::~JSTestPluginInterface();
+}
+
+bool JSTestPluginInterface::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
+{
+    auto* thisObject = jsCast<JSTestPluginInterface*>(object);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    if (pluginElementCustomGetOwnPropertySlot(thisObject, state, propertyName, slot))
+        return true;
+    return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
+}
+
+bool JSTestPluginInterface::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
+{
+    auto* thisObject = jsCast<JSTestPluginInterface*>(object);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    auto propertyName = Identifier::from(state, index);
+    if (pluginElementCustomGetOwnPropertySlot(thisObject, state, propertyName, slot))
+        return true;
+    return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
+}
+
+bool JSTestPluginInterface::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
+{
+    auto* thisObject = jsCast<JSTestPluginInterface*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    bool putResult = false;
+    if (pluginElementCustomPut(thisObject, state, propertyName, value, putPropertySlot, putResult))
+        return putResult;
+
+    return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);
+}
+
+bool JSTestPluginInterface::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
+{
+    auto* thisObject = jsCast<JSTestPluginInterface*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    auto propertyName = Identifier::from(state, index);
+    PutPropertySlot putPropertySlot(thisObject, shouldThrow);
+    bool putResult = false;
+    if (pluginElementCustomPut(thisObject, state, propertyName, value, putPropertySlot, putResult))
+        return putResult;
+
+    return JSObject::putByIndex(cell, state, index, value, shouldThrow);
+}
+
+CallType JSTestPluginInterface::getCallData(JSCell* cell, CallData& callData)
+{
+    auto* thisObject = jsCast<JSTestPluginInterface*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+
+    return pluginElementCustomGetCallData(thisObject, callData);
+}
+
+EncodedJSValue jsTestPluginInterfaceConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* prototype = jsDynamicDowncast<JSTestPluginInterfacePrototype*>(vm, JSValue::decode(thisValue));
+    if (UNLIKELY(!prototype))
+        return throwVMTypeError(state, throwScope);
+    return JSValue::encode(JSTestPluginInterface::getConstructor(state->vm(), prototype->globalObject()));
+}
+
+bool setJSTestPluginInterfaceConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto* prototype = jsDynamicDowncast<JSTestPluginInterfacePrototype*>(vm, JSValue::decode(thisValue));
+    if (UNLIKELY(!prototype)) {
+        throwVMTypeError(state, throwScope);
+        return false;
+    }
+    // Shadowing a built-in constructor
+    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
+}
+
+bool JSTestPluginInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    return false;
+}
+
+void JSTestPluginInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsTestPluginInterface = static_cast<JSTestPluginInterface*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsTestPluginInterface->wrapped(), jsTestPluginInterface);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7TestPluginInterface@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore19TestPluginInterfaceE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestPluginInterface>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
+#if PLATFORM(WIN)
+    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestPluginInterface@WebCore@@6B@"));
+#else
+    void* expectedVTablePointer = &_ZTVN7WebCore19TestPluginInterfaceE[2];
+#endif
+
+    // If this fails TestPluginInterface does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
+    static_assert(std::is_polymorphic<TestPluginInterface>::value, "TestPluginInterface is not polymorphic");
+
+    // If you hit this assertion you either have a use after free bug, or
+    // TestPluginInterface has subclasses. If TestPluginInterface has subclasses that get passed
+    // to toJS() we currently require TestPluginInterface you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
+    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+    return createWrapper<TestPluginInterface>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestPluginInterface& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
+TestPluginInterface* JSTestPluginInterface::toWrapped(JSC::VM& vm, JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicDowncast<JSTestPluginInterface*>(vm, value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.h
new file mode 100644 (file)
index 0000000..6403f1b
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "JSDOMWrapper.h"
+#include "TestPluginInterface.h"
+#include <runtime/CallData.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSTestPluginInterface : public JSDOMWrapper<TestPluginInterface> {
+public:
+    using Base = JSDOMWrapper<TestPluginInterface>;
+    static JSTestPluginInterface* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestPluginInterface>&& impl)
+    {
+        JSTestPluginInterface* ptr = new (NotNull, JSC::allocateCell<JSTestPluginInterface>(globalObject->vm().heap)) JSTestPluginInterface(structure, *globalObject, WTFMove(impl));
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
+    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
+    static TestPluginInterface* toWrapped(JSC::VM&, JSC::JSValue);
+    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
+    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
+    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
+    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
+    static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
+
+    static void destroy(JSC::JSCell*);
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+public:
+    static const unsigned StructureFlags = JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::TypeOfShouldCallGetCallData | Base::StructureFlags;
+protected:
+    JSTestPluginInterface(JSC::Structure*, JSDOMGlobalObject&, Ref<TestPluginInterface>&&);
+
+    void finishCreation(JSC::VM&);
+};
+
+class JSTestPluginInterfaceOwner : public JSC::WeakHandleOwner {
+public:
+    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
+    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestPluginInterface*)
+{
+    static NeverDestroyed<JSTestPluginInterfaceOwner> owner;
+    return &owner.get();
+}
+
+inline void* wrapperKey(TestPluginInterface* wrappableObject)
+{
+    return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestPluginInterface&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestPluginInterface* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestPluginInterface>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestPluginInterface>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+template<> struct JSDOMWrapperConverterTraits<TestPluginInterface> {
+    using WrapperClass = JSTestPluginInterface;
+    using ToWrappedReturnType = TestPluginInterface*;
+};
+
+} // namespace WebCore
index 558a3c2..578a453 100644 (file)
@@ -30,7 +30,7 @@
 // changes in its output.
 [
     ActiveDOMObject,
-    CustomNamedSetter,
+    CustomPut,
     Conditional=Condition1|Condition2,
     ConstructorCallWith=ScriptExecutionContext,
     Constructor(DOMString str1, optional DOMString str2 = "defaultString"),
diff --git a/Source/WebCore/bindings/scripts/test/TestPluginInterface.idl b/Source/WebCore/bindings/scripts/test/TestPluginInterface.idl
new file mode 100644 (file)
index 0000000..7ff120f
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Plugin
+] interface TestPluginInterface {
+};
index 2f7890a..2465e6f 100644 (file)
@@ -19,9 +19,9 @@
  */
 
 [
-    CustomEnumerateProperty,
+    CustomGetOwnPropertyNames,
     CustomGetOwnPropertySlotAndDescriptor,
-    CustomNamedSetter,
+    CustomPut,
     ExportMacro=WEBCORE_EXPORT,
     GenerateIsReachable,
     JSCustomHeader,
index 4dd2016..6801064 100644 (file)
@@ -19,9 +19,7 @@
  */
 
 [
-    CustomCall,
-    CustomGetOwnPropertySlotAndDescriptor,
-    CustomNamedSetter,
+    Plugin
 ] interface HTMLAppletElement : HTMLElement {
     [Reflect] attribute DOMString align;
     [Reflect] attribute DOMString alt;
index f670a1d..d82b2c5 100644 (file)
@@ -19,9 +19,7 @@
  */
 
 [
-    CustomCall,
-    CustomGetOwnPropertySlotAndDescriptor,
-    CustomNamedSetter,
+    Plugin
 ] interface HTMLEmbedElement : HTMLElement {
     [Reflect] attribute DOMString align;
     [Reflect] attribute DOMString height;
index 11e1037..588f705 100644 (file)
@@ -19,9 +19,7 @@
  */
 
 [
-    CustomCall,
-    CustomGetOwnPropertySlotAndDescriptor,
-    CustomNamedSetter
+    Plugin
 ] interface HTMLObjectElement : HTMLElement {
     readonly attribute HTMLFormElement form;
     [Reflect] attribute DOMString code;
index 8794801..2a2182b 100644 (file)
@@ -30,13 +30,12 @@ typedef USVString CSSOMString;
     CheckSecurity,
     CustomDefineOwnProperty,
     CustomDeleteProperty,
-    CustomEnumerateProperty,
+    CustomGetOwnPropertyNames,
     CustomGetOwnPropertySlot,
-    CustomGetOwnPropertySlotByIndex,
     CustomGetPrototype,
     CustomPreventExtensions,
     CustomProxyToJSObject,
-    CustomPutFunction,
+    CustomPut,
     CustomToStringName,
     ExportMacro=WEBCORE_EXPORT,
     ImplicitThis,
index a1edee1..58974d4 100644 (file)
     CustomDefineOwnProperty,
     CustomDefineOwnPropertyOnPrototype,
     CustomDeleteProperty,
-    CustomEnumerateProperty,
-    CustomGetOwnPropertySlotAndDescriptor,
+    CustomGetOwnPropertyNames,
+    CustomGetOwnPropertySlot,
     CustomGetPrototype,
-    CustomNamedGetterOnPrototype,
-    CustomNamedSetter,
     CustomPreventExtensions,
+    CustomPut,
+    CustomPutOnPrototype,
     CustomToStringName,
     GenerateIsReachable=ImplFrame,
     IsImmutablePrototypeExoticObject,
-    Unforgeable,
+    Unforgeable
 ] interface Location {
     [SetterCallWith=ActiveWindow&FirstWindow, SetterMayThrowException, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
 
index 8bbc03a..302952d 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 [
-    CustomEnumerateProperty,
+    CustomGetOwnPropertyNames,
     GenerateIsReachable=ImplFrame,
     SkipVTableValidation,
 ] interface Storage {