| Differences between
and this patch
- Source/WebCore/ChangeLog +246 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2017-06-03  Sam Weinig  <sam@webkit.org>
2
3
        Can't use Object.defineProperty() to add an item to a DOMStringMap or Storage
4
        https://bugs.webkit.org/show_bug.cgi?id=172687
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        - Adds support for generating the defineOwnProperty ClassInfo method table hook
9
          to add support for Object.defineProperty(). The implementation follows WebIDL
10
          section 3.9.3 [[DefineOwnProperty]].
11
          (https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty)
12
        - Adds support for generating named setters in addition to the already supported
13
          indexed setters as much of the required work was needed to make defineOwnProperty
14
          work for those properties. This patch does not aim to follow WebIDL faithfully,
15
          but rather to generate as close to the custom code as possible. A follow up 
16
          change will attempt to match WebIDL more closely (which will also require changes
17
          to [[GetOwnPropertySlot]]).
18
        - Removes the need for custom bindings in DOMStringMap, HTMLOptionsCollection and
19
          HTMLSelectElement. Gets us one function away from supporting Storage.
20
        - Tidies up generated headers a bit by grouping all the ClassInfo method table hooks
21
          together.
22
        - Removes support for CustomIndexedSetter, which is no longer used.
23
24
        Test: js/dom/legacy-platform-object-defineOwnProperty.html
25
26
        * CMakeLists.txt:
27
        * WebCore.xcodeproj/project.pbxproj:
28
        * bindings/js/JSBindingsAllInOne.cpp:
29
        Removed now unneeded custom bindings.
30
31
        * bindings/js/JSDOMStringMapCustom.cpp: Removed.
32
        * bindings/js/JSHTMLOptionsCollectionCustom.cpp: Removed.
33
        * bindings/js/JSHTMLSelectElementCustom.cpp: Removed.
34
        * bindings/js/JSHTMLSelectElementCustom.h: Removed.
35
        * bindings/js/JSStorageCustom.cpp:
36
        (WebCore::JSStorage::putDelegate): Deleted.
37
        Remove more code that is now generated.
38
39
        * bindings/scripts/CodeGeneratorJS.pm:
40
        (GenerateIndexedGetter):
41
        - Add missing check for indexed setter operation when determining if the property should be ReadOnly.
42
        - Add support for custom implementation name, matching GenerateNamedGetter.
43
        - Convert to taking an outputArray and indent to allow more flexibility going forward.
44
45
        (GenerateNamedGetter):
46
        - Add missing check for named setter operation when determining if the property should be ReadOnly.
47
        - Convert to taking an outputArray and indent to allow more flexibility going forward.
48
49
        (GenerateGetOwnPropertySlotBody):
50
        - Convert to taking an outputArray and indent to allow more flexibility going forward.
51
        - Take over responsibility for checking and bailing if CustomGetOwnPropertySlot is set.
52
53
        (GenerateGetOwnPropertySlotBodyByIndex):
54
        - Convert to taking an outputArray and indent to allow more flexibility going forward.
55
        - Take over responsibility for checking and bailing if CustomGetOwnPropertySlotByIndex is set.
56
57
        (GenerateGetOwnPropertyNames):
58
        - Convert to taking an outputArray and indent to allow more flexibility going forward.
59
        - Take over responsibility for checking and bailing if CustomEnumerateProperty is set.
60
61
        (GenerateInvokeIndexedPropertySetter):
62
        Added. Implements the 'invoke an indexed property setter' algorithm (https://heycam.github.io/webidl/#invoke-indexed-setter)
63
64
        (GenerateInvokeNamedPropertySetter):
65
        Added. Implements the 'invoke a named property setter' algorithm (https://heycam.github.io/webidl/#invoke-named-setter)
66
67
        (GeneratePut):
68
        (GeneratePutByIndex):
69
        - Convert to taking an outputArray and indent to allow more flexibility going forward.
70
        - Take over responsibility for checking and bailing if CustomPut is set.
71
        - Adds support for CEReactions.
72
        - Adopts GenerateInvokeIndexedPropertySetter and GenerateInvokeNamedPropertySetter to
73
          simplify code.
74
        - Removes support for CustomIndexedSetter, which is no longer used.
75
        - Replaces use direct checking of OverrideBuiltins with check if any interface it inherits
76
          has it, which is how it is specified to work.
77
78
        (GenerateIsUnforgeablePropertyName):
79
        Added. Helper subroutine to generate a function that compares a property name
80
        agains all the property names defined as Unforgeable on the interface. Used by
81
        GenerateDefineOwnProperty.
82
83
        (GenerateDefineOwnProperty):
84
        Added. Implements section 3.9.3 [[DefineOwnProperty]] (https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty)
85
        Adds support for CEReactions.
86
87
        (GenerateDeletePropertyCommon):
88
        Switch from getting OverrideBuiltins directly off the interface to using InheritsExtendedAttribute.
89
90
        (GenerateNamedDeleterDefinition):
91
        Switch signature to match peer generators.
92
93
        (InstanceOverridesGetOwnPropertySlot):
94
        Update for rename of JSCustomGetOwnPropertySlotAndDescriptor to CustomGetOwnPropertySlotAndDescriptor.
95
96
        (InstanceOverridesGetOwnPropertySlotByIndex):
97
        Added. Like InstanceOverridesGetOwnPropertySlot, but checks for the new CustomGetOwnPropertySlotByIndex 
98
        rather than CustomGetOwnPropertySlot.
99
100
        (InstanceOverridesGetOwnPropertyNames):
101
        Added. Moves complex predicate out of line.
102
103
        (InstanceOverridesPut):
104
        Removes now unused CustomIndexedSetter, and adds CustomPutFunction, which used to be checked separately.
105
106
        (InstanceOverridesDefineOwnProperty):
107
        Added.
108
109
        (GenerateHeader):
110
        - Moves more structure flags together.
111
        - Simplifies predicates and moves the ClassInfo method table hooks together.
112
113
        (GenerateImplementation):
114
        - Moves the ClassInfo method table hooks together
115
        - Adds call to GenerateDefineOwnProperty.
116
117
        (GenerateLegacyCallerDefinitions):
118
        Simplify bail condition to match other generators.
119
120
        (GeneratePrototypeDeclaration):
121
        Update for new extended attribute names.
122
123
        (InstanceOverridesCall): 
124
        Renamed from IsCallable for consistency.
125
        
126
        (HasComplexGetOwnProperty): 
127
        Deleted. Unused.
128
        
129
        (InstanceOverridesPutImplementation): 
130
        Deleted. Unused.
131
        
132
        (InstanceOverridesPutDeclaration): 
133
        Deleted. Unused.
134
        
135
        (IsCallable): 
136
        Renamed, for consistency, to InstanceOverridesCall .
137
138
        * bindings/scripts/IDLAttributes.json:
139
        Renames a few of the extended attributes to remove the JS prefix. This time
140
        around I only did the ones in the area I was working, but we should probably
141
        remove most of the rest.
142
    
143
        * css/CSSStyleDeclaration.idl:
144
        Update for JSCustomGetOwnPropertySlotAndDescriptor -> CustomGetOwnPropertySlotAndDescriptor rename.
145
146
        * dom/DOMStringMap.idl:
147
        Remove CustomNamedSetter and add uncomment out the setter.
148
149
        * dom/DatasetDOMStringMap.cpp:
150
        (WebCore::DatasetDOMStringMap::setNamedItem):
151
        (WebCore::DatasetDOMStringMap::setItem): Deleted.
152
        * dom/DatasetDOMStringMap.h:
153
        Rename setItem to setNamedItem, which is what the generator expects.
154
155
        * dom/Node.idl:
156
        Update for JSCustomPushEventHandlerScope -> CustomPushEventHandlerScope rename.
157
158
        * html/HTMLAppletElement.idl:
159
        * html/HTMLEmbedElement.idl:
160
        * html/HTMLObjectElement.idl:
161
        Update for JSCustomGetOwnPropertySlotAndDescriptor -> CustomGetOwnPropertySlotAndDescriptor rename.
162
163
        * html/HTMLCollection.cpp:
164
        (WebCore::HTMLCollection::isSupportedPropertyName):
165
        * html/HTMLCollection.h:
166
        Add isSupportedPropertyName function which is used by the bindings and is now needed.
167
168
        * html/HTMLElement.idl:
169
        Update for JSCustomPushEventHandlerScope -> CustomPushEventHandlerScope rename.
170
171
        * html/HTMLOptionsCollection.h:
172
        (WebCore::HTMLOptionsCollection::setItem):
173
        Add setItem() implementation which just forwards to the select element. Also, add 
174
        a type alias to make the implementations of item and namedItem less verbose.
175
176
        * html/HTMLOptionsCollection.idl:
177
        Remove CustomIndexedSetter and uncomment the setter.
178
179
        * html/HTMLSelectElement.idl:
180
        Remove CustomIndexedSetter and uncomment the setter. Also, reformat
181
        to match the WHATWG spec.
182
183
        * page/DOMWindow.idl:
184
        Update for JSCustomDefineOwnProperty -> CustomDefineOwnProperty rename. Add 
185
        CustomGetOwnPropertySlotByIndex which is now needed to remove some unsound
186
        assumptions the generator was making.
187
188
        * page/Location.idl:
189
        Update for removal of JS prefix from a bunch of extended attributes.
190
191
        * page/UserMessageHandlersNamespace.idl:
192
        Update for JSCustomGetOwnPropertySlotAndDescriptor -> CustomGetOwnPropertySlotAndDescriptor rename.
193
194
        * storage/Storage.idl:
195
        Remove CustomNamedSetter and uncomment the setter.
196
197
        * bindings/scripts/test/JS/JSInterfaceName.h:
198
        * bindings/scripts/test/JS/JSTestEventTarget.h:
199
        * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: Added.
200
        * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: Added.
201
        * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: Added.
202
        * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: Added.
203
        * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: Added.
204
        * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: Added.
205
        * bindings/scripts/test/JS/JSTestInterface.cpp:
206
        * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: Added.
207
        * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: Added.
208
        * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: Added.
209
        * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: Added.
210
        * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: Added.
211
        * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: Added.
212
        * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h:
213
        * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h:
214
        * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
215
        * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h:
216
        * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h:
217
        * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: Added.
218
        * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: Added.
219
        * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: Added.
220
        * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: Added.
221
        * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: Added.
222
        * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: Added.
223
        * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: Added.
224
        * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h: Added.
225
        * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: Added.
226
        * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h: Added.
227
        * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: Added.
228
        * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h: Added.
229
        * bindings/scripts/test/JS/JSTestObj.cpp:
230
        * bindings/scripts/test/JS/JSTestObj.h:
231
        * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
232
        * bindings/scripts/test/TestIndexedSetterNoIdentifier.idl: Added.
233
        * bindings/scripts/test/TestIndexedSetterThrowingException.idl: Added.
234
        * bindings/scripts/test/TestIndexedSetterWithIdentifier.idl: Added.
235
        * bindings/scripts/test/TestNamedAndIndexedSetterNoIdentifier.idl: Added.
236
        * bindings/scripts/test/TestNamedAndIndexedSetterThrowingException.idl: Added.
237
        * bindings/scripts/test/TestNamedAndIndexedSetterWithIdentifier.idl: Added.
238
        * bindings/scripts/test/TestNamedDeleterWithIdentifier.idl:
239
        * bindings/scripts/test/TestNamedSetterNoIdentifier.idl: Added.
240
        * bindings/scripts/test/TestNamedSetterThrowingException.idl: Added.
241
        * bindings/scripts/test/TestNamedSetterWithIdentifier.idl: Added.
242
        * bindings/scripts/test/TestNamedSetterWithOverrideBuiltins.idl: Added.
243
        * bindings/scripts/test/TestNamedSetterWithUnforgableProperties.idl: Added.
244
        * bindings/scripts/test/TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.idl: Added.
245
        Added new tests and updated some results.
246
1
2017-06-03  Chris Dumez  <cdumez@apple.com>
247
2017-06-03  Chris Dumez  <cdumez@apple.com>
2
248
3
        Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
249
        Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
- Source/WebCore/CMakeLists.txt -3 lines
Lines 1166-1172 set(WebCore_SOURCES Source/WebCore/CMakeLists.txt_sec1
1166
    bindings/js/JSDOMGuardedObject.cpp
1166
    bindings/js/JSDOMGuardedObject.cpp
1167
    bindings/js/JSDOMMapLike.cpp
1167
    bindings/js/JSDOMMapLike.cpp
1168
    bindings/js/JSDOMPromiseDeferred.cpp
1168
    bindings/js/JSDOMPromiseDeferred.cpp
1169
    bindings/js/JSDOMStringMapCustom.cpp
1170
    bindings/js/JSDOMWindowBase.cpp
1169
    bindings/js/JSDOMWindowBase.cpp
1171
    bindings/js/JSDOMWindowCustom.cpp
1170
    bindings/js/JSDOMWindowCustom.cpp
1172
    bindings/js/JSDOMWindowProperties.cpp
1171
    bindings/js/JSDOMWindowProperties.cpp
Lines 1189-1196 set(WebCore_SOURCES Source/WebCore/CMakeLists.txt_sec2
1189
    bindings/js/JSHTMLEmbedElementCustom.cpp
1188
    bindings/js/JSHTMLEmbedElementCustom.cpp
1190
    bindings/js/JSHTMLFrameSetElementCustom.cpp
1189
    bindings/js/JSHTMLFrameSetElementCustom.cpp
1191
    bindings/js/JSHTMLObjectElementCustom.cpp
1190
    bindings/js/JSHTMLObjectElementCustom.cpp
1192
    bindings/js/JSHTMLOptionsCollectionCustom.cpp
1193
    bindings/js/JSHTMLSelectElementCustom.cpp
1194
    bindings/js/JSHTMLTemplateElementCustom.cpp
1191
    bindings/js/JSHTMLTemplateElementCustom.cpp
1195
    bindings/js/JSHistoryCustom.cpp
1192
    bindings/js/JSHistoryCustom.cpp
1196
    bindings/js/JSIDBCursorCustom.cpp
1193
    bindings/js/JSIDBCursorCustom.cpp
- Source/WebCore/WebCore.xcodeproj/project.pbxproj -16 lines
Lines 1900-1906 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec1
1900
		447958051643B4B2001E0A7F /* ParsedContentType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 447958021643B47B001E0A7F /* ParsedContentType.cpp */; };
1900
		447958051643B4B2001E0A7F /* ParsedContentType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 447958021643B47B001E0A7F /* ParsedContentType.cpp */; };
1901
		448A29BF0A46D9CB0030759F /* JSHTMLOptionsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
1901
		448A29BF0A46D9CB0030759F /* JSHTMLOptionsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
1902
		448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */; };
1902
		448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */; };
1903
		448AD27C0A48137A0023D179 /* JSHTMLOptionsCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */; };
1904
		448B1B7A0F3A2F9B0047A9E2 /* TextSizeAdjustment.h in Headers */ = {isa = PBXBuildFile; fileRef = 448B1B780F3A2F9B0047A9E2 /* TextSizeAdjustment.h */; settings = {ATTRIBUTES = (Private, ); }; };
1903
		448B1B7A0F3A2F9B0047A9E2 /* TextSizeAdjustment.h in Headers */ = {isa = PBXBuildFile; fileRef = 448B1B780F3A2F9B0047A9E2 /* TextSizeAdjustment.h */; settings = {ATTRIBUTES = (Private, ); }; };
1905
		4496E39D1398136C003EE32A /* JSSVGAnimateMotionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4496E39B1398136C003EE32A /* JSSVGAnimateMotionElement.cpp */; };
1904
		4496E39D1398136C003EE32A /* JSSVGAnimateMotionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4496E39B1398136C003EE32A /* JSSVGAnimateMotionElement.cpp */; };
1906
		4496E39E1398136C003EE32A /* JSSVGAnimateMotionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4496E39C1398136C003EE32A /* JSSVGAnimateMotionElement.h */; };
1905
		4496E39E1398136C003EE32A /* JSSVGAnimateMotionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4496E39C1398136C003EE32A /* JSSVGAnimateMotionElement.h */; };
Lines 4914-4920 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec2
4914
		AB247A6C0AFD6383003FA5FD /* RenderSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */; };
4913
		AB247A6C0AFD6383003FA5FD /* RenderSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */; };
4915
		AB247A6D0AFD6383003FA5FD /* RenderSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = AB247A6B0AFD6383003FA5FD /* RenderSlider.h */; };
4914
		AB247A6D0AFD6383003FA5FD /* RenderSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = AB247A6B0AFD6383003FA5FD /* RenderSlider.h */; };
4916
		AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AB31C91D10AE1B8E000C7B92 /* LineClampValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
4915
		AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AB31C91D10AE1B8E000C7B92 /* LineClampValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
4917
		AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */; };
4918
		AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */; };
4916
		AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */; };
4919
		AB67D1A9097F3AE300F9392E /* RenderTextControl.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextControl.h */; settings = {ATTRIBUTES = (Private, ); }; };
4917
		AB67D1A9097F3AE300F9392E /* RenderTextControl.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextControl.h */; settings = {ATTRIBUTES = (Private, ); }; };
4920
		AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; };
4918
		AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; };
Lines 5587-5593 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec3
5587
		BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC128B00137C8D4600CAC845 /* RenderGrid.cpp */; };
5585
		BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC128B00137C8D4600CAC845 /* RenderGrid.cpp */; };
5588
		BC14028A0E83680800319717 /* ScrollbarThemeComposite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */; };
5586
		BC14028A0E83680800319717 /* ScrollbarThemeComposite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */; };
5589
		BC14028B0E83680800319717 /* ScrollbarThemeComposite.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1402890E83680800319717 /* ScrollbarThemeComposite.h */; settings = {ATTRIBUTES = (Private, ); }; };
5587
		BC14028B0E83680800319717 /* ScrollbarThemeComposite.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1402890E83680800319717 /* ScrollbarThemeComposite.h */; settings = {ATTRIBUTES = (Private, ); }; };
5590
		BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */; };
5591
		BC1A7D9718FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1A7D9518FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp */; };
5588
		BC1A7D9718FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1A7D9518FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp */; };
5592
		BC1A7D9818FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A7D9618FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h */; };
5589
		BC1A7D9818FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A7D9618FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h */; };
5593
		BC1BDF24156C1883001C1243 /* DOMError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1BDF20156C17A9001C1243 /* DOMError.cpp */; };
5590
		BC1BDF24156C1883001C1243 /* DOMError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1BDF20156C17A9001C1243 /* DOMError.cpp */; };
Lines 5728-5734 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec4
5728
		BC64641D11D7F416006455B0 /* DatasetDOMStringMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64641B11D7F416006455B0 /* DatasetDOMStringMap.cpp */; };
5725
		BC64641D11D7F416006455B0 /* DatasetDOMStringMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64641B11D7F416006455B0 /* DatasetDOMStringMap.cpp */; };
5729
		BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64649511D82349006455B0 /* JSDOMStringMap.cpp */; };
5726
		BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64649511D82349006455B0 /* JSDOMStringMap.cpp */; };
5730
		BC64649811D82349006455B0 /* JSDOMStringMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64649611D82349006455B0 /* JSDOMStringMap.h */; };
5727
		BC64649811D82349006455B0 /* JSDOMStringMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64649611D82349006455B0 /* JSDOMStringMap.h */; };
5731
		BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */; };
5732
		BC64B4CB0CB4295D005F2B62 /* CachedFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */; };
5728
		BC64B4CB0CB4295D005F2B62 /* CachedFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */; };
5733
		BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CA0CB4295D005F2B62 /* CachedFont.h */; };
5729
		BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */ = {isa = PBXBuildFile; fileRef = BC64B4CA0CB4295D005F2B62 /* CachedFont.h */; };
5734
		BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */; };
5730
		BC64B4D50CB4298A005F2B62 /* CSSFontFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */; };
Lines 9626-9632 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec5
9626
		447958031643B47B001E0A7F /* ParsedContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParsedContentType.h; sourceTree = "<group>"; };
9622
		447958031643B47B001E0A7F /* ParsedContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParsedContentType.h; sourceTree = "<group>"; };
9627
		448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLOptionsCollection.h; sourceTree = "<group>"; };
9623
		448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLOptionsCollection.h; sourceTree = "<group>"; };
9628
		448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOptionsCollection.cpp; sourceTree = "<group>"; };
9624
		448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOptionsCollection.cpp; sourceTree = "<group>"; };
9629
		448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOptionsCollectionCustom.cpp; sourceTree = "<group>"; };
9630
		448B1B780F3A2F9B0047A9E2 /* TextSizeAdjustment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextSizeAdjustment.h; sourceTree = "<group>"; };
9625
		448B1B780F3A2F9B0047A9E2 /* TextSizeAdjustment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextSizeAdjustment.h; sourceTree = "<group>"; };
9631
		449098B10F8F82520076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
9626
		449098B10F8F82520076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
9632
		4496E39B1398136C003EE32A /* JSSVGAnimateMotionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAnimateMotionElement.cpp; sourceTree = "<group>"; };
9627
		4496E39B1398136C003EE32A /* JSSVGAnimateMotionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAnimateMotionElement.cpp; sourceTree = "<group>"; };
Lines 13241-13247 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec6
13241
		AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSlider.cpp; sourceTree = "<group>"; };
13236
		AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSlider.cpp; sourceTree = "<group>"; };
13242
		AB247A6B0AFD6383003FA5FD /* RenderSlider.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSlider.h; sourceTree = "<group>"; };
13237
		AB247A6B0AFD6383003FA5FD /* RenderSlider.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSlider.h; sourceTree = "<group>"; };
13243
		AB31C91D10AE1B8E000C7B92 /* LineClampValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineClampValue.h; sourceTree = "<group>"; };
13238
		AB31C91D10AE1B8E000C7B92 /* LineClampValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineClampValue.h; sourceTree = "<group>"; };
13244
		AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLSelectElementCustom.h; sourceTree = "<group>"; };
13245
		AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControl.cpp; sourceTree = "<group>"; };
13239
		AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControl.cpp; sourceTree = "<group>"; };
13246
		AB67D1A7097F3AE300F9392E /* RenderTextControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderTextControl.h; sourceTree = "<group>"; };
13240
		AB67D1A7097F3AE300F9392E /* RenderTextControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderTextControl.h; sourceTree = "<group>"; };
13247
		AB7170880B3118080017123E /* SearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenu.h; sourceTree = "<group>"; };
13241
		AB7170880B3118080017123E /* SearchPopupMenu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenu.h; sourceTree = "<group>"; };
Lines 14068-14074 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec7
14068
		BC128B00137C8D4600CAC845 /* RenderGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderGrid.cpp; sourceTree = "<group>"; };
14062
		BC128B00137C8D4600CAC845 /* RenderGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderGrid.cpp; sourceTree = "<group>"; };
14069
		BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarThemeComposite.cpp; sourceTree = "<group>"; };
14063
		BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarThemeComposite.cpp; sourceTree = "<group>"; };
14070
		BC1402890E83680800319717 /* ScrollbarThemeComposite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarThemeComposite.h; sourceTree = "<group>"; };
14064
		BC1402890E83680800319717 /* ScrollbarThemeComposite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarThemeComposite.h; sourceTree = "<group>"; };
14071
		BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElementCustom.cpp; sourceTree = "<group>"; };
14072
		BC1A7D9518FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMultiColumnSpannerPlaceholder.cpp; sourceTree = "<group>"; };
14065
		BC1A7D9518FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMultiColumnSpannerPlaceholder.cpp; sourceTree = "<group>"; };
14073
		BC1A7D9618FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMultiColumnSpannerPlaceholder.h; sourceTree = "<group>"; };
14066
		BC1A7D9618FCB5B000421879 /* RenderMultiColumnSpannerPlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMultiColumnSpannerPlaceholder.h; sourceTree = "<group>"; };
14074
		BC1BDF20156C17A9001C1243 /* DOMError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMError.cpp; sourceTree = "<group>"; };
14067
		BC1BDF20156C17A9001C1243 /* DOMError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMError.cpp; sourceTree = "<group>"; };
Lines 14216-14222 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec8
14216
		BC64647911D800CD006455B0 /* DOMStringMap.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMStringMap.idl; sourceTree = "<group>"; };
14209
		BC64647911D800CD006455B0 /* DOMStringMap.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMStringMap.idl; sourceTree = "<group>"; };
14217
		BC64649511D82349006455B0 /* JSDOMStringMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringMap.cpp; sourceTree = "<group>"; };
14210
		BC64649511D82349006455B0 /* JSDOMStringMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringMap.cpp; sourceTree = "<group>"; };
14218
		BC64649611D82349006455B0 /* JSDOMStringMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMStringMap.h; sourceTree = "<group>"; };
14211
		BC64649611D82349006455B0 /* JSDOMStringMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMStringMap.h; sourceTree = "<group>"; };
14219
		BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringMapCustom.cpp; sourceTree = "<group>"; };
14220
		BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedFont.cpp; sourceTree = "<group>"; };
14212
		BC64B4C90CB4295D005F2B62 /* CachedFont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedFont.cpp; sourceTree = "<group>"; };
14221
		BC64B4CA0CB4295D005F2B62 /* CachedFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFont.h; sourceTree = "<group>"; };
14213
		BC64B4CA0CB4295D005F2B62 /* CachedFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFont.h; sourceTree = "<group>"; };
14222
		BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFace.cpp; sourceTree = "<group>"; };
14214
		BC64B4CD0CB4298A005F2B62 /* CSSFontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSFontFace.cpp; sourceTree = "<group>"; };
Lines 23642-23648 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec9
23642
				DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
23634
				DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
23643
				49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
23635
				49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
23644
				ADDA94BF19686F8000453029 /* JSDocumentCustom.h */,
23636
				ADDA94BF19686F8000453029 /* JSDocumentCustom.h */,
23645
				BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */,
23646
				BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
23637
				BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
23647
				652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
23638
				652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
23648
				C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
23639
				C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
Lines 23655-23663 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec10
23655
				BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */,
23646
				BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */,
23656
				BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */,
23647
				BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */,
23657
				BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */,
23648
				BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */,
23658
				448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */,
23659
				BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */,
23660
				AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */,
23661
				D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
23649
				D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
23662
				7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
23650
				7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
23663
				BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
23651
				BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
Lines 28085-28091 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec11
28085
				1AE2AEC80A1D297B00B42B25 /* JSHTMLQuoteElement.h in Headers */,
28073
				1AE2AEC80A1D297B00B42B25 /* JSHTMLQuoteElement.h in Headers */,
28086
				1AE2ABAD0A1CE90500B42B25 /* JSHTMLScriptElement.h in Headers */,
28074
				1AE2ABAD0A1CE90500B42B25 /* JSHTMLScriptElement.h in Headers */,
28087
				E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */,
28075
				E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */,
28088
				AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */,
28089
				9B69D3B91B99100700E3512B /* JSHTMLSlotElement.h in Headers */,
28076
				9B69D3B91B99100700E3512B /* JSHTMLSlotElement.h in Headers */,
28090
				E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */,
28077
				E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */,
28091
				9752D38E1413104B003305BD /* JSHTMLSpanElement.h in Headers */,
28078
				9752D38E1413104B003305BD /* JSHTMLSpanElement.h in Headers */,
Lines 31937-31943 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec12
31937
				BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
31924
				BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */,
31938
				C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
31925
				C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */,
31939
				BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */,
31926
				BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */,
31940
				BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */,
31941
				7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */,
31927
				7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */,
31942
				2E37E00512DBC5A400A6B233 /* JSDOMURL.cpp in Sources */,
31928
				2E37E00512DBC5A400A6B233 /* JSDOMURL.cpp in Sources */,
31943
				1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
31929
				1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
Lines 32061-32067 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec13
32061
				A80E7E9C0A1A83E3007FB8C5 /* JSHTMLOptGroupElement.cpp in Sources */,
32047
				A80E7E9C0A1A83E3007FB8C5 /* JSHTMLOptGroupElement.cpp in Sources */,
32062
				A80E7E9A0A1A83E3007FB8C5 /* JSHTMLOptionElement.cpp in Sources */,
32048
				A80E7E9A0A1A83E3007FB8C5 /* JSHTMLOptionElement.cpp in Sources */,
32063
				448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */,
32049
				448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */,
32064
				448AD27C0A48137A0023D179 /* JSHTMLOptionsCollectionCustom.cpp in Sources */,
32065
				4AD0173C127E82860015035F /* JSHTMLOutputElement.cpp in Sources */,
32050
				4AD0173C127E82860015035F /* JSHTMLOutputElement.cpp in Sources */,
32066
				1AE2ABA60A1CE90500B42B25 /* JSHTMLParagraphElement.cpp in Sources */,
32051
				1AE2ABA60A1CE90500B42B25 /* JSHTMLParagraphElement.cpp in Sources */,
32067
				1AE2ABA80A1CE90500B42B25 /* JSHTMLParamElement.cpp in Sources */,
32052
				1AE2ABA80A1CE90500B42B25 /* JSHTMLParamElement.cpp in Sources */,
Lines 32071-32077 Source/WebCore/WebCore.xcodeproj/project.pbxproj_sec14
32071
				1AE2AEC70A1D297B00B42B25 /* JSHTMLQuoteElement.cpp in Sources */,
32056
				1AE2AEC70A1D297B00B42B25 /* JSHTMLQuoteElement.cpp in Sources */,
32072
				1AE2ABAC0A1CE90500B42B25 /* JSHTMLScriptElement.cpp in Sources */,
32057
				1AE2ABAC0A1CE90500B42B25 /* JSHTMLScriptElement.cpp in Sources */,
32073
				E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */,
32058
				E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */,
32074
				BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */,
32075
				9B69D3B81B99100700E3512B /* JSHTMLSlotElement.cpp in Sources */,
32059
				9B69D3B81B99100700E3512B /* JSHTMLSlotElement.cpp in Sources */,
32076
				E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */,
32060
				E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */,
32077
				9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */,
32061
				9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */,
- Source/WebCore/bindings/js/JSBindingsAllInOne.cpp -3 lines
Lines 51-57 Source/WebCore/bindings/js/JSBindingsAllInOne.cpp_sec1
51
#include "JSDOMGlobalObject.cpp"
51
#include "JSDOMGlobalObject.cpp"
52
#include "JSDOMGlobalObjectTask.cpp"
52
#include "JSDOMGlobalObjectTask.cpp"
53
#include "JSDOMPromiseDeferred.cpp"
53
#include "JSDOMPromiseDeferred.cpp"
54
#include "JSDOMStringMapCustom.cpp"
55
#include "JSDOMWindowBase.cpp"
54
#include "JSDOMWindowBase.cpp"
56
#include "JSDOMWindowCustom.cpp"
55
#include "JSDOMWindowCustom.cpp"
57
#include "JSDOMWindowProperties.cpp"
56
#include "JSDOMWindowProperties.cpp"
Lines 74-81 Source/WebCore/bindings/js/JSBindingsAllInOne.cpp_sec2
74
#include "JSHTMLEmbedElementCustom.cpp"
73
#include "JSHTMLEmbedElementCustom.cpp"
75
#include "JSHTMLFrameSetElementCustom.cpp"
74
#include "JSHTMLFrameSetElementCustom.cpp"
76
#include "JSHTMLObjectElementCustom.cpp"
75
#include "JSHTMLObjectElementCustom.cpp"
77
#include "JSHTMLOptionsCollectionCustom.cpp"
78
#include "JSHTMLSelectElementCustom.cpp"
79
#include "JSHTMLTemplateElementCustom.cpp"
76
#include "JSHTMLTemplateElementCustom.cpp"
80
#include "JSHistoryCustom.cpp"
77
#include "JSHistoryCustom.cpp"
81
#include "JSImageDataCustom.cpp"
78
#include "JSImageDataCustom.cpp"
- Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp -64 lines
Lines 1-63 Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp_sec1
1
/*
2
 * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "JSDOMStringMap.h"
28
29
#include "CustomElementReactionQueue.h"
30
#include "DOMStringMap.h"
31
#include "JSDOMConvert.h"
32
#include "JSNode.h"
33
#include <runtime/IdentifierInlines.h>
34
#include <wtf/text/AtomicString.h>
35
36
using namespace JSC;
37
38
namespace WebCore {
39
40
bool JSDOMStringMap::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult)
41
{
42
    VM& vm = state->vm();
43
    auto scope = DECLARE_THROW_SCOPE(vm);
44
45
    if (propertyName.isSymbol())
46
        return false;
47
48
    CustomElementReactionStack customElementReactionStack;
49
50
    String stringValue = value.toWTFString(state);
51
    RETURN_IF_EXCEPTION(scope, true);
52
53
    auto result = wrapped().setItem(propertyNameToString(propertyName), WTFMove(stringValue));
54
    if (result.hasException()) {
55
        propagateException(*state, scope, result.releaseException());
56
        return true;
57
    }
58
59
    putResult = true;
60
    return true;
61
}
62
63
} // namespace WebCore
64
native
- Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp -41 lines
Lines 1-40 Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp_sec1
1
/*
2
 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
#include "config.h"
21
#include "JSHTMLOptionsCollection.h"
22
23
#include "CustomElementReactionQueue.h"
24
#include "ExceptionCode.h"
25
#include "JSHTMLOptionElement.h"
26
#include "JSHTMLSelectElement.h"
27
#include "JSHTMLSelectElementCustom.h"
28
#include <wtf/MathExtras.h>
29
30
using namespace JSC;
31
32
namespace WebCore {
33
34
void JSHTMLOptionsCollection::indexSetter(ExecState* state, unsigned index, JSValue value)
35
{
36
    CustomElementReactionStack customElementReactionStack;
37
    selectElementIndexSetter(*state, wrapped().selectElement(), index, value);
38
}
39
40
}
41
native
- Source/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp -55 lines
Lines 1-54 Source/WebCore/bindings/js/JSHTMLSelectElementCustom.cpp_sec1
1
/*
2
 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
3
 * Copyright (C) 2007 Alexey Proskuryakov (ap@webkit.org)
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Library General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Library General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Library General Public License
16
 * along with this library; see the file COPYING.LIB.  If not, write to
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 * Boston, MA 02110-1301, USA.
19
 */
20
21
#include "config.h"
22
#include "JSHTMLSelectElementCustom.h"
23
24
#include "CustomElementReactionQueue.h"
25
#include "ExceptionCode.h"
26
#include "HTMLNames.h"
27
#include "HTMLOptionElement.h"
28
#include "HTMLSelectElement.h"
29
#include "JSHTMLOptionElement.h"
30
#include "JSHTMLSelectElement.h"
31
32
namespace WebCore {
33
34
using namespace JSC;
35
using namespace HTMLNames;
36
37
void selectElementIndexSetter(JSC::ExecState& state, HTMLSelectElement& element, unsigned index, JSC::JSValue value)
38
{
39
    VM& vm = state.vm();
40
    auto throwScope = DECLARE_THROW_SCOPE(vm);
41
42
    auto* option = convert<IDLNullable<IDLInterface<HTMLOptionElement>>>(state, value);
43
    RETURN_IF_EXCEPTION(throwScope, void());
44
45
    propagateException(state, throwScope, element.setItem(index, option));
46
}
47
48
void JSHTMLSelectElement::indexSetter(JSC::ExecState* state, unsigned index, JSC::JSValue value)
49
{
50
    CustomElementReactionStack customElementReactionStack;
51
    selectElementIndexSetter(*state, wrapped(), index, value);
52
}
53
54
}
55
native
- Source/WebCore/bindings/js/JSHTMLSelectElementCustom.h -43 lines
Lines 1-42 Source/WebCore/bindings/js/JSHTMLSelectElementCustom.h_sec1
1
/*
2
 * Copyright (C) 2007 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer. 
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution. 
13
 * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission. 
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
29
#pragma once
30
31
namespace JSC {
32
class ExecState;
33
class JSValue;
34
}
35
36
namespace WebCore {
37
38
class HTMLSelectElement;
39
40
void selectElementIndexSetter(JSC::ExecState&, HTMLSelectElement&, unsigned index, JSC::JSValue);
41
42
}
43
native
- Source/WebCore/bindings/js/JSStorageCustom.cpp -30 lines
Lines 60-93 void JSStorage::getOwnPropertyNames(JSOb Source/WebCore/bindings/js/JSStorageCustom.cpp_sec1
60
    Base::getOwnPropertyNames(&thisObject, state, propertyNames, mode);
60
    Base::getOwnPropertyNames(&thisObject, state, propertyNames, mode);
61
}
61
}
62
62
63
bool JSStorage::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult)
64
{
65
    VM& vm = state->vm();
66
    auto scope = DECLARE_THROW_SCOPE(vm);
67
68
    if (propertyName.isSymbol())
69
        return false;
70
71
    // Only perform the custom put if the object doesn't have a native property by this name.
72
    // Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
73
    // the native property slots manually.
74
    PropertySlot slot { this, PropertySlot::InternalMethodType::GetOwnProperty };
75
76
    JSValue prototype = this->getPrototypeDirect();
77
    if (prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))
78
        return false;
79
80
    auto stringValue = convert<IDLDOMString>(*state, value);
81
    RETURN_IF_EXCEPTION(scope, true);
82
83
    auto setItemResult = wrapped().setItem(propertyNameToString(propertyName), stringValue);
84
    if (setItemResult.hasException()) {
85
        propagateException(*state, scope, setItemResult.releaseException());
86
        return true;
87
    }
88
89
    putResult = true;
90
    return true;
91
}
92
93
} // namespace WebCore
63
} // namespace WebCore
- Source/WebCore/bindings/scripts/CodeGeneratorJS.pm -331 / +528 lines
Lines 406-548 sub ShouldUseGlobalObjectPrototype Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec1
406
406
407
sub GenerateIndexedGetter
407
sub GenerateIndexedGetter
408
{
408
{
409
    my ($interface, $indexedGetterOperation) = @_;
409
    my ($outputArray, $indent, $interface, $indexedGetterOperation) = @_;
410
410
    
411
    my @output = ();
412
413
    my @attributes = ();
411
    my @attributes = ();
414
    push(@attributes, "ReadOnly") if !$interface->extendedAttributes->{CustomNamedSetter};
412
    push(@attributes, "ReadOnly") if !GetIndexedSetterOperation($interface) && !$interface->extendedAttributes->{CustomNamedSetter};
415
413
416
    my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0");
414
    my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0");
417
415
418
    my $indexedGetterFunctionName = $indexedGetterOperation->name || "item";
416
    my $indexedGetterFunctionName = $indexedGetterOperation->extendedAttributes->{ImplementedAs} || $indexedGetterOperation->name || "item";
419
    my $nativeToJSConversion = NativeToJSValueUsingPointers($indexedGetterOperation, $interface, "thisObject->wrapped().${indexedGetterFunctionName}(index)", "*thisObject->globalObject()");
417
    my $nativeToJSConversion = NativeToJSValueUsingPointers($indexedGetterOperation, $interface, "thisObject->wrapped().${indexedGetterFunctionName}(index)", "*thisObject->globalObject()");
420
418
421
    push(@output, "        slot.setValue(thisObject, ${attributeString}, ${nativeToJSConversion});\n");
419
    push(@$outputArray, $indent . "slot.setValue(thisObject, ${attributeString}, ${nativeToJSConversion});\n");
422
    push(@output, "        return true;\n");
420
    push(@$outputArray, $indent . "return true;\n");
423
424
    return @output;
425
}
421
}
426
422
427
sub GenerateNamedGetter
423
sub GenerateNamedGetter
428
{
424
{
429
    my ($interface, $namedGetterOperation) = @_;
425
    my ($outputArray, $indent, $interface, $namedGetterOperation) = @_;
430
431
    my @output = ();
432
426
433
    my @attributes = ();
427
    my @attributes = ();
434
    push(@attributes, "ReadOnly") if !$interface->extendedAttributes->{CustomNamedSetter};
428
    push(@attributes, "ReadOnly") if !GetNamedSetterOperation($interface) && !$interface->extendedAttributes->{CustomNamedSetter};
435
    push(@attributes, "DontEnum") if $interface->extendedAttributes->{LegacyUnenumerableNamedProperties};
429
    push(@attributes, "DontEnum") if $interface->extendedAttributes->{LegacyUnenumerableNamedProperties};
436
430
437
    my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0");
431
    my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0");
438
432
439
    if ($interface->extendedAttributes->{CustomNamedGetter}) {
433
    if ($interface->extendedAttributes->{CustomNamedGetter}) {
440
        push(@output, "        JSValue value;\n");
434
        push(@$outputArray, $indent . "JSValue value;\n");
441
        push(@output, "        if (thisObject->nameGetter(state, propertyName, value)) {\n");
435
        push(@$outputArray, $indent . "if (thisObject->nameGetter(state, propertyName, value)) {\n");
442
        push(@output, "            slot.setValue(thisObject, ${attributeString}, value);\n");
436
        push(@$outputArray, $indent . "    slot.setValue(thisObject, ${attributeString}, value);\n");
443
    } else {
437
    } else {
444
        my $namedGetterFunctionName = $namedGetterOperation->extendedAttributes->{ImplementedAs} || $namedGetterOperation->name || "namedItem";
438
        my $namedGetterFunctionName = $namedGetterOperation->extendedAttributes->{ImplementedAs} || $namedGetterOperation->name || "namedItem";
445
        my $itemVariable = "item";
439
        my $itemVariable = "item";
446
        push(@output, "        auto item = thisObject->wrapped().${namedGetterFunctionName}(propertyNameToAtomicString(propertyName));\n");
440
        push(@$outputArray, $indent . "auto item = thisObject->wrapped().${namedGetterFunctionName}(propertyNameToAtomicString(propertyName));\n");
447
441
448
        if ($namedGetterOperation->extendedAttributes->{MayThrowException}) {
442
        if ($namedGetterOperation->extendedAttributes->{MayThrowException}) {
449
            push(@output, "        if (item.hasException()) {\n");
443
            push(@$outputArray, $indent . "if (item.hasException()) {\n");
450
            push(@output, "            auto throwScope = DECLARE_THROW_SCOPE(state->vm());\n");
444
            push(@$outputArray, $indent . "    auto throwScope = DECLARE_THROW_SCOPE(state->vm());\n");
451
            push(@output, "            propagateException(*state, throwScope, item.releaseException());\n");
445
            push(@$outputArray, $indent . "    propagateException(*state, throwScope, item.releaseException());\n");
452
            push(@output, "            return true;\n");
446
            push(@$outputArray, $indent . "    return true;\n");
453
            push(@output, "        }\n\n");
447
            push(@$outputArray, $indent . "}\n\n");
454
            push(@output, "        auto itemValue = item.releaseReturnValue();\n");
448
            push(@$outputArray, $indent . "auto itemValue = item.releaseReturnValue();\n");
455
449
456
            $itemVariable = "itemValue";
450
            $itemVariable = "itemValue";
457
        }
451
        }
458
452
459
        my $IDLType = GetIDLType($interface, $namedGetterOperation->type);
453
        my $IDLType = GetIDLType($interface, $namedGetterOperation->type);
460
        push(@output, "        if (!${IDLType}::isNullValue(${itemVariable})) {\n");
461
462
        my $nativeToJSConversion = NativeToJSValueUsingPointers($namedGetterOperation, $interface, $itemVariable, "*thisObject->globalObject()", 1);
454
        my $nativeToJSConversion = NativeToJSValueUsingPointers($namedGetterOperation, $interface, $itemVariable, "*thisObject->globalObject()", 1);
463
        push(@output, "            slot.setValue(thisObject, ${attributeString}, ${nativeToJSConversion});\n");
455
        push(@$outputArray, $indent . "if (!${IDLType}::isNullValue(${itemVariable})) {\n");
456
        push(@$outputArray, $indent . "    slot.setValue(thisObject, ${attributeString}, ${nativeToJSConversion});\n");
464
    }
457
    }
465
    
458
    
466
    push(@output, "            return true;\n");
459
    push(@$outputArray, $indent . "    return true;\n");
467
    push(@output, "        }\n");
460
    push(@$outputArray, $indent . "}\n");
468
469
    return @output;
470
}
461
}
471
462
472
sub GenerateGetOwnPropertySlotBody
463
sub GenerateGetOwnPropertySlotBody
473
{
464
{
474
    my ($interface, $className, $indexedGetterOperation, $namedGetterOperation) = @_;
465
    my ($outputArray, $interface, $className) = @_;
475
466
    
476
    my @output = ();
467
    return if $interface->extendedAttributes->{CustomGetOwnPropertySlot};
477
468
    
469
    my $namedGetterOperation = GetNamedGetterOperation($interface);
470
    my $indexedGetterOperation = GetIndexedGetterOperation($interface);
471
    
478
    my $ownPropertyCheck = sub {
472
    my $ownPropertyCheck = sub {
479
        push(@output, "    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))\n");
473
        push(@$outputArray, "    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))\n");
480
        push(@output, "        return true;\n");
474
        push(@$outputArray, "        return true;\n");
481
    };
475
    };
482
476
483
    # FIXME: As per the Web IDL specification, the prototype check is supposed to skip "named properties objects":
477
    # FIXME: As per the Web IDL specification, the prototype check is supposed to skip "named properties objects":
484
    # https://heycam.github.io/webidl/#dfn-named-property-visibility
478
    # https://heycam.github.io/webidl/#dfn-named-property-visibility
485
    # https://heycam.github.io/webidl/#dfn-named-properties-object
479
    # https://heycam.github.io/webidl/#dfn-named-properties-object
486
    my $prototypeCheck = sub {
480
    my $prototypeCheck = sub {
487
        push(@output, "    JSValue proto = thisObject->getPrototypeDirect();\n");
481
        push(@$outputArray, "    JSValue proto = thisObject->getPrototypeDirect();\n");
488
        push(@output, "    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))\n");
482
        push(@$outputArray, "    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))\n");
489
        push(@output, "        return false;\n\n");
483
        push(@$outputArray, "        return false;\n\n");
490
    };
484
    };
491
485
492
    push(@output, "bool ${className}::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)\n");
486
    push(@$outputArray, "bool ${className}::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)\n");
493
    push(@output, "{\n");
487
    push(@$outputArray, "{\n");
494
    push(@output, "    auto* thisObject = jsCast<${className}*>(object);\n");
488
    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(object);\n");
495
    push(@output, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
489
    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
496
490
497
491
498
    if ($indexedGetterOperation) {
492
    if ($indexedGetterOperation) {
499
        push(@output, "    auto optionalIndex = parseIndex(propertyName);\n");
493
        push(@$outputArray, "    auto optionalIndex = parseIndex(propertyName);\n");
500
        push(@output, "    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {\n");
494
        push(@$outputArray, "    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {\n");
501
        push(@output, "        auto index = optionalIndex.value();\n");
495
        push(@$outputArray, "        auto index = optionalIndex.value();\n");
502
        push(@output, GenerateIndexedGetter($interface, $indexedGetterOperation));
496
        GenerateIndexedGetter($outputArray, "        ", $interface, $indexedGetterOperation);
503
        push(@output, "    }\n");
497
        push(@$outputArray, "    }\n");
504
    }
498
    }
505
499
506
    my $hasNamedGetter = $namedGetterOperation || $interface->extendedAttributes->{CustomNamedGetter};
500
    my $hasNamedGetter = $namedGetterOperation || $interface->extendedAttributes->{CustomNamedGetter};
507
    if ($hasNamedGetter) {
501
    if ($hasNamedGetter) {
508
        if (!$interface->extendedAttributes->{OverrideBuiltins}) {
502
        if (!$codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins")) {
509
            &$ownPropertyCheck();
503
            &$ownPropertyCheck();
510
            &$prototypeCheck();
504
            &$prototypeCheck();
511
        }
505
        }
512
        if ($indexedGetterOperation) {
506
        if ($indexedGetterOperation) {
513
            push(@output, "    if (!optionalIndex && thisObject->classInfo() == info() && !propertyName.isSymbol()) {\n");
507
            push(@$outputArray, "    if (!optionalIndex && thisObject->classInfo() == info() && !propertyName.isSymbol()) {\n");
514
        } else {
508
        } else {
515
            push(@output, "    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {\n");
509
            push(@$outputArray, "    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {\n");
516
        }
510
        }
517
        push(@output, GenerateNamedGetter($interface, $namedGetterOperation));
511
        GenerateNamedGetter($outputArray, "        ", $interface, $namedGetterOperation);
518
        push(@output, "    }\n");
512
        push(@$outputArray, "    }\n");
519
    }
513
    }
520
514
521
    if ($interface->extendedAttributes->{JSCustomGetOwnPropertySlotAndDescriptor}) {
515
    if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
522
        push(@output, "    if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n");
516
        push(@$outputArray, "    if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n");
523
        push(@output, "        return true;\n");
517
        push(@$outputArray, "        return true;\n");
524
    }
518
    }
525
519
526
    if (!$hasNamedGetter || $interface->extendedAttributes->{OverrideBuiltins}) {
520
    if (!$hasNamedGetter || $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins")) {
527
        &$ownPropertyCheck();
521
        &$ownPropertyCheck();
528
    }
522
    }
529
523
530
    push(@output, "    return false;\n");
524
    push(@$outputArray, "    return false;\n");
531
    push(@output, "}\n\n");
525
    push(@$outputArray, "}\n\n");
532
533
    return @output;
534
}
526
}
535
527
536
sub GenerateGetOwnPropertySlotBodyByIndex
528
sub GenerateGetOwnPropertySlotBodyByIndex
537
{
529
{
538
    my ($interface, $className, $indexedGetterOperation, $namedGetterOperation) = @_;
530
    my ($outputArray, $interface, $className) = @_;
539
531
    
540
    my @output = ();
532
    return if $interface->extendedAttributes->{CustomGetOwnPropertySlotByIndex};
541
533
    
542
    push(@output, "bool ${className}::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)\n");
534
    my $namedGetterOperation = GetNamedGetterOperation($interface);
543
    push(@output, "{\n");
535
    my $indexedGetterOperation = GetIndexedGetterOperation($interface);
544
    push(@output, "    auto* thisObject = jsCast<${className}*>(object);\n");
536
    
545
    push(@output, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
537
    push(@$outputArray, "bool ${className}::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)\n");
538
    push(@$outputArray, "{\n");
539
    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(object);\n");
540
    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
546
    
541
    
547
    # Sink the int-to-string conversion that happens when we create a PropertyName
542
    # Sink the int-to-string conversion that happens when we create a PropertyName
548
    # to the point where we actually need it.
543
    # to the point where we actually need it.
Lines 551-605 sub GenerateGetOwnPropertySlotBodyByInde Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec2
551
        if ($generatedPropertyName) {
546
        if ($generatedPropertyName) {
552
            return;
547
            return;
553
        }
548
        }
554
        push(@output, "    Identifier propertyName = Identifier::from(state, index);\n");
549
        push(@$outputArray, "    Identifier propertyName = Identifier::from(state, index);\n");
555
        $generatedPropertyName = 1;
550
        $generatedPropertyName = 1;
556
    };
551
    };
557
    
552
    
558
    if ($indexedGetterOperation) {
553
    if ($indexedGetterOperation) {
559
        push(@output, "    if (LIKELY(index < thisObject->wrapped().length())) {\n");
554
        push(@$outputArray, "    if (LIKELY(index < thisObject->wrapped().length())) {\n");
560
        push(@output, GenerateIndexedGetter($interface, $indexedGetterOperation));
555
        GenerateIndexedGetter($outputArray, "        ", $interface, $indexedGetterOperation);
561
        push(@output, "    }\n");
556
        push(@$outputArray, "    }\n");
562
    }
557
    }
563
558
564
    # Indexing an object with an integer that is not a supported property index should not call the named property getter.
559
    # Indexing an object with an integer that is not a supported property index should not call the named property getter.
565
    # https://heycam.github.io/webidl/#idl-indexed-properties
560
    # https://heycam.github.io/webidl/#idl-indexed-properties
566
    if (!$indexedGetterOperation && ($namedGetterOperation || $interface->extendedAttributes->{CustomNamedGetter})) {
561
    if (!$indexedGetterOperation && ($namedGetterOperation || $interface->extendedAttributes->{CustomNamedGetter})) {
567
        &$propertyNameGeneration();
562
        &$propertyNameGeneration();
568
        push(@output, "    if (thisObject->classInfo() == info()) {\n");
563
        push(@$outputArray, "    if (thisObject->classInfo() == info()) {\n");
569
        push(@output, GenerateNamedGetter($interface, $namedGetterOperation));
564
        GenerateNamedGetter($outputArray, "        ", $interface, $namedGetterOperation);
570
        push(@output, "    }\n");
565
        push(@$outputArray, "    }\n");
571
    }
566
    }
572
567
573
    if ($interface->extendedAttributes->{JSCustomGetOwnPropertySlotAndDescriptor}) {
568
    if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
574
        &$propertyNameGeneration();
569
        &$propertyNameGeneration();
575
        push(@output, "    if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n");
570
        push(@$outputArray, "    if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n");
576
        push(@output, "        return true;\n");
571
        push(@$outputArray, "        return true;\n");
577
    }
572
    }
578
573
579
    push(@output, "    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);\n");
574
    push(@$outputArray, "    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);\n");
580
    push(@output, "}\n\n");
575
    push(@$outputArray, "}\n\n");
581
582
    return @output;
583
}
576
}
584
577
578
# https://heycam.github.io/webidl/#legacy-platform-object-property-enumeration
585
sub GenerateGetOwnPropertyNames
579
sub GenerateGetOwnPropertyNames
586
{
580
{
587
    my ($interface, $className, $indexedGetterOperation, $namedGetterOperation) = @_;
581
    my ($outputArray, $interface, $className) = @_;
588
582
    
589
    my @output = ();
583
    return if $interface->extendedAttributes->{CustomEnumerateProperty};
590
584
    
591
    # Property enumeration - https://heycam.github.io/webidl/#legacy-platform-object-property-enumeration
585
    my $namedGetterOperation = GetNamedGetterOperation($interface);
592
586
    my $indexedGetterOperation = GetIndexedGetterOperation($interface);
593
    push(@implContent, "void ${className}::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)\n");
587
    
594
    push(@implContent, "{\n");
588
    push(@$outputArray, "void ${className}::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)\n");
595
    push(@implContent, "    auto* thisObject = jsCast<${className}*>(object);\n");
589
    push(@$outputArray, "{\n");
596
    push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
590
    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(object);\n");
591
    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
597
592
598
    # 1. If the object supports indexed properties, then the object’s supported
593
    # 1. If the object supports indexed properties, then the object’s supported
599
    #    property indices are enumerated first, in numerical order.
594
    #    property indices are enumerated first, in numerical order.
600
    if ($indexedGetterOperation) {
595
    if ($indexedGetterOperation) {
601
        push(@implContent, "    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)\n");
596
        push(@$outputArray, "    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)\n");
602
        push(@implContent, "        propertyNames.add(Identifier::from(state, i));\n");
597
        push(@$outputArray, "        propertyNames.add(Identifier::from(state, i));\n");
603
    }
598
    }
604
599
605
    # 2. If the object supports named properties and doesn’t implement an interface
600
    # 2. If the object supports named properties and doesn’t implement an interface
Lines 609-733 sub GenerateGetOwnPropertyNames Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec3
609
    #    the definition of the set of supported property names.
604
    #    the definition of the set of supported property names.
610
    if ($namedGetterOperation) {
605
    if ($namedGetterOperation) {
611
        if (!$interface->extendedAttributes->{LegacyUnenumerableNamedProperties}) {
606
        if (!$interface->extendedAttributes->{LegacyUnenumerableNamedProperties}) {
612
            push(@implContent, "    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())\n");
607
            push(@$outputArray, "    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())\n");
613
            push(@implContent, "        propertyNames.add(Identifier::fromString(state, propertyName));\n");
608
            push(@$outputArray, "        propertyNames.add(Identifier::fromString(state, propertyName));\n");
614
        } else {
609
        } else {
615
            push(@implContent, "    if (mode.includeDontEnumProperties()) {\n");
610
            push(@$outputArray, "    if (mode.includeDontEnumProperties()) {\n");
616
            push(@implContent, "        for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())\n");
611
            push(@$outputArray, "        for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())\n");
617
            push(@implContent, "            propertyNames.add(Identifier::fromString(state, propertyName));\n");
612
            push(@$outputArray, "            propertyNames.add(Identifier::fromString(state, propertyName));\n");
618
            push(@implContent, "    }\n");
613
            push(@$outputArray, "    }\n");
619
        }
614
        }
620
    }
615
    }
616
    
621
    # 3. Finally, any enumerable own properties or properties from the object’s
617
    # 3. Finally, any enumerable own properties or properties from the object’s
622
    #    prototype chain are then enumerated, in no defined order.
618
    #    prototype chain are then enumerated, in no defined order.
623
    push(@implContent, "    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);\n");
619
    push(@$outputArray, "    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);\n");
624
    push(@implContent, "}\n\n");
620
    push(@$outputArray, "}\n\n");
625
626
    return @output;
627
}
621
}
628
622
629
sub GeneratePut
623
# https://heycam.github.io/webidl/#invoke-indexed-setter
624
sub GenerateInvokeIndexedPropertySetter
630
{
625
{
631
    my ($interface, $className, $indexedSetterOperation, $namedSetterOperation) = @_;
626
    my ($outputArray, $indent, $interface, $indexedSetterOperation, $indexExpression, $value) = @_;
632
627
    
633
    assert("Named setters are not supported.") if $namedSetterOperation;
628
    # The second argument of the indexed setter operation is the argument being converted.
629
    my $argument = @{$indexedSetterOperation->arguments}[1];
630
    my $nativeValue = JSValueToNative($interface, $argument, $value, $indexedSetterOperation->extendedAttributes->{Conditional}, "state", "*state", "thisObject", "", "");
631
    
632
    push(@$outputArray, $indent . "auto throwScope = DECLARE_THROW_SCOPE(state->vm());\n");
633
    push(@$outputArray, $indent . "auto nativeValue = ${nativeValue};\n");
634
    push(@$outputArray, $indent . "RETURN_IF_EXCEPTION(throwScope, true);\n");
635
    
636
    my $indexedSetterFunctionName = $indexedSetterOperation->name || "setItem";
637
    my $nativeValuePassExpression = PassArgumentExpression("nativeValue", $argument);
638
    my $functionString = "thisObject->wrapped().${indexedSetterFunctionName}(${indexExpression}, ${nativeValuePassExpression})";
639
    $functionString = "propagateException(*state, throwScope, ${functionString})" if NeedsExplicitPropagateExceptionCall($indexedSetterOperation);
640
    
641
    push(@$outputArray, $indent . $functionString . ";\n");
642
}
634
643
635
    my @output = ();
644
# https://heycam.github.io/webidl/#invoke-named-setter
645
sub GenerateInvokeNamedPropertySetter
646
{
647
    my ($outputArray, $indent, $interface, $namedSetterOperation, $value) = @_;
648
    
649
    my $argument = @{$namedSetterOperation->arguments}[1];
650
    my $nativeValue = JSValueToNative($interface, $argument, $value, $namedSetterOperation->extendedAttributes->{Conditional}, "state", "*state", "thisObject", "", "");
651
    
652
    push(@$outputArray, $indent . "auto throwScope = DECLARE_THROW_SCOPE(state->vm());\n");
653
    push(@$outputArray, $indent . "auto nativeValue = ${nativeValue};\n");
654
    push(@$outputArray, $indent . "RETURN_IF_EXCEPTION(throwScope, true);\n");
655
    
656
    my $namedSetterFunctionName = $namedSetterOperation->name || "setNamedItem";
657
    my $nativeValuePassExpression = PassArgumentExpression("nativeValue", $argument);
658
    my $functionString = "thisObject->wrapped().${namedSetterFunctionName}(propertyNameToString(propertyName), ${nativeValuePassExpression})";
659
    $functionString = "propagateException(*state, throwScope, ${functionString})" if NeedsExplicitPropagateExceptionCall($namedSetterOperation);
660
    
661
    push(@$outputArray, $indent . $functionString . ";\n");
662
}
636
663
637
    push(@output, "bool ${className}::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");
664
sub GeneratePut
638
    push(@output, "{\n");
665
{
639
    push(@output, "    auto* thisObject = jsCast<${className}*>(cell);\n");
666
    my ($outputArray, $interface, $className) = @_;
640
    push(@output, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
667
    
641
    
668
    return if $interface->extendedAttributes->{CustomPutFunction};
642
    if ($indexedSetterOperation || $interface->extendedAttributes->{CustomIndexedSetter}) {
669
    
643
        if ($interface->extendedAttributes->{CustomIndexedSetter}) {
670
    my $namedSetterOperation = GetNamedSetterOperation($interface);
644
            push(@output, "    if (auto index = parseIndex(propertyName)) {\n");
671
    my $indexedSetterOperation = GetIndexedSetterOperation($interface);
645
            push(@output, "        thisObject->indexSetter(state, index.value(), value);\n");
672
    
646
            push(@output, "        return true;\n");
673
    push(@$outputArray, "bool ${className}::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)\n");
647
            push(@output, "    }\n");
674
    push(@$outputArray, "{\n");
648
        } else {
675
    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(cell);\n");
649
            # The second argument of the indexed setter operation is the argument being converted.
676
    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n");
650
            my $argument = @{$indexedSetterOperation->arguments}[1];
677
    
651
            my $nativeValue = JSValueToNative($interface, $argument, "value", $indexedSetterOperation->extendedAttributes->{Conditional}, "state", "*state", "thisObject", "", "");
678
    if (($namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions}) || ($indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions})) {
652
679
        push(@$outputArray, "    CustomElementReactionStack customElementReactionStack;\n\n");
653
            push(@output, "    if (auto index = parseIndex(propertyName)) {\n");
680
        AddToImplIncludes("CustomElementReactionQueue.h");
654
            push(@output, "        auto throwScope = DECLARE_THROW_SCOPE(state->vm());\n");
681
    }
655
            push(@output, "        auto nativeValue = ${nativeValue};\n");
682
    
656
            push(@output, "        RETURN_IF_EXCEPTION(throwScope, true);\n");
683
    if ($indexedSetterOperation) {
657
684
        push(@$outputArray, "    if (auto index = parseIndex(propertyName)) {\n");
658
            my $indexedSetterFunctionName = $indexedSetterOperation->name || "setItem";
685
        
659
            my $functionString = "${indexedSetterFunctionName}(index, WTFMove(nativeValue))";
686
        GenerateInvokeIndexedPropertySetter($outputArray, "        ", $interface, $indexedSetterOperation, "index.value()", "value");
660
            $functionString = "propagateException(*state, throwScope, ${functionString})" if NeedsExplicitPropagateExceptionCall($indexedSetterOperation);
687
        
661
688
        push(@$outputArray, "        return true;\n");
662
            push(@output, "        ${functionString};\n");
689
        push(@$outputArray, "    }\n\n");
663
            push(@output, "        return true;\n");
690
    }
664
            push(@output, "    }\n");
691
    
692
    if ($namedSetterOperation) {
693
        # FIMXE: We need a more comprehensive story for Symbols.
694
        push(@$outputArray, "    if (!propertyName.isSymbol()) {\n");
695
        
696
        my $additionalIndent = "";
697
        
698
        my $overrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins");
699
        if (!$overrideBuiltins) {
700
            push(@$outputArray, "        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };\n");
701
            push(@$outputArray, "        JSValue prototype = thisObject->getPrototypeDirect();\n");
702
            push(@$outputArray, "        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {\n");
703
            $additionalIndent .= "    ";
665
        }
704
        }
705
        
706
        GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . "        ", $interface, $namedSetterOperation, "value");
707
        push(@$outputArray, $additionalIndent . "        return true;\n");
708
        
709
        if (!$overrideBuiltins) {
710
            push(@$outputArray, "        }\n");
711
        }
712
        
713
        push(@$outputArray, "    }\n\n");
666
    }
714
    }
667
    
715
    
716
    assert("Using both a named property setter and [CustomNamedSetter] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{CustomNamedSetter};
668
    if ($interface->extendedAttributes->{CustomNamedSetter}) {
717
    if ($interface->extendedAttributes->{CustomNamedSetter}) {
669
        push(@output, "    bool putResult = false;\n");
718
        push(@$outputArray, "    bool putResult = false;\n");
670
        push(@output, "    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");
719
        push(@$outputArray, "    if (thisObject->putDelegate(state, propertyName, value, putPropertySlot, putResult))\n");
671
        push(@output, "        return putResult;\n");
720
        push(@$outputArray, "        return putResult;\n\n");
672
    }
721
    }
673
722
    
674
    push(@output, "    return Base::put(thisObject, state, propertyName, value, slot);\n");
723
    push(@$outputArray, "    return Base::put(thisObject, state, propertyName, value, putPropertySlot);\n");
675
    push(@output, "}\n\n");
724
    push(@$outputArray, "}\n\n");
676
677
    return @output;
678
}
725
}
679
726
680
sub GeneratePutByIndex
727
sub GeneratePutByIndex
681
{
728
{
682
    my ($interface, $className, $indexedSetterOperation, $namedSetterOperation) = @_;
729
    my ($outputArray, $interface, $className) = @_;
683
730
    
684
    assert("Named setters are not supported.") if $namedSetterOperation;
731
    return if $interface->extendedAttributes->{CustomPutFunction};
685
732
    
686
    my @output = ();
733
    my $namedSetterOperation = GetNamedSetterOperation($interface);
687
734
    my $indexedSetterOperation = GetIndexedSetterOperation($interface);
688
    push(@output, "bool ${className}::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)\n");
735
    
689
    push(@output, "{\n");
736
    my $overrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins");
690
    push(@output, "    auto* thisObject = jsCast<${className}*>(cell);\n");
737
    my $ellidesCallsToBase = ($namedSetterOperation && $overrideBuiltins) && !$interface->extendedAttributes->{CustomNamedSetter};
691
    push(@output, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
738
    
692
739
    push(@$outputArray, "bool ${className}::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool" . (!$ellidesCallsToBase ? " shouldThrow" : "") . ")\n");
693
    if ($indexedSetterOperation || $interface->extendedAttributes->{CustomIndexedSetter}) {
740
    push(@$outputArray, "{\n");
694
        if ($interface->extendedAttributes->{CustomIndexedSetter}) {
741
    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(cell);\n");
695
            push(@output, "    if (LIKELY(index <= MAX_ARRAY_INDEX)) {\n");
742
    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n");
696
            push(@output, "        thisObject->indexSetter(state, index, value);\n");
743
    
697
            push(@output, "        return true;\n");
744
    if (($namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions}) || ($indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions})) {
698
            push(@output, "    }\n");
745
        push(@$outputArray, "    CustomElementReactionStack customElementReactionStack;\n\n");
699
        } else {
746
        AddToImplIncludes("CustomElementReactionQueue.h");
700
            # The second argument of the indexed setter operation is the argument being converted.
747
    }
701
            my $argument = @{$indexedSetterOperation->arguments}[1];
748
    
702
            my $nativeValue = JSValueToNative($interface, $argument, "value", $indexedSetterOperation->extendedAttributes->{Conditional}, "state", "*state", "thisObject", "", "");
749
    if ($indexedSetterOperation ) {
703
750
        push(@$outputArray, "    if (LIKELY(index <= MAX_ARRAY_INDEX)) {\n");
704
            push(@output, "    if (LIKELY(index <= MAX_ARRAY_INDEX)) {\n");
751
        
705
            push(@output, "        auto throwScope = DECLARE_THROW_SCOPE(state->vm());\n");
752
        GenerateInvokeIndexedPropertySetter($outputArray, "        ", $interface, $indexedSetterOperation, "index", "value");
706
            push(@output, "        auto nativeValue = ${nativeValue};\n");
753
        
707
            push(@output, "        RETURN_IF_EXCEPTION(throwScope, true);\n");
754
        push(@$outputArray, "        return true;\n");
708
755
        push(@$outputArray, "    }\n\n");
709
            my $indexedSetterFunctionName = $indexedSetterOperation->name || "setItem";
756
    }
710
            my $functionString = "${indexedSetterFunctionName}(index, WTFMove(nativeValue))";
757
    
711
            $functionString = "propagateException(*state, throwScope, ${functionString})" if NeedsExplicitPropagateExceptionCall($indexedSetterOperation);
758
    if ($namedSetterOperation) {
712
759
        push(@$outputArray, "    Identifier propertyName = Identifier::from(state, index);\n");
713
            push(@output, "        ${functionString};\n");
760
                
714
            push(@output, "        return true;\n");
761
        my $additionalIndent = "";
715
            push(@output, "    }\n");
762
        if (!$overrideBuiltins) {
763
            push(@$outputArray, "    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };\n");
764
            push(@$outputArray, "    JSValue prototype = thisObject->getPrototypeDirect();\n");
765
            push(@$outputArray, "    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {\n");
766
            $additionalIndent .= "    ";
767
        }
768
        
769
        GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . "    ", $interface, $namedSetterOperation, "value");
770
        push(@$outputArray, $additionalIndent . "    return true;\n");
771
        
772
        if (!$overrideBuiltins) {
773
            push(@$outputArray, "    }\n\n");
716
        }
774
        }
717
    }
775
    }
718
776
    
777
    assert("Using both a named property setter and [CustomNamedSetter] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{CustomNamedSetter};
719
    if ($interface->extendedAttributes->{CustomNamedSetter}) {
778
    if ($interface->extendedAttributes->{CustomNamedSetter}) {
720
        push(@output, "    Identifier propertyName = Identifier::from(state, index);\n");
779
        push(@$outputArray, "    Identifier propertyName = Identifier::from(state, index);\n");
721
        push(@output, "    PutPropertySlot slot(thisObject, shouldThrow);\n");
780
        push(@$outputArray, "    PutPropertySlot slot(thisObject, shouldThrow);\n");
722
        push(@output, "    bool putResult = false;\n");
781
        push(@$outputArray, "    bool putResult = false;\n");
723
        push(@output, "    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");
782
        push(@$outputArray, "    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");
724
        push(@output, "        return putResult;\n");
783
        push(@$outputArray, "        return putResult;\n\n");
725
    }
784
    }
785
    
786
    if (!$ellidesCallsToBase) {
787
        push(@$outputArray, "    return Base::putByIndex(cell, state, index, value, shouldThrow);\n");
788
    }
789
    
790
    push(@$outputArray, "}\n\n");
791
}
726
792
727
    push(@output, "    return Base::putByIndex(cell, state, index, value, shouldThrow);\n");
793
sub GenerateIsUnforgeablePropertyName
728
    push(@output, "}\n\n");
794
{
795
    my ($outputArray, $interface) = @_;
796
    
797
    my @unforgeablePropertyNames = ();
798
    foreach my $property (@{$interface->attributes}, @{$interface->operations}) {
799
        next if $property->isStatic;
800
        
801
        if (IsUnforgeable($interface, $property)) {
802
            push (@unforgeablePropertyNames, $property->name);
803
        }
804
    }
805
    
806
    return 0 if (scalar(@unforgeablePropertyNames) == 0);
807
    
808
    my $condition = join(" || ", map { "propertyName == \"" . $_ . "\"" } @unforgeablePropertyNames);
809
    
810
    push(@$outputArray, "static bool isUnforgeablePropertyName(PropertyName propertyName)\n");
811
    push(@$outputArray, "{\n");
812
    push(@$outputArray, "    return ${condition};\n");
813
    push(@$outputArray, "}\n\n");
814
    
815
    return 1;
816
}
729
817
730
    return @output;
818
# https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty
819
sub GenerateDefineOwnProperty
820
{
821
    my ($outputArray, $interface, $className) = @_;
822
    
823
    return if $interface->extendedAttributes->{CustomDefineOwnProperty};
824
    
825
    my $namedSetterOperation = GetNamedSetterOperation($interface);
826
    my $indexedSetterOperation = GetIndexedSetterOperation($interface);
827
    
828
    return if !$namedSetterOperation && !$indexedSetterOperation;
829
    
830
    push(@$outputArray, "bool ${className}::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)\n");
831
    push(@$outputArray, "{\n");
832
    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(object);\n");
833
    push(@$outputArray, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n");
834
    
835
    if (($namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions}) || ($indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions})) {
836
        push(@$outputArray, "    CustomElementReactionStack customElementReactionStack;\n\n");
837
        AddToImplIncludes("CustomElementReactionQueue.h");
838
    }
839
    
840
    # 1. If O supports indexed properties and P is an array index property name, then:
841
    if (GetIndexedGetterOperation($interface)) {
842
        push(@$outputArray, "    if (auto index = parseIndex(propertyName)) {\n");
843
        
844
        # NOTE: The numbers are out of order because there is no reason doing steps 1, 3, and 4 if there
845
        # is no indexed property setter.
846
        
847
        if (!$indexedSetterOperation) {
848
            # 2. If O does not implement an interface with an indexed property setter, then return false.
849
            push(@$outputArray, "        return false;\n");
850
        } else {
851
            # 1. If the result of calling IsDataDescriptor(Desc) is false, then return false.
852
            push(@$outputArray, "        if (!propertyDescriptor.isDataDescriptor())\n");
853
            push(@$outputArray, "            return false;\n");
854
            
855
            # 3. Invoke the indexed property setter with P and Desc.[[Value]].
856
            GenerateInvokeIndexedPropertySetter($outputArray, "        ", $interface, $indexedSetterOperation, "index.value()", "propertyDescriptor.value()");
857
            
858
            # 4. Return true.
859
            push(@$outputArray, "        return true;\n");
860
        }
861
        push(@$outputArray, "    }\n\n");
862
    }
863
    
864
    # 2. If O supports named properties, O does not implement an interface with the [Global] or [PrimaryGlobal]
865
    #    extended attribute and P is not an unforgeable property name of O, then:
866
    if (GetNamedGetterOperation($interface) && !IsGlobalOrPrimaryGlobalInterface($interface)) {
867
        # FIMXE: We need a more comprehensive story for Symbols.
868
        push(@$outputArray, "    if (!propertyName.isSymbol()) {\n");
869
        
870
        my $additionalIndent = "";
871
        
872
        my $hasUnforgableProperties = GenerateIsUnforgeablePropertyName($outputArray, $interface);
873
        if ($hasUnforgableProperties) {
874
            push(@$outputArray, "        if (!isUnforgeablePropertyName(propertyName)) {\n");
875
            $additionalIndent .= "    ";
876
        }
877
        
878
        # 1. Let creating be true if P is not a supported property name, and false otherwise.
879
        # NOTE: This step is strength reduced into the only use of 'creating' in step 2.2.1
880
        
881
        # 2. If O implements an interface with the [OverrideBuiltins] extended attribute or O
882
        #    does not have an own property named P, then:
883
        my $overrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins");
884
        if (!$overrideBuiltins) {
885
            # FIXME: Is Base::getOwnPropertySlot the right function to call? Is there a function that will
886
            #        only look at the actual properties, and not call into our implementation of the
887
            #        [[GetOwnProperty]] hook?
888
            push(@$outputArray, $additionalIndent. "        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };\n");
889
            push(@$outputArray, $additionalIndent. "        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {\n");
890
            $additionalIndent .= "    ";
891
        }
892
        if (!$namedSetterOperation) {
893
            # 2.1. If creating is false and O does not implement an interface with a named property setter, then return false.
894
            push(@$outputArray, $additionalIndent . "        if (thisObject->wrapped().isSupportedPropertyName(propertyNameToString(propertyName)))\n");
895
            push(@$outputArray, $additionalIndent . "            return false;\n");
896
        } else {
897
            # 2.2. If O implements an interface with a named property setter, then:
898
            
899
            # 2.2.1. If the result of calling IsDataDescriptor(Desc) is false, then return false.
900
            push(@$outputArray, $additionalIndent . "        if (!propertyDescriptor.isDataDescriptor())\n");
901
            push(@$outputArray, $additionalIndent . "            return false;\n");
902
            
903
            # 2.2.2. Invoke the named property setter with P and Desc.[[Value]].
904
            GenerateInvokeNamedPropertySetter($outputArray, $additionalIndent . "        ", $interface, $namedSetterOperation, "propertyDescriptor.value()");
905
            
906
            # 2.2.3. Return true.
907
            push(@$outputArray, $additionalIndent . "        return true;\n");
908
        }
909
        
910
        if (!$overrideBuiltins) {
911
            push(@$outputArray, $additionalIndent . "    }\n");
912
        }
913
        
914
        if ($hasUnforgableProperties) {
915
            push(@$outputArray, "        }\n");
916
        }
917
        
918
        # Close the !propertyName.isSymbol() condition.
919
        push(@$outputArray, "    }\n\n");
920
    }
921
    
922
    push(@$outputArray, "    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;\n");
923
        
924
    # 3. If O does not implement an interface with the [Global] or [PrimaryGlobal] extended attribute,
925
    #    then set Desc.[[Configurable]] to true.
926
    if (!IsGlobalOrPrimaryGlobalInterface($interface)) {
927
        push(@$outputArray, "    newPropertyDescriptor.setConfigurable(true);\n");
928
    }
929
    
930
    # 4. Return OrdinaryDefineOwnProperty(O, P, Desc).
931
    # FIXME: Does this do the same thing?
932
    push(@$outputArray, "    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);\n");
933
    
934
    push(@$outputArray, "}\n\n");
731
}
935
}
732
936
733
sub GenerateDeletePropertyCommon
937
sub GenerateDeletePropertyCommon
Lines 745-751 sub GenerateDeletePropertyCommon Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec4
745
    assert("Named property deleters are not allowed on global object interfaces.") if IsGlobalOrPrimaryGlobalInterface($interface);
949
    assert("Named property deleters are not allowed on global object interfaces.") if IsGlobalOrPrimaryGlobalInterface($interface);
746
950
747
    AddToImplIncludes("JSDOMAbstractOperations.h", $conditional);
951
    AddToImplIncludes("JSDOMAbstractOperations.h", $conditional);
748
    my $overrideBuiltin = $interface->extendedAttributes->{OverrideBuiltins} ? "true" : "false";
952
    my $overrideBuiltin = $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins") ? "true" : "false";
749
    push(@$outputArray, "    if (isVisibleNamedProperty<${overrideBuiltin}>(*state, thisObject, propertyName)) {\n");
953
    push(@$outputArray, "    if (isVisibleNamedProperty<${overrideBuiltin}>(*state, thisObject, propertyName)) {\n");
750
954
751
    if ($operation->extendedAttributes->{CEReactions}) {
955
    if ($operation->extendedAttributes->{CEReactions}) {
Lines 877-898 sub GenerateDeletePropertyByIndexDefinit Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec5
877
1081
878
sub GenerateNamedDeleterDefinition
1082
sub GenerateNamedDeleterDefinition
879
{
1083
{
880
    my ($outputArray, $interface, $className, $operation) = @_;
1084
    my ($outputArray, $interface, $className) = @_;
1085
    
1086
    return if $interface->extendedAttributes->{CustomDeleteProperty};
881
1087
1088
    my $namedDeleterOperation = GetNamedDeleterOperation($interface);
1089
    
882
    # This implements https://heycam.github.io/webidl/#legacy-platform-object-delete using
1090
    # This implements https://heycam.github.io/webidl/#legacy-platform-object-delete using
883
    # the deleteProperty and deletePropertyByIndex override hooks.
1091
    # the deleteProperty and deletePropertyByIndex override hooks.
884
1092
885
    assert("Named property deleters are not allowed without a corresponding named property getter.") if !GetNamedGetterOperation($interface);
1093
    assert("Named property deleters are not allowed without a corresponding named property getter.") if !GetNamedGetterOperation($interface);
886
    assert("Named property deleters are not allowed on global object interfaces.") if IsGlobalOrPrimaryGlobalInterface($interface);
1094
    assert("Named property deleters are not allowed on global object interfaces.") if IsGlobalOrPrimaryGlobalInterface($interface);
887
1095
888
    my $conditional = $operation->extendedAttributes->{Conditional};
1096
    my $conditional = $namedDeleterOperation->extendedAttributes->{Conditional};
889
    if ($conditional) {
1097
    if ($conditional) {
890
        my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
1098
        my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
891
        push(@$outputArray, "#if ${conditionalString}\n\n");;
1099
        push(@$outputArray, "#if ${conditionalString}\n\n");;
892
    }
1100
    }
893
1101
894
    GenerateDeletePropertyDefinition($outputArray, $interface, $className, $operation, $conditional);
1102
    GenerateDeletePropertyDefinition($outputArray, $interface, $className, $namedDeleterOperation, $conditional);
895
    GenerateDeletePropertyByIndexDefinition($outputArray, $interface, $className, $operation, $conditional);
1103
    GenerateDeletePropertyByIndexDefinition($outputArray, $interface, $className, $namedDeleterOperation, $conditional);
896
1104
897
    push(@implContent, "#endif\n\n") if $conditional;
1105
    push(@implContent, "#endif\n\n") if $conditional;
898
}
1106
}
Lines 1108-1121 sub GetSpecialAccessorOperationForType Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec6
1108
    return 0;
1316
    return 0;
1109
}
1317
}
1110
1318
1111
sub HasComplexGetOwnProperty
1112
{
1113
    my $interface = shift;
1114
    return $interface->extendedAttributes->{CheckSecurity}
1115
        || IsDOMGlobalObject($interface)
1116
        || InstanceOverridesGetOwnPropertySlot($interface);
1117
}
1118
1119
sub IsGlobalOrPrimaryGlobalInterface
1319
sub IsGlobalOrPrimaryGlobalInterface
1120
{
1320
{
1121
    my $interface = shift;
1321
    my $interface = shift;
Lines 1306-1312 sub InstanceOverridesGetOwnPropertySlot Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec7
1306
    my $interface = shift;
1506
    my $interface = shift;
1307
    return $interface->extendedAttributes->{CustomGetOwnPropertySlot}
1507
    return $interface->extendedAttributes->{CustomGetOwnPropertySlot}
1308
        || $interface->extendedAttributes->{CustomNamedGetter}
1508
        || $interface->extendedAttributes->{CustomNamedGetter}
1309
        || $interface->extendedAttributes->{JSCustomGetOwnPropertySlotAndDescriptor}
1509
        || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}
1510
        || GetIndexedGetterOperation($interface)
1511
        || GetNamedGetterOperation($interface);
1512
}
1513
1514
sub InstanceOverridesGetOwnPropertySlotByIndex
1515
{
1516
    my $interface = shift;
1517
    return $interface->extendedAttributes->{CustomGetOwnPropertySlotByIndex}
1518
        || $interface->extendedAttributes->{CustomNamedGetter}
1519
        || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}
1520
        || GetIndexedGetterOperation($interface)
1521
        || GetNamedGetterOperation($interface);
1522
}
1523
1524
sub InstanceOverridesGetOwnPropertyNames
1525
{
1526
    my $interface = shift;
1527
    return $interface->extendedAttributes->{CustomEnumerateProperty}
1310
        || GetIndexedGetterOperation($interface)
1528
        || GetIndexedGetterOperation($interface)
1311
        || GetNamedGetterOperation($interface);
1529
        || GetNamedGetterOperation($interface);
1312
}
1530
}
Lines 1315-1321 sub InstanceOverridesPut Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec8
1315
{
1533
{
1316
    my $interface = shift;
1534
    my $interface = shift;
1317
    return $interface->extendedAttributes->{CustomNamedSetter}
1535
    return $interface->extendedAttributes->{CustomNamedSetter}
1318
        || $interface->extendedAttributes->{CustomIndexedSetter}
1536
        || $interface->extendedAttributes->{CustomPutFunction}
1537
        || GetIndexedSetterOperation($interface)
1538
        || GetNamedSetterOperation($interface);
1539
}
1540
1541
sub InstanceOverridesDefineOwnProperty
1542
{
1543
    my $interface = shift;
1544
    return $interface->extendedAttributes->{CustomDefineOwnProperty}
1319
        || GetIndexedSetterOperation($interface)
1545
        || GetIndexedSetterOperation($interface)
1320
        || GetNamedSetterOperation($interface);
1546
        || GetNamedSetterOperation($interface);
1321
}
1547
}
Lines 1334-1354 sub PrototypeHasStaticPropertyTable Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec9
1334
    return $numConstants > 0 || PrototypePropertyCount($interface) > 0;
1560
    return $numConstants > 0 || PrototypePropertyCount($interface) > 0;
1335
}
1561
}
1336
1562
1337
sub InstanceOverridesPutImplementation
1338
{
1339
    my $interface = shift;
1340
    return $interface->extendedAttributes->{CustomNamedSetter}
1341
        || $interface->extendedAttributes->{CustomIndexedSetter};
1342
}
1343
1344
sub InstanceOverridesPutDeclaration
1345
{
1346
    my $interface = shift;
1347
    return $interface->extendedAttributes->{CustomPutFunction}
1348
        || $interface->extendedAttributes->{CustomNamedSetter}
1349
        || $interface->extendedAttributes->{CustomIndexedSetter};
1350
}
1351
1352
sub InstanceNeedsVisitChildren
1563
sub InstanceNeedsVisitChildren
1353
{
1564
{
1354
    my $interface = shift;
1565
    my $interface = shift;
Lines 1999-2005 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec10
1999
    $structureFlags{"JSC::HasStaticPropertyTable"} = 1 if InstancePropertyCount($interface) > 0;
2210
    $structureFlags{"JSC::HasStaticPropertyTable"} = 1 if InstancePropertyCount($interface) > 0;
2000
    $structureFlags{"JSC::NewImpurePropertyFiresWatchpoints"} = 1 if $interface->extendedAttributes->{NewImpurePropertyFiresWatchpoints};
2211
    $structureFlags{"JSC::NewImpurePropertyFiresWatchpoints"} = 1 if $interface->extendedAttributes->{NewImpurePropertyFiresWatchpoints};
2001
    $structureFlags{"JSC::IsImmutablePrototypeExoticObject"} = 1 if $interface->extendedAttributes->{IsImmutablePrototypeExoticObject};
2212
    $structureFlags{"JSC::IsImmutablePrototypeExoticObject"} = 1 if $interface->extendedAttributes->{IsImmutablePrototypeExoticObject};
2002
2213
    $structureFlags{"JSC::MasqueradesAsUndefined"} = 1 if $interface->extendedAttributes->{MasqueradesAsUndefined};
2214
    $structureFlags{"JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance"} = 1 if $interfaceName eq "DOMWindow";
2215
        
2003
    # Prototype
2216
    # Prototype
2004
    unless (ShouldUseGlobalObjectPrototype($interface)) {
2217
    unless (ShouldUseGlobalObjectPrototype($interface)) {
2005
        push(@headerContent, "    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);\n");
2218
        push(@headerContent, "    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);\n");
Lines 2026-2076 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec11
2026
    my $namedGetterOperation = GetNamedGetterOperation($interface);
2239
    my $namedGetterOperation = GetNamedGetterOperation($interface);
2027
    my $indexedGetterOperation = GetIndexedGetterOperation($interface);
2240
    my $indexedGetterOperation = GetIndexedGetterOperation($interface);
2028
2241
2029
    my $hasNamedGetter = $namedGetterOperation
2242
    # FIXME: Why doesn't this also include Indexed Getters, {CustomGetOwnPropertySlot} and {CustomGetOwnPropertySlotAndDescriptor}
2030
        || $interface->extendedAttributes->{CustomNamedGetter};
2243
    if ($namedGetterOperation || $interface->extendedAttributes->{CustomNamedGetter}) {
2031
2244
        if ($codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins")) {
2032
    my $hasComplexGetter = $indexedGetterOperation
2033
        || $interface->extendedAttributes->{JSCustomGetOwnPropertySlotAndDescriptor}
2034
        || $interface->extendedAttributes->{CustomGetOwnPropertySlot}
2035
        || $hasNamedGetter;
2036
2037
    if ($hasNamedGetter) {
2038
        if ($interface->extendedAttributes->{OverrideBuiltins}) {
2039
            $structureFlags{"JSC::GetOwnPropertySlotIsImpure"} = 1;
2245
            $structureFlags{"JSC::GetOwnPropertySlotIsImpure"} = 1;
2040
        } else {
2246
        } else {
2041
            $structureFlags{"JSC::GetOwnPropertySlotIsImpureForPropertyAbsence"} = 1;
2247
            $structureFlags{"JSC::GetOwnPropertySlotIsImpureForPropertyAbsence"} = 1;
2042
        }
2248
        }
2043
    }
2249
    }
2044
2250
    
2045
    my $overridesGet = InstanceOverridesGetOwnPropertySlot($interface);
2251
    # ClassInfo MethodTable declarations.
2046
    if ($overridesGet) {
2252
    
2253
    if (InstanceOverridesGetOwnPropertySlot($interface)) {
2047
        push(@headerContent, "    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n");
2254
        push(@headerContent, "    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n");
2048
        $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1;
2255
        $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1;
2049
2050
        if ($hasComplexGetter) {
2051
            push(@headerContent, "    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n");
2052
            $structureFlags{"JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero"} = 1;
2053
        }
2054
    }
2256
    }
2055
2257
    
2056
    my $overridesPut = InstanceOverridesPutDeclaration($interface);
2258
    if (InstanceOverridesGetOwnPropertySlotByIndex($interface)) {
2057
    if ($overridesPut) {
2259
        push(@headerContent, "    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n");
2260
        $structureFlags{"JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero"} = 1;
2261
    }
2262
    
2263
    # FIXME: Currently only DOMWindow needs to override the getPropertyNames family of functions, but even
2264
    #        so, it should probably be turned into an extended attribute.
2265
    if ($interfaceName eq "DOMWindow") {
2266
        push(@headerContent, "    static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2267
        push(@headerContent, "    static void getGenericPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2268
        push(@headerContent, "    static void getStructurePropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2269
        push(@headerContent, "    static uint32_t getEnumerableLength(JSC::ExecState*, JSC::JSObject*);\n");
2270
        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
2271
    }
2272
    
2273
    if (InstanceOverridesGetOwnPropertyNames($interface)) {
2274
        push(@headerContent, "    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2275
        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
2276
    }
2277
    
2278
    if (InstanceOverridesPut($interface)) {
2058
        push(@headerContent, "    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);\n");
2279
        push(@headerContent, "    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);\n");
2059
        push(@headerContent, "    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);\n");
2280
        push(@headerContent, "    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);\n");
2060
    }
2281
    }
2282
    
2283
    if (InstanceOverridesDefineOwnProperty($interface)) {
2284
        push(@headerContent, "    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);\n");
2285
    }
2061
2286
2062
    if (InstanceOverridesDelete($interface)) {
2287
    if (InstanceOverridesDelete($interface)) {
2063
        push(@headerContent, "    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);\n");
2288
        push(@headerContent, "    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);\n");
2064
        push(@headerContent, "    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);\n");
2289
        push(@headerContent, "    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);\n");
2065
    }
2290
    }
2066
2291
2067
    # LegacyCaller and custom call functions
2292
    if (InstanceOverridesCall($interface)) {
2068
    if (IsCallable($interface)) {
2069
        push(@headerContent, "    static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);\n\n");
2293
        push(@headerContent, "    static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);\n\n");
2070
        $headerIncludes{"<runtime/CallData.h>"} = 1;
2294
        $headerIncludes{"<runtime/CallData.h>"} = 1;
2071
        $structureFlags{"JSC::TypeOfShouldCallGetCallData"} = 1;
2295
        $structureFlags{"JSC::TypeOfShouldCallGetCallData"} = 1;
2072
    }
2296
    }
2073
2297
    
2298
    if ($interface->extendedAttributes->{CustomGetPrototype}) {
2299
        push (@headerContent, "    static JSC::JSValue getPrototype(JSC::JSObject*, JSC::ExecState*);\n");
2300
    }
2301
    
2302
    if ($interface->extendedAttributes->{CustomToStringName}) {
2303
        push (@headerContent, "    static String toStringName(const JSC::JSObject*, JSC::ExecState*);\n");
2304
    }
2305
    
2306
    if ($interface->extendedAttributes->{CustomPreventExtensions}) {
2307
        push(@headerContent, "    static bool preventExtensions(JSC::JSObject*, JSC::ExecState*);\n");
2308
    }
2309
    
2310
    if (InstanceNeedsEstimatedSize($interface)) {
2311
        push(@headerContent, "    static size_t estimatedSize(JSCell*);\n");
2312
    }
2313
    
2074
    if (!$hasParent) {
2314
    if (!$hasParent) {
2075
        push(@headerContent, "    static void destroy(JSC::JSCell*);\n");
2315
        push(@headerContent, "    static void destroy(JSC::JSCell*);\n");
2076
    }
2316
    }
Lines 2088-2094 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec12
2088
    }
2328
    }
2089
2329
2090
    # Structure ID
2330
    # Structure ID
2091
    $structureFlags{"JSC::ImplementsHasInstance | JSC::ImplementsDefaultHasInstance"} = 1 if $interfaceName eq "DOMWindow";
2092
    push(@headerContent, "    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)\n");
2331
    push(@headerContent, "    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)\n");
2093
    push(@headerContent, "    {\n");
2332
    push(@headerContent, "    {\n");
2094
    if (IsDOMGlobalObject($interface)) {
2333
    if (IsDOMGlobalObject($interface)) {
Lines 2104-2140 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec13
2104
    push(@headerContent, "    }\n\n");
2343
    push(@headerContent, "    }\n\n");
2105
2344
2106
    # Custom pushEventHandlerScope function
2345
    # Custom pushEventHandlerScope function
2107
    push(@headerContent, "    JSC::JSScope* pushEventHandlerScope(JSC::ExecState*, JSC::JSScope*) const;\n\n") if $interface->extendedAttributes->{JSCustomPushEventHandlerScope};
2346
    if ($interface->extendedAttributes->{CustomPushEventHandlerScope}) {
2108
2347
        push(@headerContent, "    JSC::JSScope* pushEventHandlerScope(JSC::ExecState*, JSC::JSScope*) const;\n\n");
2109
    # Custom getPropertyNames function exists on DOMWindow
2110
    if ($interfaceName eq "DOMWindow") {
2111
        push(@headerContent, "    static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2112
        push(@headerContent, "    static void getGenericPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2113
        push(@headerContent, "    static void getStructurePropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2114
        push(@headerContent, "    static uint32_t getEnumerableLength(JSC::ExecState*, JSC::JSObject*);\n");
2115
        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
2116
    }
2117
2118
    # Custom getOwnPropertyNames function
2119
    if ($interface->extendedAttributes->{CustomEnumerateProperty} || $indexedGetterOperation || $namedGetterOperation) {
2120
        push(@headerContent, "    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
2121
        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;       
2122
    }
2348
    }
2123
2124
    # Custom defineOwnProperty function
2125
    push(@headerContent, "    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);\n") if $interface->extendedAttributes->{JSCustomDefineOwnProperty};
2126
2127
    # Custom getPrototype / setPrototype functions.
2128
    push (@headerContent, "    static JSC::JSValue getPrototype(JSC::JSObject*, JSC::ExecState*);\n") if $interface->extendedAttributes->{CustomGetPrototype};
2129
2130
    # Custom toStringName function.
2131
    push (@headerContent, "    static String toStringName(const JSC::JSObject*, JSC::ExecState*);\n") if $interface->extendedAttributes->{CustomToStringName};
2132
2133
    # Custom preventExtensions function.
2134
    push(@headerContent, "    static bool preventExtensions(JSC::JSObject*, JSC::ExecState*);\n") if $interface->extendedAttributes->{CustomPreventExtensions};
2135
    
2349
    
2136
    $structureFlags{"JSC::MasqueradesAsUndefined"} = 1 if $interface->extendedAttributes->{MasqueradesAsUndefined};
2137
2138
    # Constructor object getter
2350
    # Constructor object getter
2139
    unless ($interface->extendedAttributes->{NoInterfaceObject}) {
2351
    unless ($interface->extendedAttributes->{NoInterfaceObject}) {
2140
        push(@headerContent, "    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);\n");
2352
        push(@headerContent, "    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);\n");
Lines 2142-2149 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec14
2142
    }
2354
    }
2143
2355
2144
    # Serializer function.
2356
    # Serializer function.
2145
    push(@headerContent, "    static JSC::JSObject* serialize(JSC::ExecState*, JS${interfaceName}* thisObject, JSC::ThrowScope&);\n") if $interface->serializable;
2357
    if ($interface->serializable) {
2146
2358
        push(@headerContent, "    static JSC::JSObject* serialize(JSC::ExecState*, ${className}* thisObject, JSC::ThrowScope&);\n");
2359
    }
2360
    
2147
    my $numCustomOperations = 0;
2361
    my $numCustomOperations = 0;
2148
    my $numCustomAttributes = 0;
2362
    my $numCustomAttributes = 0;
2149
2363
Lines 2193-2203 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec15
2193
            push(@headerContent, "    template<typename> static JSC::Subspace* subspaceFor(JSC::VM& vm) { return $subspaceFunc(vm); }\n");
2407
            push(@headerContent, "    template<typename> static JSC::Subspace* subspaceFor(JSC::VM& vm) { return $subspaceFunc(vm); }\n");
2194
        }
2408
        }
2195
    }
2409
    }
2196
2410
    
2197
    if (InstanceNeedsEstimatedSize($interface)) {
2198
        push(@headerContent, "    static size_t estimatedSize(JSCell*);\n");
2199
    }
2200
2201
    if ($numCustomAttributes > 0) {
2411
    if ($numCustomAttributes > 0) {
2202
        push(@headerContent, "\n    // Custom attributes\n");
2412
        push(@headerContent, "\n    // Custom attributes\n");
2203
2413
Lines 2295-2301 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec16
2295
        push(@headerContent, "    void finishCreation(JSC::VM&);\n");
2505
        push(@headerContent, "    void finishCreation(JSC::VM&);\n");
2296
    }
2506
    }
2297
2507
2298
    if ($interface->extendedAttributes->{JSCustomGetOwnPropertySlotAndDescriptor}) {
2508
    if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) {
2299
        push(@headerContent, "    bool getOwnPropertySlotDelegate(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n");
2509
        push(@headerContent, "    bool getOwnPropertySlotDelegate(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n");
2300
    }
2510
    }
2301
2511
Lines 2306-2316 sub GenerateHeader Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec17
2306
    if ($interface->extendedAttributes->{CustomNamedSetter}) {
2516
    if ($interface->extendedAttributes->{CustomNamedSetter}) {
2307
        push(@headerContent, "    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n");
2517
        push(@headerContent, "    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n");
2308
    }
2518
    }
2309
2519
    
2310
    if ($interface->extendedAttributes->{CustomIndexedSetter}) {
2311
        push(@headerContent, "    void indexSetter(JSC::ExecState*, unsigned index, JSC::JSValue);\n");
2312
    }
2313
2314
    push(@headerContent, "};\n\n");
2520
    push(@headerContent, "};\n\n");
2315
2521
2316
    if (ShouldGenerateWrapperOwnerCode($hasParent, $interface)) {
2522
    if (ShouldGenerateWrapperOwnerCode($hasParent, $interface)) {
Lines 3613-3619 sub GenerateImplementation Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec18
3613
        push(@implContent, "}\n\n");
3819
        push(@implContent, "}\n\n");
3614
    }
3820
    }
3615
3821
3616
    if ($interface->extendedAttributes->{JSCustomNamedGetterOnPrototype}) {
3822
    if ($interface->extendedAttributes->{CustomNamedGetterOnPrototype}) {
3617
        push(@implContent, "bool ${className}Prototype::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");
3823
        push(@implContent, "bool ${className}Prototype::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");
3618
        push(@implContent, "{\n");
3824
        push(@implContent, "{\n");
3619
        push(@implContent, "    auto* thisObject = jsCast<${className}Prototype*>(cell);\n");
3825
        push(@implContent, "    auto* thisObject = jsCast<${className}Prototype*>(cell);\n");
Lines 3792-3834 sub GenerateImplementation Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec19
3792
        push(@implContent, "}\n\n");
3998
        push(@implContent, "}\n\n");
3793
    }
3999
    }
3794
4000
3795
    my $overridesGet = InstanceOverridesGetOwnPropertySlot($interface);
4001
    if (InstanceOverridesGetOwnPropertySlot($interface)) {
3796
    if ($overridesGet) {
4002
        GenerateGetOwnPropertySlotBody(\@implContent, $interface, $className);
3797
        if (!$interface->extendedAttributes->{CustomGetOwnPropertySlot}) {
3798
            push(@implContent, GenerateGetOwnPropertySlotBody($interface, $className, $indexedGetterOperation, $namedGetterOperation));
3799
        }
3800
3801
        if ($indexedGetterOperation || $namedGetterOperation
3802
                || $interface->extendedAttributes->{CustomNamedGetter}
3803
                || $interface->extendedAttributes->{JSCustomGetOwnPropertySlotAndDescriptor}) {
3804
            push(@implContent, GenerateGetOwnPropertySlotBodyByIndex($interface, $className, $indexedGetterOperation, $namedGetterOperation));
3805
        }
3806
    }
4003
    }
3807
4004
    
3808
4005
    if (InstanceOverridesGetOwnPropertySlotByIndex($interface)) {
3809
    if (($indexedGetterOperation || $namedGetterOperation) && !$interface->extendedAttributes->{CustomEnumerateProperty}) {
4006
        GenerateGetOwnPropertySlotBodyByIndex(\@implContent, $interface, $className);
3810
        push(@implContent, GenerateGetOwnPropertyNames($interface, $className, $indexedGetterOperation, $namedGetterOperation));
3811
    }
4007
    }
3812
4008
    
3813
    my $namedSetterOperation = GetNamedSetterOperation($interface);
4009
    if (InstanceOverridesGetOwnPropertyNames($interface)) {
3814
    my $indexedSetterOperation = GetIndexedSetterOperation($interface);
4010
        GenerateGetOwnPropertyNames(\@implContent, $interface, $className);
3815
3816
    my $hasSetter = InstanceOverridesPut($interface);
3817
    if ($hasSetter) {
3818
        if (!$interface->extendedAttributes->{CustomPutFunction}) {
3819
            push(@implContent, GeneratePut($interface, $className, $indexedSetterOperation, $namedSetterOperation));
3820
            
3821
            if ($interface->extendedAttributes->{CustomIndexedSetter} || $interface->extendedAttributes->{CustomNamedSetter}) {
3822
                push(@implContent, GeneratePutByIndex($interface, $className, $indexedSetterOperation, $namedSetterOperation));
3823
            }
3824
        }
3825
    }
4011
    }
3826
4012
    
3827
    my $namedDeleterOperation = GetNamedDeleterOperation($interface);
4013
    if (InstanceOverridesPut($interface)) {
3828
    if ($namedDeleterOperation) {
4014
        GeneratePut(\@implContent, $interface, $className);
3829
        GenerateNamedDeleterDefinition(\@implContent, $interface, $className, $namedDeleterOperation);
4015
        GeneratePutByIndex(\@implContent, $interface, $className);
4016
    }
4017
    
4018
    if (InstanceOverridesDefineOwnProperty($interface)) {
4019
        GenerateDefineOwnProperty(\@implContent, $interface, $className);
3830
    }
4020
    }
3831
4021
4022
    if (InstanceOverridesDelete($interface)) {
4023
        GenerateNamedDeleterDefinition(\@implContent, $interface, $className);
4024
    }
4025
    
4026
    if (InstanceOverridesCall($interface)) {
4027
        GenerateLegacyCallerDefinitions($interface, $className);
4028
    }
4029
    
3832
    if ($numAttributes > 0) {
4030
    if ($numAttributes > 0) {
3833
        AddToImplIncludes("JSDOMAttribute.h");
4031
        AddToImplIncludes("JSDOMAttribute.h");
3834
4032
Lines 3908-3915 sub GenerateImplementation Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec20
3908
    foreach my $operation (@operations) {
4106
    foreach my $operation (@operations) {
3909
        GenerateOperationDefinition($interface, $className, $operation);
4107
        GenerateOperationDefinition($interface, $className, $operation);
3910
    }
4108
    }
3911
4109
    
3912
    GenerateLegacyCallerDefinitions($interface, $className);
3913
    GenerateIterableDefinition($interface) if $interface->iterable;
4110
    GenerateIterableDefinition($interface) if $interface->iterable;
3914
    GenerateSerializerDefinition($interface, $className) if $interface->serializable;
4111
    GenerateSerializerDefinition($interface, $className) if $interface->serializable;
3915
4112
Lines 4769-4778 sub GenerateLegacyCallerDefinitions Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec21
4769
{
4966
{
4770
    my ($interface, $className) = @_;
4967
    my ($interface, $className) = @_;
4771
4968
4772
    if (!IsCallable($interface) || $interface->extendedAttributes->{CustomCall}) {
4969
    return if $interface->extendedAttributes->{CustomCall};
4773
        return;
4970
    
4774
    }
4775
4776
    my @legacyCallers = @{$interface->{LegacyCallers}};
4971
    my @legacyCallers = @{$interface->{LegacyCallers}};
4777
    if (@legacyCallers > 1) {
4972
    if (@legacyCallers > 1) {
4778
        foreach my $legacyCaller (@legacyCallers) {
4973
        foreach my $legacyCaller (@legacyCallers) {
Lines 6312-6325 sub GeneratePrototypeDeclaration Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec22
6312
        }
6507
        }
6313
    }
6508
    }
6314
6509
6315
    if ($interface->extendedAttributes->{JSCustomNamedGetterOnPrototype}) {
6510
    if ($interface->extendedAttributes->{CustomNamedGetterOnPrototype}) {
6316
        push(@$outputArray, "\n");
6511
        push(@$outputArray, "\n");
6317
        push(@$outputArray, "    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);\n");
6512
        push(@$outputArray, "    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);\n");
6318
        push(@$outputArray, "    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n");
6513
        push(@$outputArray, "    bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n");
6319
    }
6514
    }
6320
6515
6321
    # Custom defineOwnProperty function
6516
    # Custom defineOwnProperty function
6322
    if ($interface->extendedAttributes->{JSCustomDefineOwnPropertyOnPrototype}) {
6517
    if ($interface->extendedAttributes->{CustomDefineOwnPropertyOnPrototype}) {
6323
        push(@$outputArray, "\n");
6518
        push(@$outputArray, "\n");
6324
        push(@$outputArray, "    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);\n");
6519
        push(@$outputArray, "    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);\n");
6325
    }
6520
    }
Lines 6580-6586 sub IsConstructable Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec23
6580
        || $interface->extendedAttributes->{JSBuiltinConstructor};
6775
        || $interface->extendedAttributes->{JSBuiltinConstructor};
6581
}
6776
}
6582
6777
6583
sub IsCallable
6778
sub InstanceOverridesCall
6584
{
6779
{
6585
    my $interface = shift;
6780
    my $interface = shift;
6586
    return $interface->extendedAttributes->{CustomCall} || $interface->{LegacyCallers}
6781
    return $interface->extendedAttributes->{CustomCall} || $interface->{LegacyCallers}
Lines 6589-6595 sub IsCallable Source/WebCore/bindings/scripts/CodeGeneratorJS.pm_sec24
6589
sub HeaderNeedsPrototypeDeclaration
6784
sub HeaderNeedsPrototypeDeclaration
6590
{
6785
{
6591
    my $interface = shift;
6786
    my $interface = shift;
6592
    return IsDOMGlobalObject($interface) || $interface->extendedAttributes->{JSCustomNamedGetterOnPrototype} || $interface->extendedAttributes->{JSCustomDefineOwnPropertyOnPrototype};
6787
    return IsDOMGlobalObject($interface)
6788
        || $interface->extendedAttributes->{CustomNamedGetterOnPrototype}
6789
        || $interface->extendedAttributes->{CustomDefineOwnPropertyOnPrototype};
6593
}
6790
}
6594
6791
6595
sub IsUnforgeable
6792
sub IsUnforgeable
- Source/WebCore/bindings/scripts/IDLAttributes.json -15 / +18 lines
Lines 80-85 Source/WebCore/bindings/scripts/IDLAttributes.json_sec1
80
        "CustomConstructor": {
80
        "CustomConstructor": {
81
            "contextsAllowed": ["interface"]
81
            "contextsAllowed": ["interface"]
82
        },
82
        },
83
        "CustomDefineOwnProperty": {
84
            "contextsAllowed": ["interface"]
85
        },
86
        "CustomDefineOwnPropertyOnPrototype": {
87
            "contextsAllowed": ["interface"]
88
        },
83
        "CustomDeleteProperty": {
89
        "CustomDeleteProperty": {
84
            "contextsAllowed": ["interface"]
90
            "contextsAllowed": ["interface"]
85
        },
91
        },
Lines 89-94 Source/WebCore/bindings/scripts/IDLAttributes.json_sec2
89
        "CustomGetOwnPropertySlot": {
95
        "CustomGetOwnPropertySlot": {
90
            "contextsAllowed": ["interface"]
96
            "contextsAllowed": ["interface"]
91
        },
97
        },
98
        "CustomGetOwnPropertySlotByIndex": {
99
            "contextsAllowed": ["interface"]
100
        },
101
        "CustomGetOwnPropertySlotAndDescriptor": {
102
            "contextsAllowed": ["interface"]
103
        },
92
        "CustomGetPrototype": {
104
        "CustomGetPrototype": {
93
            "contextsAllowed": ["interface"]
105
            "contextsAllowed": ["interface"]
94
        },
106
        },
Lines 104-109 Source/WebCore/bindings/scripts/IDLAttributes.json_sec3
104
        "CustomNamedGetter": {
116
        "CustomNamedGetter": {
105
            "contextsAllowed": ["interface"]
117
            "contextsAllowed": ["interface"]
106
        },
118
        },
119
        "CustomNamedGetterOnPrototype": {
120
            "contextsAllowed": ["interface"]
121
        },
107
        "CustomNamedSetter": {
122
        "CustomNamedSetter": {
108
            "contextsAllowed": ["interface"]
123
            "contextsAllowed": ["interface"]
109
        },
124
        },
Lines 113-118 Source/WebCore/bindings/scripts/IDLAttributes.json_sec4
113
        "CustomProxyToJSObject": {
128
        "CustomProxyToJSObject": {
114
            "contextsAllowed": ["interface"]
129
            "contextsAllowed": ["interface"]
115
        },
130
        },
131
        "CustomPushEventHandlerScope": {
132
            "contextsAllowed": ["interface"]
133
        },
116
        "CustomPutFunction": {
134
        "CustomPutFunction": {
117
            "contextsAllowed": ["interface"]
135
            "contextsAllowed": ["interface"]
118
        },
136
        },
Lines 222-251 Source/WebCore/bindings/scripts/IDLAttributes.json_sec5
222
        "JSBuiltinConstructor": {
240
        "JSBuiltinConstructor": {
223
            "contextsAllowed": ["interface"]
241
            "contextsAllowed": ["interface"]
224
        },
242
        },
225
        "JSCustomDefineOwnProperty": {
226
            "contextsAllowed": ["interface"]
227
        },
228
        "JSCustomDefineOwnPropertyOnPrototype": {
229
            "contextsAllowed": ["interface"]
230
        },
231
        "JSCustomFinalize": {
243
        "JSCustomFinalize": {
232
            "contextsAllowed": ["interface"]
244
            "contextsAllowed": ["interface"]
233
        },
245
        },
234
        "JSCustomGetOwnPropertySlotAndDescriptor": {
235
            "contextsAllowed": ["interface"]
236
        },
237
        "JSCustomHeader": {
246
        "JSCustomHeader": {
238
            "contextsAllowed": ["interface"]
247
            "contextsAllowed": ["interface"]
239
        },
248
        },
240
        "JSCustomMarkFunction": {
249
        "JSCustomMarkFunction": {
241
            "contextsAllowed": ["interface"]
250
            "contextsAllowed": ["interface"]
242
        },
251
        },
243
        "JSCustomNamedGetterOnPrototype": {
244
            "contextsAllowed": ["interface"]
245
        },
246
        "JSCustomPushEventHandlerScope": {
247
            "contextsAllowed": ["interface"]
248
        },
249
        "JSCustomToNativeObject": {
252
        "JSCustomToNativeObject": {
250
            "contextsAllowed": ["interface"]
253
            "contextsAllowed": ["interface"]
251
        },
254
        },
- Source/WebCore/bindings/scripts/test/TestIndexedSetterNoIdentifier.idl +31 lines
Line 0 Source/WebCore/bindings/scripts/test/TestIndexedSetterNoIdentifier.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestIndexedSetterNoIdentifier {
27
    setter void (unsigned long index, DOMString value);
28
29
    // NOTE: Indexed setters require the presence of a indexed getter as well.
30
    getter DOMString (unsigned long index);
31
};
- Source/WebCore/bindings/scripts/test/TestIndexedSetterThrowingException.idl +31 lines
Line 0 Source/WebCore/bindings/scripts/test/TestIndexedSetterThrowingException.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestIndexedSetterThrowingException {
27
    [MayThrowException] setter void (unsigned long index, DOMString value);
28
29
    // NOTE: Indexed setters require the presence of a indexed getter as well.
30
    getter DOMString (unsigned long index);
31
};
- Source/WebCore/bindings/scripts/test/TestIndexedSetterWithIdentifier.idl +31 lines
Line 0 Source/WebCore/bindings/scripts/test/TestIndexedSetterWithIdentifier.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestIndexedSetterWithIdentifier {
27
    setter void indexedSetter(unsigned long index, DOMString value);
28
29
    // NOTE: Indexed setters require the presence of a indexed getter as well.
30
    getter DOMString (unsigned long index);
31
};
- Source/WebCore/bindings/scripts/test/TestNamedAndIndexedSetterNoIdentifier.idl +32 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedAndIndexedSetterNoIdentifier.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedAndIndexedSetterNoIdentifier {
27
    setter void (DOMString name, DOMString value);
28
    getter DOMString (DOMString name);
29
30
    setter void (unsigned long index, DOMString value);
31
    getter DOMString (unsigned long index);
32
};
- Source/WebCore/bindings/scripts/test/TestNamedAndIndexedSetterThrowingException.idl +32 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedAndIndexedSetterThrowingException.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedAndIndexedSetterThrowingException {
27
    [MayThrowException] setter void (DOMString name, DOMString value);
28
    getter DOMString (DOMString name);
29
30
    [MayThrowException] setter void (unsigned long index, DOMString value);
31
    getter DOMString (unsigned long index);
32
};
- Source/WebCore/bindings/scripts/test/TestNamedAndIndexedSetterWithIdentifier.idl +32 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedAndIndexedSetterWithIdentifier.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedAndIndexedSetterWithIdentifier {
27
    setter void namedSetter(DOMString name, DOMString value);
28
    getter DOMString (DOMString name);
29
30
    setter void indexedSetter(unsigned long index, DOMString value);
31
    getter DOMString (unsigned long index);
32
};
- Source/WebCore/bindings/scripts/test/TestNamedDeleterWithIdentifier.idl -1 / +1 lines
Lines 24-30 Source/WebCore/bindings/scripts/test/TestNamedDeleterWithIdentifier.idl_sec1
24
 */
24
 */
25
25
26
interface TestNamedDeleterWithIdentifier {
26
interface TestNamedDeleterWithIdentifier {
27
    deleter void remove(DOMString name);
27
    deleter void namedDeleter(DOMString name);
28
28
29
    // NOTE: Named deleters require the presence of a named getter as well.
29
    // NOTE: Named deleters require the presence of a named getter as well.
30
    getter DOMString (DOMString name);
30
    getter DOMString (DOMString name);
- Source/WebCore/bindings/scripts/test/TestNamedSetterNoIdentifier.idl +31 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedSetterNoIdentifier.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedSetterNoIdentifier {
27
    setter void (DOMString name, DOMString value);
28
29
    // NOTE: Named setters require the presence of a named getter as well.
30
    getter DOMString (DOMString name);
31
};
- Source/WebCore/bindings/scripts/test/TestNamedSetterThrowingException.idl +31 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedSetterThrowingException.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedSetterThrowingException {
27
    [MayThrowException] setter void (DOMString name, DOMString value);
28
29
    // NOTE: Named setters require the presence of a named getter as well.
30
    getter DOMString (DOMString name);
31
};
- Source/WebCore/bindings/scripts/test/TestNamedSetterWithIdentifier.idl +31 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedSetterWithIdentifier.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedSetterWithIdentifier {
27
    setter void namedSetter(DOMString name, DOMString value);
28
29
    // NOTE: Named setters require the presence of a named getter as well.
30
    getter DOMString (DOMString name);
31
};
- Source/WebCore/bindings/scripts/test/TestNamedSetterWithOverrideBuiltins.idl +33 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedSetterWithOverrideBuiltins.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
[
27
    OverrideBuiltins
28
] interface TestNamedSetterWithOverrideBuiltins {
29
    setter void (DOMString name, DOMString value);
30
31
    // NOTE: Named setters require the presence of a named getter as well.
32
    getter DOMString (DOMString name);
33
};
- Source/WebCore/bindings/scripts/test/TestNamedSetterWithUnforgableProperties.idl +34 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedSetterWithUnforgableProperties.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
interface TestNamedSetterWithUnforgableProperties {
27
    setter void (DOMString name, DOMString value);
28
29
    // NOTE: Named setters require the presence of a named getter as well.
30
    getter DOMString (DOMString name);
31
32
    [Unforgeable] readonly attribute DOMString unforgeableAttribute;
33
    [Unforgeable] void unforgeableOperation();
34
};
- Source/WebCore/bindings/scripts/test/TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.idl +36 lines
Line 0 Source/WebCore/bindings/scripts/test/TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.idl_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
[
27
    OverrideBuiltins
28
] interface TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins {
29
    setter void (DOMString name, DOMString value);
30
31
    // NOTE: Named setters require the presence of a named getter as well.
32
    getter DOMString (DOMString name);
33
34
    [Unforgeable] readonly attribute DOMString unforgeableAttribute;
35
    [Unforgeable] void unforgeableOperation();
36
};
- Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h -1 / +1 lines
Lines 39-44 public: Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h_sec1
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static InterfaceName* toWrapped(JSC::VM&, JSC::JSValue);
41
    static InterfaceName* toWrapped(JSC::VM&, JSC::JSValue);
42
    static size_t estimatedSize(JSCell*);
42
    static void destroy(JSC::JSCell*);
43
    static void destroy(JSC::JSCell*);
43
44
44
    DECLARE_INFO;
45
    DECLARE_INFO;
Lines 51-57 public: Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h_sec2
51
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
52
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
52
    static void visitChildren(JSCell*, JSC::SlotVisitor&);
53
    static void visitChildren(JSCell*, JSC::SlotVisitor&);
53
54
54
    static size_t estimatedSize(JSCell*);
55
protected:
55
protected:
56
    JSInterfaceName(JSC::Structure*, JSDOMGlobalObject&, Ref<InterfaceName>&&);
56
    JSInterfaceName(JSC::Structure*, JSDOMGlobalObject&, Ref<InterfaceName>&&);
57
57
- Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h -1 / +1 lines
Lines 42-47 public: Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h_sec1
42
    static TestEventTarget* toWrapped(JSC::VM&, JSC::JSValue);
42
    static TestEventTarget* toWrapped(JSC::VM&, JSC::JSValue);
43
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
44
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
45
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
46
46
    DECLARE_INFO;
47
    DECLARE_INFO;
47
48
Lines 50-56 public: Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h_sec2
50
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
51
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
51
    }
52
    }
52
53
53
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
54
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
54
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
55
    TestEventTarget& wrapped() const
55
    TestEventTarget& wrapped() const
56
    {
56
    {
- Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp +304 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestIndexedSetterNoIdentifier.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include "URL.h"
30
#include <runtime/FunctionPrototype.h>
31
#include <runtime/PropertyNameArray.h>
32
#include <wtf/GetPtr.h>
33
34
using namespace JSC;
35
36
namespace WebCore {
37
38
// Attributes
39
40
JSC::EncodedJSValue jsTestIndexedSetterNoIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
41
bool setJSTestIndexedSetterNoIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
42
43
class JSTestIndexedSetterNoIdentifierPrototype : public JSC::JSNonFinalObject {
44
public:
45
    using Base = JSC::JSNonFinalObject;
46
    static JSTestIndexedSetterNoIdentifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
47
    {
48
        JSTestIndexedSetterNoIdentifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestIndexedSetterNoIdentifierPrototype>(vm.heap)) JSTestIndexedSetterNoIdentifierPrototype(vm, globalObject, structure);
49
        ptr->finishCreation(vm);
50
        return ptr;
51
    }
52
53
    DECLARE_INFO;
54
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
55
    {
56
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
57
    }
58
59
private:
60
    JSTestIndexedSetterNoIdentifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
61
        : JSC::JSNonFinalObject(vm, structure)
62
    {
63
    }
64
65
    void finishCreation(JSC::VM&);
66
};
67
68
using JSTestIndexedSetterNoIdentifierConstructor = JSDOMConstructorNotConstructable<JSTestIndexedSetterNoIdentifier>;
69
70
template<> JSValue JSTestIndexedSetterNoIdentifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
71
{
72
    UNUSED_PARAM(vm);
73
    return globalObject.functionPrototype();
74
}
75
76
template<> void JSTestIndexedSetterNoIdentifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
77
{
78
    putDirect(vm, vm.propertyNames->prototype, JSTestIndexedSetterNoIdentifier::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
79
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestIndexedSetterNoIdentifier"))), ReadOnly | DontEnum);
80
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
81
}
82
83
template<> const ClassInfo JSTestIndexedSetterNoIdentifierConstructor::s_info = { "TestIndexedSetterNoIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterNoIdentifierConstructor) };
84
85
/* Hash table for prototype */
86
87
static const HashTableValue JSTestIndexedSetterNoIdentifierPrototypeTableValues[] =
88
{
89
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestIndexedSetterNoIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestIndexedSetterNoIdentifierConstructor) } },
90
};
91
92
const ClassInfo JSTestIndexedSetterNoIdentifierPrototype::s_info = { "TestIndexedSetterNoIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterNoIdentifierPrototype) };
93
94
void JSTestIndexedSetterNoIdentifierPrototype::finishCreation(VM& vm)
95
{
96
    Base::finishCreation(vm);
97
    reifyStaticProperties(vm, JSTestIndexedSetterNoIdentifierPrototypeTableValues, *this);
98
}
99
100
const ClassInfo JSTestIndexedSetterNoIdentifier::s_info = { "TestIndexedSetterNoIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterNoIdentifier) };
101
102
JSTestIndexedSetterNoIdentifier::JSTestIndexedSetterNoIdentifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestIndexedSetterNoIdentifier>&& impl)
103
    : JSDOMWrapper<TestIndexedSetterNoIdentifier>(structure, globalObject, WTFMove(impl))
104
{
105
}
106
107
void JSTestIndexedSetterNoIdentifier::finishCreation(VM& vm)
108
{
109
    Base::finishCreation(vm);
110
    ASSERT(inherits(vm, info()));
111
112
}
113
114
JSObject* JSTestIndexedSetterNoIdentifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
115
{
116
    return JSTestIndexedSetterNoIdentifierPrototype::create(vm, &globalObject, JSTestIndexedSetterNoIdentifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
117
}
118
119
JSObject* JSTestIndexedSetterNoIdentifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
120
{
121
    return getDOMPrototype<JSTestIndexedSetterNoIdentifier>(vm, globalObject);
122
}
123
124
JSValue JSTestIndexedSetterNoIdentifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
125
{
126
    return getDOMConstructor<JSTestIndexedSetterNoIdentifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
127
}
128
129
void JSTestIndexedSetterNoIdentifier::destroy(JSC::JSCell* cell)
130
{
131
    JSTestIndexedSetterNoIdentifier* thisObject = static_cast<JSTestIndexedSetterNoIdentifier*>(cell);
132
    thisObject->JSTestIndexedSetterNoIdentifier::~JSTestIndexedSetterNoIdentifier();
133
}
134
135
bool JSTestIndexedSetterNoIdentifier::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
136
{
137
    auto* thisObject = jsCast<JSTestIndexedSetterNoIdentifier*>(object);
138
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
139
    auto optionalIndex = parseIndex(propertyName);
140
    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
141
        auto index = optionalIndex.value();
142
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
143
        return true;
144
    }
145
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
146
        return true;
147
    return false;
148
}
149
150
bool JSTestIndexedSetterNoIdentifier::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
151
{
152
    auto* thisObject = jsCast<JSTestIndexedSetterNoIdentifier*>(object);
153
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
154
    if (LIKELY(index < thisObject->wrapped().length())) {
155
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
156
        return true;
157
    }
158
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
159
}
160
161
void JSTestIndexedSetterNoIdentifier::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
162
{
163
    auto* thisObject = jsCast<JSTestIndexedSetterNoIdentifier*>(object);
164
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
165
    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
166
        propertyNames.add(Identifier::from(state, i));
167
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
168
}
169
170
bool JSTestIndexedSetterNoIdentifier::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
171
{
172
    auto* thisObject = jsCast<JSTestIndexedSetterNoIdentifier*>(cell);
173
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
174
175
    if (auto index = parseIndex(propertyName)) {
176
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
177
        auto nativeValue = convert<IDLDOMString>(*state, value);
178
        RETURN_IF_EXCEPTION(throwScope, true);
179
        thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue));
180
        return true;
181
    }
182
183
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
184
}
185
186
bool JSTestIndexedSetterNoIdentifier::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
187
{
188
    auto* thisObject = jsCast<JSTestIndexedSetterNoIdentifier*>(cell);
189
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
190
191
    if (LIKELY(index <= MAX_ARRAY_INDEX)) {
192
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
193
        auto nativeValue = convert<IDLDOMString>(*state, value);
194
        RETURN_IF_EXCEPTION(throwScope, true);
195
        thisObject->wrapped().setItem(index, WTFMove(nativeValue));
196
        return true;
197
    }
198
199
    return Base::putByIndex(cell, state, index, value, shouldThrow);
200
}
201
202
bool JSTestIndexedSetterNoIdentifier::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
203
{
204
    auto* thisObject = jsCast<JSTestIndexedSetterNoIdentifier*>(object);
205
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
206
207
    if (auto index = parseIndex(propertyName)) {
208
        if (!propertyDescriptor.isDataDescriptor())
209
            return false;
210
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
211
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
212
        RETURN_IF_EXCEPTION(throwScope, true);
213
        thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue));
214
        return true;
215
    }
216
217
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
218
    newPropertyDescriptor.setConfigurable(true);
219
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
220
}
221
222
EncodedJSValue jsTestIndexedSetterNoIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
223
{
224
    VM& vm = state->vm();
225
    auto throwScope = DECLARE_THROW_SCOPE(vm);
226
    auto* prototype = jsDynamicDowncast<JSTestIndexedSetterNoIdentifierPrototype*>(vm, JSValue::decode(thisValue));
227
    if (UNLIKELY(!prototype))
228
        return throwVMTypeError(state, throwScope);
229
    return JSValue::encode(JSTestIndexedSetterNoIdentifier::getConstructor(state->vm(), prototype->globalObject()));
230
}
231
232
bool setJSTestIndexedSetterNoIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
233
{
234
    VM& vm = state->vm();
235
    auto throwScope = DECLARE_THROW_SCOPE(vm);
236
    auto* prototype = jsDynamicDowncast<JSTestIndexedSetterNoIdentifierPrototype*>(vm, JSValue::decode(thisValue));
237
    if (UNLIKELY(!prototype)) {
238
        throwVMTypeError(state, throwScope);
239
        return false;
240
    }
241
    // Shadowing a built-in constructor
242
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
243
}
244
245
bool JSTestIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
246
{
247
    UNUSED_PARAM(handle);
248
    UNUSED_PARAM(visitor);
249
    return false;
250
}
251
252
void JSTestIndexedSetterNoIdentifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
253
{
254
    auto* jsTestIndexedSetterNoIdentifier = static_cast<JSTestIndexedSetterNoIdentifier*>(handle.slot()->asCell());
255
    auto& world = *static_cast<DOMWrapperWorld*>(context);
256
    uncacheWrapper(world, &jsTestIndexedSetterNoIdentifier->wrapped(), jsTestIndexedSetterNoIdentifier);
257
}
258
259
#if ENABLE(BINDING_INTEGRITY)
260
#if PLATFORM(WIN)
261
#pragma warning(disable: 4483)
262
extern "C" { extern void (*const __identifier("??_7TestIndexedSetterNoIdentifier@WebCore@@6B@")[])(); }
263
#else
264
extern "C" { extern void* _ZTVN7WebCore29TestIndexedSetterNoIdentifierE[]; }
265
#endif
266
#endif
267
268
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestIndexedSetterNoIdentifier>&& impl)
269
{
270
271
#if ENABLE(BINDING_INTEGRITY)
272
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
273
#if PLATFORM(WIN)
274
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestIndexedSetterNoIdentifier@WebCore@@6B@"));
275
#else
276
    void* expectedVTablePointer = &_ZTVN7WebCore29TestIndexedSetterNoIdentifierE[2];
277
#if COMPILER(CLANG)
278
    // If this fails TestIndexedSetterNoIdentifier does not have a vtable, so you need to add the
279
    // ImplementationLacksVTable attribute to the interface definition
280
    static_assert(__is_polymorphic(TestIndexedSetterNoIdentifier), "TestIndexedSetterNoIdentifier is not polymorphic");
281
#endif
282
#endif
283
    // If you hit this assertion you either have a use after free bug, or
284
    // TestIndexedSetterNoIdentifier has subclasses. If TestIndexedSetterNoIdentifier has subclasses that get passed
285
    // to toJS() we currently require TestIndexedSetterNoIdentifier you to opt out of binding hardening
286
    // by adding the SkipVTableValidation attribute to the interface IDL definition
287
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
288
#endif
289
    return createWrapper<TestIndexedSetterNoIdentifier>(globalObject, WTFMove(impl));
290
}
291
292
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIndexedSetterNoIdentifier& impl)
293
{
294
    return wrap(state, globalObject, impl);
295
}
296
297
TestIndexedSetterNoIdentifier* JSTestIndexedSetterNoIdentifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
298
{
299
    if (auto* wrapper = jsDynamicDowncast<JSTestIndexedSetterNoIdentifier*>(vm, value))
300
        return &wrapper->wrapped();
301
    return nullptr;
302
}
303
304
}
- Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestIndexedSetterNoIdentifier.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestIndexedSetterNoIdentifier : public JSDOMWrapper<TestIndexedSetterNoIdentifier> {
30
public:
31
    using Base = JSDOMWrapper<TestIndexedSetterNoIdentifier>;
32
    static JSTestIndexedSetterNoIdentifier* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestIndexedSetterNoIdentifier>&& impl)
33
    {
34
        JSTestIndexedSetterNoIdentifier* ptr = new (NotNull, JSC::allocateCell<JSTestIndexedSetterNoIdentifier>(globalObject->vm().heap)) JSTestIndexedSetterNoIdentifier(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestIndexedSetterNoIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestIndexedSetterNoIdentifier(JSC::Structure*, JSDOMGlobalObject&, Ref<TestIndexedSetterNoIdentifier>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestIndexedSetterNoIdentifierOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestIndexedSetterNoIdentifier*)
73
{
74
    static NeverDestroyed<JSTestIndexedSetterNoIdentifierOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestIndexedSetterNoIdentifier* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestIndexedSetterNoIdentifier&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIndexedSetterNoIdentifier* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestIndexedSetterNoIdentifier>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestIndexedSetterNoIdentifier>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestIndexedSetterNoIdentifier> {
89
    using WrapperClass = JSTestIndexedSetterNoIdentifier;
90
    using ToWrappedReturnType = TestIndexedSetterNoIdentifier*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp +304 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestIndexedSetterThrowingException.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include "URL.h"
30
#include <runtime/FunctionPrototype.h>
31
#include <runtime/PropertyNameArray.h>
32
#include <wtf/GetPtr.h>
33
34
using namespace JSC;
35
36
namespace WebCore {
37
38
// Attributes
39
40
JSC::EncodedJSValue jsTestIndexedSetterThrowingExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
41
bool setJSTestIndexedSetterThrowingExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
42
43
class JSTestIndexedSetterThrowingExceptionPrototype : public JSC::JSNonFinalObject {
44
public:
45
    using Base = JSC::JSNonFinalObject;
46
    static JSTestIndexedSetterThrowingExceptionPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
47
    {
48
        JSTestIndexedSetterThrowingExceptionPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestIndexedSetterThrowingExceptionPrototype>(vm.heap)) JSTestIndexedSetterThrowingExceptionPrototype(vm, globalObject, structure);
49
        ptr->finishCreation(vm);
50
        return ptr;
51
    }
52
53
    DECLARE_INFO;
54
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
55
    {
56
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
57
    }
58
59
private:
60
    JSTestIndexedSetterThrowingExceptionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
61
        : JSC::JSNonFinalObject(vm, structure)
62
    {
63
    }
64
65
    void finishCreation(JSC::VM&);
66
};
67
68
using JSTestIndexedSetterThrowingExceptionConstructor = JSDOMConstructorNotConstructable<JSTestIndexedSetterThrowingException>;
69
70
template<> JSValue JSTestIndexedSetterThrowingExceptionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
71
{
72
    UNUSED_PARAM(vm);
73
    return globalObject.functionPrototype();
74
}
75
76
template<> void JSTestIndexedSetterThrowingExceptionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
77
{
78
    putDirect(vm, vm.propertyNames->prototype, JSTestIndexedSetterThrowingException::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
79
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestIndexedSetterThrowingException"))), ReadOnly | DontEnum);
80
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
81
}
82
83
template<> const ClassInfo JSTestIndexedSetterThrowingExceptionConstructor::s_info = { "TestIndexedSetterThrowingException", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterThrowingExceptionConstructor) };
84
85
/* Hash table for prototype */
86
87
static const HashTableValue JSTestIndexedSetterThrowingExceptionPrototypeTableValues[] =
88
{
89
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestIndexedSetterThrowingExceptionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestIndexedSetterThrowingExceptionConstructor) } },
90
};
91
92
const ClassInfo JSTestIndexedSetterThrowingExceptionPrototype::s_info = { "TestIndexedSetterThrowingExceptionPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterThrowingExceptionPrototype) };
93
94
void JSTestIndexedSetterThrowingExceptionPrototype::finishCreation(VM& vm)
95
{
96
    Base::finishCreation(vm);
97
    reifyStaticProperties(vm, JSTestIndexedSetterThrowingExceptionPrototypeTableValues, *this);
98
}
99
100
const ClassInfo JSTestIndexedSetterThrowingException::s_info = { "TestIndexedSetterThrowingException", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterThrowingException) };
101
102
JSTestIndexedSetterThrowingException::JSTestIndexedSetterThrowingException(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestIndexedSetterThrowingException>&& impl)
103
    : JSDOMWrapper<TestIndexedSetterThrowingException>(structure, globalObject, WTFMove(impl))
104
{
105
}
106
107
void JSTestIndexedSetterThrowingException::finishCreation(VM& vm)
108
{
109
    Base::finishCreation(vm);
110
    ASSERT(inherits(vm, info()));
111
112
}
113
114
JSObject* JSTestIndexedSetterThrowingException::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
115
{
116
    return JSTestIndexedSetterThrowingExceptionPrototype::create(vm, &globalObject, JSTestIndexedSetterThrowingExceptionPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
117
}
118
119
JSObject* JSTestIndexedSetterThrowingException::prototype(VM& vm, JSDOMGlobalObject& globalObject)
120
{
121
    return getDOMPrototype<JSTestIndexedSetterThrowingException>(vm, globalObject);
122
}
123
124
JSValue JSTestIndexedSetterThrowingException::getConstructor(VM& vm, const JSGlobalObject* globalObject)
125
{
126
    return getDOMConstructor<JSTestIndexedSetterThrowingExceptionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
127
}
128
129
void JSTestIndexedSetterThrowingException::destroy(JSC::JSCell* cell)
130
{
131
    JSTestIndexedSetterThrowingException* thisObject = static_cast<JSTestIndexedSetterThrowingException*>(cell);
132
    thisObject->JSTestIndexedSetterThrowingException::~JSTestIndexedSetterThrowingException();
133
}
134
135
bool JSTestIndexedSetterThrowingException::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
136
{
137
    auto* thisObject = jsCast<JSTestIndexedSetterThrowingException*>(object);
138
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
139
    auto optionalIndex = parseIndex(propertyName);
140
    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
141
        auto index = optionalIndex.value();
142
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
143
        return true;
144
    }
145
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
146
        return true;
147
    return false;
148
}
149
150
bool JSTestIndexedSetterThrowingException::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
151
{
152
    auto* thisObject = jsCast<JSTestIndexedSetterThrowingException*>(object);
153
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
154
    if (LIKELY(index < thisObject->wrapped().length())) {
155
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
156
        return true;
157
    }
158
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
159
}
160
161
void JSTestIndexedSetterThrowingException::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
162
{
163
    auto* thisObject = jsCast<JSTestIndexedSetterThrowingException*>(object);
164
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
165
    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
166
        propertyNames.add(Identifier::from(state, i));
167
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
168
}
169
170
bool JSTestIndexedSetterThrowingException::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
171
{
172
    auto* thisObject = jsCast<JSTestIndexedSetterThrowingException*>(cell);
173
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
174
175
    if (auto index = parseIndex(propertyName)) {
176
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
177
        auto nativeValue = convert<IDLDOMString>(*state, value);
178
        RETURN_IF_EXCEPTION(throwScope, true);
179
        propagateException(*state, throwScope, thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue)));
180
        return true;
181
    }
182
183
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
184
}
185
186
bool JSTestIndexedSetterThrowingException::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
187
{
188
    auto* thisObject = jsCast<JSTestIndexedSetterThrowingException*>(cell);
189
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
190
191
    if (LIKELY(index <= MAX_ARRAY_INDEX)) {
192
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
193
        auto nativeValue = convert<IDLDOMString>(*state, value);
194
        RETURN_IF_EXCEPTION(throwScope, true);
195
        propagateException(*state, throwScope, thisObject->wrapped().setItem(index, WTFMove(nativeValue)));
196
        return true;
197
    }
198
199
    return Base::putByIndex(cell, state, index, value, shouldThrow);
200
}
201
202
bool JSTestIndexedSetterThrowingException::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
203
{
204
    auto* thisObject = jsCast<JSTestIndexedSetterThrowingException*>(object);
205
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
206
207
    if (auto index = parseIndex(propertyName)) {
208
        if (!propertyDescriptor.isDataDescriptor())
209
            return false;
210
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
211
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
212
        RETURN_IF_EXCEPTION(throwScope, true);
213
        propagateException(*state, throwScope, thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue)));
214
        return true;
215
    }
216
217
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
218
    newPropertyDescriptor.setConfigurable(true);
219
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
220
}
221
222
EncodedJSValue jsTestIndexedSetterThrowingExceptionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
223
{
224
    VM& vm = state->vm();
225
    auto throwScope = DECLARE_THROW_SCOPE(vm);
226
    auto* prototype = jsDynamicDowncast<JSTestIndexedSetterThrowingExceptionPrototype*>(vm, JSValue::decode(thisValue));
227
    if (UNLIKELY(!prototype))
228
        return throwVMTypeError(state, throwScope);
229
    return JSValue::encode(JSTestIndexedSetterThrowingException::getConstructor(state->vm(), prototype->globalObject()));
230
}
231
232
bool setJSTestIndexedSetterThrowingExceptionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
233
{
234
    VM& vm = state->vm();
235
    auto throwScope = DECLARE_THROW_SCOPE(vm);
236
    auto* prototype = jsDynamicDowncast<JSTestIndexedSetterThrowingExceptionPrototype*>(vm, JSValue::decode(thisValue));
237
    if (UNLIKELY(!prototype)) {
238
        throwVMTypeError(state, throwScope);
239
        return false;
240
    }
241
    // Shadowing a built-in constructor
242
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
243
}
244
245
bool JSTestIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
246
{
247
    UNUSED_PARAM(handle);
248
    UNUSED_PARAM(visitor);
249
    return false;
250
}
251
252
void JSTestIndexedSetterThrowingExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
253
{
254
    auto* jsTestIndexedSetterThrowingException = static_cast<JSTestIndexedSetterThrowingException*>(handle.slot()->asCell());
255
    auto& world = *static_cast<DOMWrapperWorld*>(context);
256
    uncacheWrapper(world, &jsTestIndexedSetterThrowingException->wrapped(), jsTestIndexedSetterThrowingException);
257
}
258
259
#if ENABLE(BINDING_INTEGRITY)
260
#if PLATFORM(WIN)
261
#pragma warning(disable: 4483)
262
extern "C" { extern void (*const __identifier("??_7TestIndexedSetterThrowingException@WebCore@@6B@")[])(); }
263
#else
264
extern "C" { extern void* _ZTVN7WebCore34TestIndexedSetterThrowingExceptionE[]; }
265
#endif
266
#endif
267
268
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestIndexedSetterThrowingException>&& impl)
269
{
270
271
#if ENABLE(BINDING_INTEGRITY)
272
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
273
#if PLATFORM(WIN)
274
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestIndexedSetterThrowingException@WebCore@@6B@"));
275
#else
276
    void* expectedVTablePointer = &_ZTVN7WebCore34TestIndexedSetterThrowingExceptionE[2];
277
#if COMPILER(CLANG)
278
    // If this fails TestIndexedSetterThrowingException does not have a vtable, so you need to add the
279
    // ImplementationLacksVTable attribute to the interface definition
280
    static_assert(__is_polymorphic(TestIndexedSetterThrowingException), "TestIndexedSetterThrowingException is not polymorphic");
281
#endif
282
#endif
283
    // If you hit this assertion you either have a use after free bug, or
284
    // TestIndexedSetterThrowingException has subclasses. If TestIndexedSetterThrowingException has subclasses that get passed
285
    // to toJS() we currently require TestIndexedSetterThrowingException you to opt out of binding hardening
286
    // by adding the SkipVTableValidation attribute to the interface IDL definition
287
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
288
#endif
289
    return createWrapper<TestIndexedSetterThrowingException>(globalObject, WTFMove(impl));
290
}
291
292
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIndexedSetterThrowingException& impl)
293
{
294
    return wrap(state, globalObject, impl);
295
}
296
297
TestIndexedSetterThrowingException* JSTestIndexedSetterThrowingException::toWrapped(JSC::VM& vm, JSC::JSValue value)
298
{
299
    if (auto* wrapper = jsDynamicDowncast<JSTestIndexedSetterThrowingException*>(vm, value))
300
        return &wrapper->wrapped();
301
    return nullptr;
302
}
303
304
}
- Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestIndexedSetterThrowingException.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestIndexedSetterThrowingException : public JSDOMWrapper<TestIndexedSetterThrowingException> {
30
public:
31
    using Base = JSDOMWrapper<TestIndexedSetterThrowingException>;
32
    static JSTestIndexedSetterThrowingException* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestIndexedSetterThrowingException>&& impl)
33
    {
34
        JSTestIndexedSetterThrowingException* ptr = new (NotNull, JSC::allocateCell<JSTestIndexedSetterThrowingException>(globalObject->vm().heap)) JSTestIndexedSetterThrowingException(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestIndexedSetterThrowingException* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestIndexedSetterThrowingException(JSC::Structure*, JSDOMGlobalObject&, Ref<TestIndexedSetterThrowingException>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestIndexedSetterThrowingExceptionOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestIndexedSetterThrowingException*)
73
{
74
    static NeverDestroyed<JSTestIndexedSetterThrowingExceptionOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestIndexedSetterThrowingException* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestIndexedSetterThrowingException&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIndexedSetterThrowingException* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestIndexedSetterThrowingException>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestIndexedSetterThrowingException>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestIndexedSetterThrowingException> {
89
    using WrapperClass = JSTestIndexedSetterThrowingException;
90
    using ToWrappedReturnType = TestIndexedSetterThrowingException*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp +335 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestIndexedSetterWithIdentifier.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMOperation.h"
29
#include "JSDOMWrapperCache.h"
30
#include "URL.h"
31
#include <runtime/FunctionPrototype.h>
32
#include <runtime/PropertyNameArray.h>
33
#include <wtf/GetPtr.h>
34
35
using namespace JSC;
36
37
namespace WebCore {
38
39
// Functions
40
41
JSC::EncodedJSValue JSC_HOST_CALL jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter(JSC::ExecState*);
42
43
// Attributes
44
45
JSC::EncodedJSValue jsTestIndexedSetterWithIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
46
bool setJSTestIndexedSetterWithIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
47
48
class JSTestIndexedSetterWithIdentifierPrototype : public JSC::JSNonFinalObject {
49
public:
50
    using Base = JSC::JSNonFinalObject;
51
    static JSTestIndexedSetterWithIdentifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
52
    {
53
        JSTestIndexedSetterWithIdentifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestIndexedSetterWithIdentifierPrototype>(vm.heap)) JSTestIndexedSetterWithIdentifierPrototype(vm, globalObject, structure);
54
        ptr->finishCreation(vm);
55
        return ptr;
56
    }
57
58
    DECLARE_INFO;
59
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
60
    {
61
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
62
    }
63
64
private:
65
    JSTestIndexedSetterWithIdentifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
66
        : JSC::JSNonFinalObject(vm, structure)
67
    {
68
    }
69
70
    void finishCreation(JSC::VM&);
71
};
72
73
using JSTestIndexedSetterWithIdentifierConstructor = JSDOMConstructorNotConstructable<JSTestIndexedSetterWithIdentifier>;
74
75
template<> JSValue JSTestIndexedSetterWithIdentifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
76
{
77
    UNUSED_PARAM(vm);
78
    return globalObject.functionPrototype();
79
}
80
81
template<> void JSTestIndexedSetterWithIdentifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
82
{
83
    putDirect(vm, vm.propertyNames->prototype, JSTestIndexedSetterWithIdentifier::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
84
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestIndexedSetterWithIdentifier"))), ReadOnly | DontEnum);
85
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
86
}
87
88
template<> const ClassInfo JSTestIndexedSetterWithIdentifierConstructor::s_info = { "TestIndexedSetterWithIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterWithIdentifierConstructor) };
89
90
/* Hash table for prototype */
91
92
static const HashTableValue JSTestIndexedSetterWithIdentifierPrototypeTableValues[] =
93
{
94
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestIndexedSetterWithIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestIndexedSetterWithIdentifierConstructor) } },
95
    { "indexedSetter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter), (intptr_t) (2) } },
96
};
97
98
const ClassInfo JSTestIndexedSetterWithIdentifierPrototype::s_info = { "TestIndexedSetterWithIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterWithIdentifierPrototype) };
99
100
void JSTestIndexedSetterWithIdentifierPrototype::finishCreation(VM& vm)
101
{
102
    Base::finishCreation(vm);
103
    reifyStaticProperties(vm, JSTestIndexedSetterWithIdentifierPrototypeTableValues, *this);
104
}
105
106
const ClassInfo JSTestIndexedSetterWithIdentifier::s_info = { "TestIndexedSetterWithIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestIndexedSetterWithIdentifier) };
107
108
JSTestIndexedSetterWithIdentifier::JSTestIndexedSetterWithIdentifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestIndexedSetterWithIdentifier>&& impl)
109
    : JSDOMWrapper<TestIndexedSetterWithIdentifier>(structure, globalObject, WTFMove(impl))
110
{
111
}
112
113
void JSTestIndexedSetterWithIdentifier::finishCreation(VM& vm)
114
{
115
    Base::finishCreation(vm);
116
    ASSERT(inherits(vm, info()));
117
118
}
119
120
JSObject* JSTestIndexedSetterWithIdentifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
121
{
122
    return JSTestIndexedSetterWithIdentifierPrototype::create(vm, &globalObject, JSTestIndexedSetterWithIdentifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
123
}
124
125
JSObject* JSTestIndexedSetterWithIdentifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
126
{
127
    return getDOMPrototype<JSTestIndexedSetterWithIdentifier>(vm, globalObject);
128
}
129
130
JSValue JSTestIndexedSetterWithIdentifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
131
{
132
    return getDOMConstructor<JSTestIndexedSetterWithIdentifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
133
}
134
135
void JSTestIndexedSetterWithIdentifier::destroy(JSC::JSCell* cell)
136
{
137
    JSTestIndexedSetterWithIdentifier* thisObject = static_cast<JSTestIndexedSetterWithIdentifier*>(cell);
138
    thisObject->JSTestIndexedSetterWithIdentifier::~JSTestIndexedSetterWithIdentifier();
139
}
140
141
bool JSTestIndexedSetterWithIdentifier::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
142
{
143
    auto* thisObject = jsCast<JSTestIndexedSetterWithIdentifier*>(object);
144
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
145
    auto optionalIndex = parseIndex(propertyName);
146
    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
147
        auto index = optionalIndex.value();
148
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
149
        return true;
150
    }
151
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
152
        return true;
153
    return false;
154
}
155
156
bool JSTestIndexedSetterWithIdentifier::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
157
{
158
    auto* thisObject = jsCast<JSTestIndexedSetterWithIdentifier*>(object);
159
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
160
    if (LIKELY(index < thisObject->wrapped().length())) {
161
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
162
        return true;
163
    }
164
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
165
}
166
167
void JSTestIndexedSetterWithIdentifier::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
168
{
169
    auto* thisObject = jsCast<JSTestIndexedSetterWithIdentifier*>(object);
170
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
171
    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
172
        propertyNames.add(Identifier::from(state, i));
173
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
174
}
175
176
bool JSTestIndexedSetterWithIdentifier::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
177
{
178
    auto* thisObject = jsCast<JSTestIndexedSetterWithIdentifier*>(cell);
179
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
180
181
    if (auto index = parseIndex(propertyName)) {
182
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
183
        auto nativeValue = convert<IDLDOMString>(*state, value);
184
        RETURN_IF_EXCEPTION(throwScope, true);
185
        thisObject->wrapped().indexedSetter(index.value(), WTFMove(nativeValue));
186
        return true;
187
    }
188
189
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
190
}
191
192
bool JSTestIndexedSetterWithIdentifier::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
193
{
194
    auto* thisObject = jsCast<JSTestIndexedSetterWithIdentifier*>(cell);
195
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
196
197
    if (LIKELY(index <= MAX_ARRAY_INDEX)) {
198
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
199
        auto nativeValue = convert<IDLDOMString>(*state, value);
200
        RETURN_IF_EXCEPTION(throwScope, true);
201
        thisObject->wrapped().indexedSetter(index, WTFMove(nativeValue));
202
        return true;
203
    }
204
205
    return Base::putByIndex(cell, state, index, value, shouldThrow);
206
}
207
208
bool JSTestIndexedSetterWithIdentifier::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
209
{
210
    auto* thisObject = jsCast<JSTestIndexedSetterWithIdentifier*>(object);
211
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
212
213
    if (auto index = parseIndex(propertyName)) {
214
        if (!propertyDescriptor.isDataDescriptor())
215
            return false;
216
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
217
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
218
        RETURN_IF_EXCEPTION(throwScope, true);
219
        thisObject->wrapped().indexedSetter(index.value(), WTFMove(nativeValue));
220
        return true;
221
    }
222
223
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
224
    newPropertyDescriptor.setConfigurable(true);
225
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
226
}
227
228
template<> inline JSTestIndexedSetterWithIdentifier* IDLOperation<JSTestIndexedSetterWithIdentifier>::cast(ExecState& state)
229
{
230
    return jsDynamicDowncast<JSTestIndexedSetterWithIdentifier*>(state.vm(), state.thisValue());
231
}
232
233
EncodedJSValue jsTestIndexedSetterWithIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
234
{
235
    VM& vm = state->vm();
236
    auto throwScope = DECLARE_THROW_SCOPE(vm);
237
    auto* prototype = jsDynamicDowncast<JSTestIndexedSetterWithIdentifierPrototype*>(vm, JSValue::decode(thisValue));
238
    if (UNLIKELY(!prototype))
239
        return throwVMTypeError(state, throwScope);
240
    return JSValue::encode(JSTestIndexedSetterWithIdentifier::getConstructor(state->vm(), prototype->globalObject()));
241
}
242
243
bool setJSTestIndexedSetterWithIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
244
{
245
    VM& vm = state->vm();
246
    auto throwScope = DECLARE_THROW_SCOPE(vm);
247
    auto* prototype = jsDynamicDowncast<JSTestIndexedSetterWithIdentifierPrototype*>(vm, JSValue::decode(thisValue));
248
    if (UNLIKELY(!prototype)) {
249
        throwVMTypeError(state, throwScope);
250
        return false;
251
    }
252
    // Shadowing a built-in constructor
253
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
254
}
255
256
static inline JSC::EncodedJSValue jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody(JSC::ExecState* state, typename IDLOperation<JSTestIndexedSetterWithIdentifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
257
{
258
    UNUSED_PARAM(state);
259
    UNUSED_PARAM(throwScope);
260
    auto& impl = castedThis->wrapped();
261
    if (UNLIKELY(state->argumentCount() < 2))
262
        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
263
    auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0));
264
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
265
    auto value = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
266
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
267
    impl.indexedSetter(WTFMove(index), WTFMove(value));
268
    return JSValue::encode(jsUndefined());
269
}
270
271
EncodedJSValue JSC_HOST_CALL jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter(ExecState* state)
272
{
273
    return IDLOperation<JSTestIndexedSetterWithIdentifier>::call<jsTestIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody>(*state, "indexedSetter");
274
}
275
276
bool JSTestIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
277
{
278
    UNUSED_PARAM(handle);
279
    UNUSED_PARAM(visitor);
280
    return false;
281
}
282
283
void JSTestIndexedSetterWithIdentifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
284
{
285
    auto* jsTestIndexedSetterWithIdentifier = static_cast<JSTestIndexedSetterWithIdentifier*>(handle.slot()->asCell());
286
    auto& world = *static_cast<DOMWrapperWorld*>(context);
287
    uncacheWrapper(world, &jsTestIndexedSetterWithIdentifier->wrapped(), jsTestIndexedSetterWithIdentifier);
288
}
289
290
#if ENABLE(BINDING_INTEGRITY)
291
#if PLATFORM(WIN)
292
#pragma warning(disable: 4483)
293
extern "C" { extern void (*const __identifier("??_7TestIndexedSetterWithIdentifier@WebCore@@6B@")[])(); }
294
#else
295
extern "C" { extern void* _ZTVN7WebCore31TestIndexedSetterWithIdentifierE[]; }
296
#endif
297
#endif
298
299
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestIndexedSetterWithIdentifier>&& impl)
300
{
301
302
#if ENABLE(BINDING_INTEGRITY)
303
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
304
#if PLATFORM(WIN)
305
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestIndexedSetterWithIdentifier@WebCore@@6B@"));
306
#else
307
    void* expectedVTablePointer = &_ZTVN7WebCore31TestIndexedSetterWithIdentifierE[2];
308
#if COMPILER(CLANG)
309
    // If this fails TestIndexedSetterWithIdentifier does not have a vtable, so you need to add the
310
    // ImplementationLacksVTable attribute to the interface definition
311
    static_assert(__is_polymorphic(TestIndexedSetterWithIdentifier), "TestIndexedSetterWithIdentifier is not polymorphic");
312
#endif
313
#endif
314
    // If you hit this assertion you either have a use after free bug, or
315
    // TestIndexedSetterWithIdentifier has subclasses. If TestIndexedSetterWithIdentifier has subclasses that get passed
316
    // to toJS() we currently require TestIndexedSetterWithIdentifier you to opt out of binding hardening
317
    // by adding the SkipVTableValidation attribute to the interface IDL definition
318
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
319
#endif
320
    return createWrapper<TestIndexedSetterWithIdentifier>(globalObject, WTFMove(impl));
321
}
322
323
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIndexedSetterWithIdentifier& impl)
324
{
325
    return wrap(state, globalObject, impl);
326
}
327
328
TestIndexedSetterWithIdentifier* JSTestIndexedSetterWithIdentifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
329
{
330
    if (auto* wrapper = jsDynamicDowncast<JSTestIndexedSetterWithIdentifier*>(vm, value))
331
        return &wrapper->wrapped();
332
    return nullptr;
333
}
334
335
}
- Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestIndexedSetterWithIdentifier.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestIndexedSetterWithIdentifier : public JSDOMWrapper<TestIndexedSetterWithIdentifier> {
30
public:
31
    using Base = JSDOMWrapper<TestIndexedSetterWithIdentifier>;
32
    static JSTestIndexedSetterWithIdentifier* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestIndexedSetterWithIdentifier>&& impl)
33
    {
34
        JSTestIndexedSetterWithIdentifier* ptr = new (NotNull, JSC::allocateCell<JSTestIndexedSetterWithIdentifier>(globalObject->vm().heap)) JSTestIndexedSetterWithIdentifier(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestIndexedSetterWithIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestIndexedSetterWithIdentifier(JSC::Structure*, JSDOMGlobalObject&, Ref<TestIndexedSetterWithIdentifier>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestIndexedSetterWithIdentifierOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestIndexedSetterWithIdentifier*)
73
{
74
    static NeverDestroyed<JSTestIndexedSetterWithIdentifierOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestIndexedSetterWithIdentifier* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestIndexedSetterWithIdentifier&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestIndexedSetterWithIdentifier* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestIndexedSetterWithIdentifier>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestIndexedSetterWithIdentifier>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestIndexedSetterWithIdentifier> {
89
    using WrapperClass = JSTestIndexedSetterWithIdentifier;
90
    using ToWrappedReturnType = TestIndexedSetterWithIdentifier*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp -3 / +7 lines
Lines 407-431 void JSTestInterface::destroy(JSC::JSCel Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp_sec1
407
    thisObject->JSTestInterface::~JSTestInterface();
407
    thisObject->JSTestInterface::~JSTestInterface();
408
}
408
}
409
409
410
bool JSTestInterface::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
410
bool JSTestInterface::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
411
{
411
{
412
    auto* thisObject = jsCast<JSTestInterface*>(cell);
412
    auto* thisObject = jsCast<JSTestInterface*>(cell);
413
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
413
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
414
414
    bool putResult = false;
415
    bool putResult = false;
415
    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))
416
    if (thisObject->putDelegate(state, propertyName, value, putPropertySlot, putResult))
416
        return putResult;
417
        return putResult;
417
    return Base::put(thisObject, state, propertyName, value, slot);
418
419
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
418
}
420
}
419
421
420
bool JSTestInterface::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
422
bool JSTestInterface::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
421
{
423
{
422
    auto* thisObject = jsCast<JSTestInterface*>(cell);
424
    auto* thisObject = jsCast<JSTestInterface*>(cell);
423
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
425
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
426
424
    Identifier propertyName = Identifier::from(state, index);
427
    Identifier propertyName = Identifier::from(state, index);
425
    PutPropertySlot slot(thisObject, shouldThrow);
428
    PutPropertySlot slot(thisObject, shouldThrow);
426
    bool putResult = false;
429
    bool putResult = false;
427
    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))
430
    if (thisObject->putDelegate(state, propertyName, value, slot, putResult))
428
        return putResult;
431
        return putResult;
432
429
    return Base::putByIndex(cell, state, index, value, shouldThrow);
433
    return Base::putByIndex(cell, state, index, value, shouldThrow);
430
}
434
}
431
435
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp +353 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedAndIndexedSetterNoIdentifier.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include "URL.h"
30
#include <runtime/FunctionPrototype.h>
31
#include <runtime/PropertyNameArray.h>
32
#include <wtf/GetPtr.h>
33
34
using namespace JSC;
35
36
namespace WebCore {
37
38
// Attributes
39
40
JSC::EncodedJSValue jsTestNamedAndIndexedSetterNoIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
41
bool setJSTestNamedAndIndexedSetterNoIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
42
43
class JSTestNamedAndIndexedSetterNoIdentifierPrototype : public JSC::JSNonFinalObject {
44
public:
45
    using Base = JSC::JSNonFinalObject;
46
    static JSTestNamedAndIndexedSetterNoIdentifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
47
    {
48
        JSTestNamedAndIndexedSetterNoIdentifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedAndIndexedSetterNoIdentifierPrototype>(vm.heap)) JSTestNamedAndIndexedSetterNoIdentifierPrototype(vm, globalObject, structure);
49
        ptr->finishCreation(vm);
50
        return ptr;
51
    }
52
53
    DECLARE_INFO;
54
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
55
    {
56
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
57
    }
58
59
private:
60
    JSTestNamedAndIndexedSetterNoIdentifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
61
        : JSC::JSNonFinalObject(vm, structure)
62
    {
63
    }
64
65
    void finishCreation(JSC::VM&);
66
};
67
68
using JSTestNamedAndIndexedSetterNoIdentifierConstructor = JSDOMConstructorNotConstructable<JSTestNamedAndIndexedSetterNoIdentifier>;
69
70
template<> JSValue JSTestNamedAndIndexedSetterNoIdentifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
71
{
72
    UNUSED_PARAM(vm);
73
    return globalObject.functionPrototype();
74
}
75
76
template<> void JSTestNamedAndIndexedSetterNoIdentifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
77
{
78
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedAndIndexedSetterNoIdentifier::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
79
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedAndIndexedSetterNoIdentifier"))), ReadOnly | DontEnum);
80
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
81
}
82
83
template<> const ClassInfo JSTestNamedAndIndexedSetterNoIdentifierConstructor::s_info = { "TestNamedAndIndexedSetterNoIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterNoIdentifierConstructor) };
84
85
/* Hash table for prototype */
86
87
static const HashTableValue JSTestNamedAndIndexedSetterNoIdentifierPrototypeTableValues[] =
88
{
89
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedAndIndexedSetterNoIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedAndIndexedSetterNoIdentifierConstructor) } },
90
};
91
92
const ClassInfo JSTestNamedAndIndexedSetterNoIdentifierPrototype::s_info = { "TestNamedAndIndexedSetterNoIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterNoIdentifierPrototype) };
93
94
void JSTestNamedAndIndexedSetterNoIdentifierPrototype::finishCreation(VM& vm)
95
{
96
    Base::finishCreation(vm);
97
    reifyStaticProperties(vm, JSTestNamedAndIndexedSetterNoIdentifierPrototypeTableValues, *this);
98
}
99
100
const ClassInfo JSTestNamedAndIndexedSetterNoIdentifier::s_info = { "TestNamedAndIndexedSetterNoIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterNoIdentifier) };
101
102
JSTestNamedAndIndexedSetterNoIdentifier::JSTestNamedAndIndexedSetterNoIdentifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedAndIndexedSetterNoIdentifier>&& impl)
103
    : JSDOMWrapper<TestNamedAndIndexedSetterNoIdentifier>(structure, globalObject, WTFMove(impl))
104
{
105
}
106
107
void JSTestNamedAndIndexedSetterNoIdentifier::finishCreation(VM& vm)
108
{
109
    Base::finishCreation(vm);
110
    ASSERT(inherits(vm, info()));
111
112
}
113
114
JSObject* JSTestNamedAndIndexedSetterNoIdentifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
115
{
116
    return JSTestNamedAndIndexedSetterNoIdentifierPrototype::create(vm, &globalObject, JSTestNamedAndIndexedSetterNoIdentifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
117
}
118
119
JSObject* JSTestNamedAndIndexedSetterNoIdentifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
120
{
121
    return getDOMPrototype<JSTestNamedAndIndexedSetterNoIdentifier>(vm, globalObject);
122
}
123
124
JSValue JSTestNamedAndIndexedSetterNoIdentifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
125
{
126
    return getDOMConstructor<JSTestNamedAndIndexedSetterNoIdentifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
127
}
128
129
void JSTestNamedAndIndexedSetterNoIdentifier::destroy(JSC::JSCell* cell)
130
{
131
    JSTestNamedAndIndexedSetterNoIdentifier* thisObject = static_cast<JSTestNamedAndIndexedSetterNoIdentifier*>(cell);
132
    thisObject->JSTestNamedAndIndexedSetterNoIdentifier::~JSTestNamedAndIndexedSetterNoIdentifier();
133
}
134
135
bool JSTestNamedAndIndexedSetterNoIdentifier::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
136
{
137
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterNoIdentifier*>(object);
138
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
139
    auto optionalIndex = parseIndex(propertyName);
140
    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
141
        auto index = optionalIndex.value();
142
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
143
        return true;
144
    }
145
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
146
        return true;
147
    JSValue proto = thisObject->getPrototypeDirect();
148
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
149
        return false;
150
151
    if (!optionalIndex && thisObject->classInfo() == info() && !propertyName.isSymbol()) {
152
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
153
        if (!IDLDOMString::isNullValue(item)) {
154
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
155
            return true;
156
        }
157
    }
158
    return false;
159
}
160
161
bool JSTestNamedAndIndexedSetterNoIdentifier::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
162
{
163
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterNoIdentifier*>(object);
164
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
165
    if (LIKELY(index < thisObject->wrapped().length())) {
166
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
167
        return true;
168
    }
169
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
170
}
171
172
void JSTestNamedAndIndexedSetterNoIdentifier::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
173
{
174
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterNoIdentifier*>(object);
175
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
176
    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
177
        propertyNames.add(Identifier::from(state, i));
178
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
179
        propertyNames.add(Identifier::fromString(state, propertyName));
180
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
181
}
182
183
bool JSTestNamedAndIndexedSetterNoIdentifier::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
184
{
185
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterNoIdentifier*>(cell);
186
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
187
188
    if (auto index = parseIndex(propertyName)) {
189
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
190
        auto nativeValue = convert<IDLDOMString>(*state, value);
191
        RETURN_IF_EXCEPTION(throwScope, true);
192
        thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue));
193
        return true;
194
    }
195
196
    if (!propertyName.isSymbol()) {
197
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
198
        JSValue prototype = thisObject->getPrototypeDirect();
199
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
200
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
201
            auto nativeValue = convert<IDLDOMString>(*state, value);
202
            RETURN_IF_EXCEPTION(throwScope, true);
203
            thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
204
            return true;
205
        }
206
    }
207
208
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
209
}
210
211
bool JSTestNamedAndIndexedSetterNoIdentifier::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
212
{
213
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterNoIdentifier*>(cell);
214
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
215
216
    if (LIKELY(index <= MAX_ARRAY_INDEX)) {
217
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
218
        auto nativeValue = convert<IDLDOMString>(*state, value);
219
        RETURN_IF_EXCEPTION(throwScope, true);
220
        thisObject->wrapped().setItem(index, WTFMove(nativeValue));
221
        return true;
222
    }
223
224
    Identifier propertyName = Identifier::from(state, index);
225
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
226
    JSValue prototype = thisObject->getPrototypeDirect();
227
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
228
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
229
        auto nativeValue = convert<IDLDOMString>(*state, value);
230
        RETURN_IF_EXCEPTION(throwScope, true);
231
        thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
232
        return true;
233
    }
234
235
    return Base::putByIndex(cell, state, index, value, shouldThrow);
236
}
237
238
bool JSTestNamedAndIndexedSetterNoIdentifier::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
239
{
240
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterNoIdentifier*>(object);
241
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
242
243
    if (auto index = parseIndex(propertyName)) {
244
        if (!propertyDescriptor.isDataDescriptor())
245
            return false;
246
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
247
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
248
        RETURN_IF_EXCEPTION(throwScope, true);
249
        thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue));
250
        return true;
251
    }
252
253
    if (!propertyName.isSymbol()) {
254
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
255
        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
256
            if (!propertyDescriptor.isDataDescriptor())
257
                return false;
258
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
259
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
260
            RETURN_IF_EXCEPTION(throwScope, true);
261
            thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
262
            return true;
263
        }
264
    }
265
266
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
267
    newPropertyDescriptor.setConfigurable(true);
268
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
269
}
270
271
EncodedJSValue jsTestNamedAndIndexedSetterNoIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
272
{
273
    VM& vm = state->vm();
274
    auto throwScope = DECLARE_THROW_SCOPE(vm);
275
    auto* prototype = jsDynamicDowncast<JSTestNamedAndIndexedSetterNoIdentifierPrototype*>(vm, JSValue::decode(thisValue));
276
    if (UNLIKELY(!prototype))
277
        return throwVMTypeError(state, throwScope);
278
    return JSValue::encode(JSTestNamedAndIndexedSetterNoIdentifier::getConstructor(state->vm(), prototype->globalObject()));
279
}
280
281
bool setJSTestNamedAndIndexedSetterNoIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
282
{
283
    VM& vm = state->vm();
284
    auto throwScope = DECLARE_THROW_SCOPE(vm);
285
    auto* prototype = jsDynamicDowncast<JSTestNamedAndIndexedSetterNoIdentifierPrototype*>(vm, JSValue::decode(thisValue));
286
    if (UNLIKELY(!prototype)) {
287
        throwVMTypeError(state, throwScope);
288
        return false;
289
    }
290
    // Shadowing a built-in constructor
291
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
292
}
293
294
bool JSTestNamedAndIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
295
{
296
    UNUSED_PARAM(handle);
297
    UNUSED_PARAM(visitor);
298
    return false;
299
}
300
301
void JSTestNamedAndIndexedSetterNoIdentifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
302
{
303
    auto* jsTestNamedAndIndexedSetterNoIdentifier = static_cast<JSTestNamedAndIndexedSetterNoIdentifier*>(handle.slot()->asCell());
304
    auto& world = *static_cast<DOMWrapperWorld*>(context);
305
    uncacheWrapper(world, &jsTestNamedAndIndexedSetterNoIdentifier->wrapped(), jsTestNamedAndIndexedSetterNoIdentifier);
306
}
307
308
#if ENABLE(BINDING_INTEGRITY)
309
#if PLATFORM(WIN)
310
#pragma warning(disable: 4483)
311
extern "C" { extern void (*const __identifier("??_7TestNamedAndIndexedSetterNoIdentifier@WebCore@@6B@")[])(); }
312
#else
313
extern "C" { extern void* _ZTVN7WebCore37TestNamedAndIndexedSetterNoIdentifierE[]; }
314
#endif
315
#endif
316
317
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedAndIndexedSetterNoIdentifier>&& impl)
318
{
319
320
#if ENABLE(BINDING_INTEGRITY)
321
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
322
#if PLATFORM(WIN)
323
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedAndIndexedSetterNoIdentifier@WebCore@@6B@"));
324
#else
325
    void* expectedVTablePointer = &_ZTVN7WebCore37TestNamedAndIndexedSetterNoIdentifierE[2];
326
#if COMPILER(CLANG)
327
    // If this fails TestNamedAndIndexedSetterNoIdentifier does not have a vtable, so you need to add the
328
    // ImplementationLacksVTable attribute to the interface definition
329
    static_assert(__is_polymorphic(TestNamedAndIndexedSetterNoIdentifier), "TestNamedAndIndexedSetterNoIdentifier is not polymorphic");
330
#endif
331
#endif
332
    // If you hit this assertion you either have a use after free bug, or
333
    // TestNamedAndIndexedSetterNoIdentifier has subclasses. If TestNamedAndIndexedSetterNoIdentifier has subclasses that get passed
334
    // to toJS() we currently require TestNamedAndIndexedSetterNoIdentifier you to opt out of binding hardening
335
    // by adding the SkipVTableValidation attribute to the interface IDL definition
336
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
337
#endif
338
    return createWrapper<TestNamedAndIndexedSetterNoIdentifier>(globalObject, WTFMove(impl));
339
}
340
341
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedAndIndexedSetterNoIdentifier& impl)
342
{
343
    return wrap(state, globalObject, impl);
344
}
345
346
TestNamedAndIndexedSetterNoIdentifier* JSTestNamedAndIndexedSetterNoIdentifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
347
{
348
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedAndIndexedSetterNoIdentifier*>(vm, value))
349
        return &wrapper->wrapped();
350
    return nullptr;
351
}
352
353
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedAndIndexedSetterNoIdentifier.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedAndIndexedSetterNoIdentifier : public JSDOMWrapper<TestNamedAndIndexedSetterNoIdentifier> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedAndIndexedSetterNoIdentifier>;
32
    static JSTestNamedAndIndexedSetterNoIdentifier* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedAndIndexedSetterNoIdentifier>&& impl)
33
    {
34
        JSTestNamedAndIndexedSetterNoIdentifier* ptr = new (NotNull, JSC::allocateCell<JSTestNamedAndIndexedSetterNoIdentifier>(globalObject->vm().heap)) JSTestNamedAndIndexedSetterNoIdentifier(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedAndIndexedSetterNoIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedAndIndexedSetterNoIdentifier(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedAndIndexedSetterNoIdentifier>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedAndIndexedSetterNoIdentifierOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedAndIndexedSetterNoIdentifier*)
73
{
74
    static NeverDestroyed<JSTestNamedAndIndexedSetterNoIdentifierOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedAndIndexedSetterNoIdentifier* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedAndIndexedSetterNoIdentifier&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedAndIndexedSetterNoIdentifier* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedAndIndexedSetterNoIdentifier>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedAndIndexedSetterNoIdentifier>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedAndIndexedSetterNoIdentifier> {
89
    using WrapperClass = JSTestNamedAndIndexedSetterNoIdentifier;
90
    using ToWrappedReturnType = TestNamedAndIndexedSetterNoIdentifier*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp +353 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedAndIndexedSetterThrowingException.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include "URL.h"
30
#include <runtime/FunctionPrototype.h>
31
#include <runtime/PropertyNameArray.h>
32
#include <wtf/GetPtr.h>
33
34
using namespace JSC;
35
36
namespace WebCore {
37
38
// Attributes
39
40
JSC::EncodedJSValue jsTestNamedAndIndexedSetterThrowingExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
41
bool setJSTestNamedAndIndexedSetterThrowingExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
42
43
class JSTestNamedAndIndexedSetterThrowingExceptionPrototype : public JSC::JSNonFinalObject {
44
public:
45
    using Base = JSC::JSNonFinalObject;
46
    static JSTestNamedAndIndexedSetterThrowingExceptionPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
47
    {
48
        JSTestNamedAndIndexedSetterThrowingExceptionPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedAndIndexedSetterThrowingExceptionPrototype>(vm.heap)) JSTestNamedAndIndexedSetterThrowingExceptionPrototype(vm, globalObject, structure);
49
        ptr->finishCreation(vm);
50
        return ptr;
51
    }
52
53
    DECLARE_INFO;
54
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
55
    {
56
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
57
    }
58
59
private:
60
    JSTestNamedAndIndexedSetterThrowingExceptionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
61
        : JSC::JSNonFinalObject(vm, structure)
62
    {
63
    }
64
65
    void finishCreation(JSC::VM&);
66
};
67
68
using JSTestNamedAndIndexedSetterThrowingExceptionConstructor = JSDOMConstructorNotConstructable<JSTestNamedAndIndexedSetterThrowingException>;
69
70
template<> JSValue JSTestNamedAndIndexedSetterThrowingExceptionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
71
{
72
    UNUSED_PARAM(vm);
73
    return globalObject.functionPrototype();
74
}
75
76
template<> void JSTestNamedAndIndexedSetterThrowingExceptionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
77
{
78
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedAndIndexedSetterThrowingException::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
79
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedAndIndexedSetterThrowingException"))), ReadOnly | DontEnum);
80
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
81
}
82
83
template<> const ClassInfo JSTestNamedAndIndexedSetterThrowingExceptionConstructor::s_info = { "TestNamedAndIndexedSetterThrowingException", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterThrowingExceptionConstructor) };
84
85
/* Hash table for prototype */
86
87
static const HashTableValue JSTestNamedAndIndexedSetterThrowingExceptionPrototypeTableValues[] =
88
{
89
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedAndIndexedSetterThrowingExceptionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedAndIndexedSetterThrowingExceptionConstructor) } },
90
};
91
92
const ClassInfo JSTestNamedAndIndexedSetterThrowingExceptionPrototype::s_info = { "TestNamedAndIndexedSetterThrowingExceptionPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterThrowingExceptionPrototype) };
93
94
void JSTestNamedAndIndexedSetterThrowingExceptionPrototype::finishCreation(VM& vm)
95
{
96
    Base::finishCreation(vm);
97
    reifyStaticProperties(vm, JSTestNamedAndIndexedSetterThrowingExceptionPrototypeTableValues, *this);
98
}
99
100
const ClassInfo JSTestNamedAndIndexedSetterThrowingException::s_info = { "TestNamedAndIndexedSetterThrowingException", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterThrowingException) };
101
102
JSTestNamedAndIndexedSetterThrowingException::JSTestNamedAndIndexedSetterThrowingException(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedAndIndexedSetterThrowingException>&& impl)
103
    : JSDOMWrapper<TestNamedAndIndexedSetterThrowingException>(structure, globalObject, WTFMove(impl))
104
{
105
}
106
107
void JSTestNamedAndIndexedSetterThrowingException::finishCreation(VM& vm)
108
{
109
    Base::finishCreation(vm);
110
    ASSERT(inherits(vm, info()));
111
112
}
113
114
JSObject* JSTestNamedAndIndexedSetterThrowingException::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
115
{
116
    return JSTestNamedAndIndexedSetterThrowingExceptionPrototype::create(vm, &globalObject, JSTestNamedAndIndexedSetterThrowingExceptionPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
117
}
118
119
JSObject* JSTestNamedAndIndexedSetterThrowingException::prototype(VM& vm, JSDOMGlobalObject& globalObject)
120
{
121
    return getDOMPrototype<JSTestNamedAndIndexedSetterThrowingException>(vm, globalObject);
122
}
123
124
JSValue JSTestNamedAndIndexedSetterThrowingException::getConstructor(VM& vm, const JSGlobalObject* globalObject)
125
{
126
    return getDOMConstructor<JSTestNamedAndIndexedSetterThrowingExceptionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
127
}
128
129
void JSTestNamedAndIndexedSetterThrowingException::destroy(JSC::JSCell* cell)
130
{
131
    JSTestNamedAndIndexedSetterThrowingException* thisObject = static_cast<JSTestNamedAndIndexedSetterThrowingException*>(cell);
132
    thisObject->JSTestNamedAndIndexedSetterThrowingException::~JSTestNamedAndIndexedSetterThrowingException();
133
}
134
135
bool JSTestNamedAndIndexedSetterThrowingException::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
136
{
137
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterThrowingException*>(object);
138
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
139
    auto optionalIndex = parseIndex(propertyName);
140
    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
141
        auto index = optionalIndex.value();
142
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
143
        return true;
144
    }
145
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
146
        return true;
147
    JSValue proto = thisObject->getPrototypeDirect();
148
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
149
        return false;
150
151
    if (!optionalIndex && thisObject->classInfo() == info() && !propertyName.isSymbol()) {
152
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
153
        if (!IDLDOMString::isNullValue(item)) {
154
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
155
            return true;
156
        }
157
    }
158
    return false;
159
}
160
161
bool JSTestNamedAndIndexedSetterThrowingException::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
162
{
163
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterThrowingException*>(object);
164
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
165
    if (LIKELY(index < thisObject->wrapped().length())) {
166
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
167
        return true;
168
    }
169
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
170
}
171
172
void JSTestNamedAndIndexedSetterThrowingException::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
173
{
174
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterThrowingException*>(object);
175
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
176
    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
177
        propertyNames.add(Identifier::from(state, i));
178
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
179
        propertyNames.add(Identifier::fromString(state, propertyName));
180
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
181
}
182
183
bool JSTestNamedAndIndexedSetterThrowingException::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
184
{
185
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterThrowingException*>(cell);
186
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
187
188
    if (auto index = parseIndex(propertyName)) {
189
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
190
        auto nativeValue = convert<IDLDOMString>(*state, value);
191
        RETURN_IF_EXCEPTION(throwScope, true);
192
        propagateException(*state, throwScope, thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue)));
193
        return true;
194
    }
195
196
    if (!propertyName.isSymbol()) {
197
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
198
        JSValue prototype = thisObject->getPrototypeDirect();
199
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
200
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
201
            auto nativeValue = convert<IDLDOMString>(*state, value);
202
            RETURN_IF_EXCEPTION(throwScope, true);
203
            propagateException(*state, throwScope, thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue)));
204
            return true;
205
        }
206
    }
207
208
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
209
}
210
211
bool JSTestNamedAndIndexedSetterThrowingException::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
212
{
213
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterThrowingException*>(cell);
214
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
215
216
    if (LIKELY(index <= MAX_ARRAY_INDEX)) {
217
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
218
        auto nativeValue = convert<IDLDOMString>(*state, value);
219
        RETURN_IF_EXCEPTION(throwScope, true);
220
        propagateException(*state, throwScope, thisObject->wrapped().setItem(index, WTFMove(nativeValue)));
221
        return true;
222
    }
223
224
    Identifier propertyName = Identifier::from(state, index);
225
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
226
    JSValue prototype = thisObject->getPrototypeDirect();
227
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
228
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
229
        auto nativeValue = convert<IDLDOMString>(*state, value);
230
        RETURN_IF_EXCEPTION(throwScope, true);
231
        propagateException(*state, throwScope, thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue)));
232
        return true;
233
    }
234
235
    return Base::putByIndex(cell, state, index, value, shouldThrow);
236
}
237
238
bool JSTestNamedAndIndexedSetterThrowingException::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
239
{
240
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterThrowingException*>(object);
241
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
242
243
    if (auto index = parseIndex(propertyName)) {
244
        if (!propertyDescriptor.isDataDescriptor())
245
            return false;
246
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
247
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
248
        RETURN_IF_EXCEPTION(throwScope, true);
249
        propagateException(*state, throwScope, thisObject->wrapped().setItem(index.value(), WTFMove(nativeValue)));
250
        return true;
251
    }
252
253
    if (!propertyName.isSymbol()) {
254
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
255
        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
256
            if (!propertyDescriptor.isDataDescriptor())
257
                return false;
258
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
259
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
260
            RETURN_IF_EXCEPTION(throwScope, true);
261
            propagateException(*state, throwScope, thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue)));
262
            return true;
263
        }
264
    }
265
266
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
267
    newPropertyDescriptor.setConfigurable(true);
268
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
269
}
270
271
EncodedJSValue jsTestNamedAndIndexedSetterThrowingExceptionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
272
{
273
    VM& vm = state->vm();
274
    auto throwScope = DECLARE_THROW_SCOPE(vm);
275
    auto* prototype = jsDynamicDowncast<JSTestNamedAndIndexedSetterThrowingExceptionPrototype*>(vm, JSValue::decode(thisValue));
276
    if (UNLIKELY(!prototype))
277
        return throwVMTypeError(state, throwScope);
278
    return JSValue::encode(JSTestNamedAndIndexedSetterThrowingException::getConstructor(state->vm(), prototype->globalObject()));
279
}
280
281
bool setJSTestNamedAndIndexedSetterThrowingExceptionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
282
{
283
    VM& vm = state->vm();
284
    auto throwScope = DECLARE_THROW_SCOPE(vm);
285
    auto* prototype = jsDynamicDowncast<JSTestNamedAndIndexedSetterThrowingExceptionPrototype*>(vm, JSValue::decode(thisValue));
286
    if (UNLIKELY(!prototype)) {
287
        throwVMTypeError(state, throwScope);
288
        return false;
289
    }
290
    // Shadowing a built-in constructor
291
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
292
}
293
294
bool JSTestNamedAndIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
295
{
296
    UNUSED_PARAM(handle);
297
    UNUSED_PARAM(visitor);
298
    return false;
299
}
300
301
void JSTestNamedAndIndexedSetterThrowingExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
302
{
303
    auto* jsTestNamedAndIndexedSetterThrowingException = static_cast<JSTestNamedAndIndexedSetterThrowingException*>(handle.slot()->asCell());
304
    auto& world = *static_cast<DOMWrapperWorld*>(context);
305
    uncacheWrapper(world, &jsTestNamedAndIndexedSetterThrowingException->wrapped(), jsTestNamedAndIndexedSetterThrowingException);
306
}
307
308
#if ENABLE(BINDING_INTEGRITY)
309
#if PLATFORM(WIN)
310
#pragma warning(disable: 4483)
311
extern "C" { extern void (*const __identifier("??_7TestNamedAndIndexedSetterThrowingException@WebCore@@6B@")[])(); }
312
#else
313
extern "C" { extern void* _ZTVN7WebCore42TestNamedAndIndexedSetterThrowingExceptionE[]; }
314
#endif
315
#endif
316
317
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedAndIndexedSetterThrowingException>&& impl)
318
{
319
320
#if ENABLE(BINDING_INTEGRITY)
321
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
322
#if PLATFORM(WIN)
323
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedAndIndexedSetterThrowingException@WebCore@@6B@"));
324
#else
325
    void* expectedVTablePointer = &_ZTVN7WebCore42TestNamedAndIndexedSetterThrowingExceptionE[2];
326
#if COMPILER(CLANG)
327
    // If this fails TestNamedAndIndexedSetterThrowingException does not have a vtable, so you need to add the
328
    // ImplementationLacksVTable attribute to the interface definition
329
    static_assert(__is_polymorphic(TestNamedAndIndexedSetterThrowingException), "TestNamedAndIndexedSetterThrowingException is not polymorphic");
330
#endif
331
#endif
332
    // If you hit this assertion you either have a use after free bug, or
333
    // TestNamedAndIndexedSetterThrowingException has subclasses. If TestNamedAndIndexedSetterThrowingException has subclasses that get passed
334
    // to toJS() we currently require TestNamedAndIndexedSetterThrowingException you to opt out of binding hardening
335
    // by adding the SkipVTableValidation attribute to the interface IDL definition
336
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
337
#endif
338
    return createWrapper<TestNamedAndIndexedSetterThrowingException>(globalObject, WTFMove(impl));
339
}
340
341
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedAndIndexedSetterThrowingException& impl)
342
{
343
    return wrap(state, globalObject, impl);
344
}
345
346
TestNamedAndIndexedSetterThrowingException* JSTestNamedAndIndexedSetterThrowingException::toWrapped(JSC::VM& vm, JSC::JSValue value)
347
{
348
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedAndIndexedSetterThrowingException*>(vm, value))
349
        return &wrapper->wrapped();
350
    return nullptr;
351
}
352
353
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedAndIndexedSetterThrowingException.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedAndIndexedSetterThrowingException : public JSDOMWrapper<TestNamedAndIndexedSetterThrowingException> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedAndIndexedSetterThrowingException>;
32
    static JSTestNamedAndIndexedSetterThrowingException* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedAndIndexedSetterThrowingException>&& impl)
33
    {
34
        JSTestNamedAndIndexedSetterThrowingException* ptr = new (NotNull, JSC::allocateCell<JSTestNamedAndIndexedSetterThrowingException>(globalObject->vm().heap)) JSTestNamedAndIndexedSetterThrowingException(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedAndIndexedSetterThrowingException* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedAndIndexedSetterThrowingException(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedAndIndexedSetterThrowingException>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedAndIndexedSetterThrowingExceptionOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedAndIndexedSetterThrowingException*)
73
{
74
    static NeverDestroyed<JSTestNamedAndIndexedSetterThrowingExceptionOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedAndIndexedSetterThrowingException* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedAndIndexedSetterThrowingException&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedAndIndexedSetterThrowingException* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedAndIndexedSetterThrowingException>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedAndIndexedSetterThrowingException>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedAndIndexedSetterThrowingException> {
89
    using WrapperClass = JSTestNamedAndIndexedSetterThrowingException;
90
    using ToWrappedReturnType = TestNamedAndIndexedSetterThrowingException*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp +406 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedAndIndexedSetterWithIdentifier.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMOperation.h"
29
#include "JSDOMWrapperCache.h"
30
#include "URL.h"
31
#include <runtime/FunctionPrototype.h>
32
#include <runtime/PropertyNameArray.h>
33
#include <wtf/GetPtr.h>
34
35
using namespace JSC;
36
37
namespace WebCore {
38
39
// Functions
40
41
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetter(JSC::ExecState*);
42
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter(JSC::ExecState*);
43
44
// Attributes
45
46
JSC::EncodedJSValue jsTestNamedAndIndexedSetterWithIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47
bool setJSTestNamedAndIndexedSetterWithIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
48
49
class JSTestNamedAndIndexedSetterWithIdentifierPrototype : public JSC::JSNonFinalObject {
50
public:
51
    using Base = JSC::JSNonFinalObject;
52
    static JSTestNamedAndIndexedSetterWithIdentifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
53
    {
54
        JSTestNamedAndIndexedSetterWithIdentifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedAndIndexedSetterWithIdentifierPrototype>(vm.heap)) JSTestNamedAndIndexedSetterWithIdentifierPrototype(vm, globalObject, structure);
55
        ptr->finishCreation(vm);
56
        return ptr;
57
    }
58
59
    DECLARE_INFO;
60
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
61
    {
62
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
63
    }
64
65
private:
66
    JSTestNamedAndIndexedSetterWithIdentifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
67
        : JSC::JSNonFinalObject(vm, structure)
68
    {
69
    }
70
71
    void finishCreation(JSC::VM&);
72
};
73
74
using JSTestNamedAndIndexedSetterWithIdentifierConstructor = JSDOMConstructorNotConstructable<JSTestNamedAndIndexedSetterWithIdentifier>;
75
76
template<> JSValue JSTestNamedAndIndexedSetterWithIdentifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
77
{
78
    UNUSED_PARAM(vm);
79
    return globalObject.functionPrototype();
80
}
81
82
template<> void JSTestNamedAndIndexedSetterWithIdentifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
83
{
84
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedAndIndexedSetterWithIdentifier::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
85
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedAndIndexedSetterWithIdentifier"))), ReadOnly | DontEnum);
86
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
87
}
88
89
template<> const ClassInfo JSTestNamedAndIndexedSetterWithIdentifierConstructor::s_info = { "TestNamedAndIndexedSetterWithIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterWithIdentifierConstructor) };
90
91
/* Hash table for prototype */
92
93
static const HashTableValue JSTestNamedAndIndexedSetterWithIdentifierPrototypeTableValues[] =
94
{
95
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedAndIndexedSetterWithIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedAndIndexedSetterWithIdentifierConstructor) } },
96
    { "namedSetter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetter), (intptr_t) (2) } },
97
    { "indexedSetter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter), (intptr_t) (2) } },
98
};
99
100
const ClassInfo JSTestNamedAndIndexedSetterWithIdentifierPrototype::s_info = { "TestNamedAndIndexedSetterWithIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterWithIdentifierPrototype) };
101
102
void JSTestNamedAndIndexedSetterWithIdentifierPrototype::finishCreation(VM& vm)
103
{
104
    Base::finishCreation(vm);
105
    reifyStaticProperties(vm, JSTestNamedAndIndexedSetterWithIdentifierPrototypeTableValues, *this);
106
}
107
108
const ClassInfo JSTestNamedAndIndexedSetterWithIdentifier::s_info = { "TestNamedAndIndexedSetterWithIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedAndIndexedSetterWithIdentifier) };
109
110
JSTestNamedAndIndexedSetterWithIdentifier::JSTestNamedAndIndexedSetterWithIdentifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedAndIndexedSetterWithIdentifier>&& impl)
111
    : JSDOMWrapper<TestNamedAndIndexedSetterWithIdentifier>(structure, globalObject, WTFMove(impl))
112
{
113
}
114
115
void JSTestNamedAndIndexedSetterWithIdentifier::finishCreation(VM& vm)
116
{
117
    Base::finishCreation(vm);
118
    ASSERT(inherits(vm, info()));
119
120
}
121
122
JSObject* JSTestNamedAndIndexedSetterWithIdentifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
123
{
124
    return JSTestNamedAndIndexedSetterWithIdentifierPrototype::create(vm, &globalObject, JSTestNamedAndIndexedSetterWithIdentifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
125
}
126
127
JSObject* JSTestNamedAndIndexedSetterWithIdentifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
128
{
129
    return getDOMPrototype<JSTestNamedAndIndexedSetterWithIdentifier>(vm, globalObject);
130
}
131
132
JSValue JSTestNamedAndIndexedSetterWithIdentifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
133
{
134
    return getDOMConstructor<JSTestNamedAndIndexedSetterWithIdentifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
135
}
136
137
void JSTestNamedAndIndexedSetterWithIdentifier::destroy(JSC::JSCell* cell)
138
{
139
    JSTestNamedAndIndexedSetterWithIdentifier* thisObject = static_cast<JSTestNamedAndIndexedSetterWithIdentifier*>(cell);
140
    thisObject->JSTestNamedAndIndexedSetterWithIdentifier::~JSTestNamedAndIndexedSetterWithIdentifier();
141
}
142
143
bool JSTestNamedAndIndexedSetterWithIdentifier::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
144
{
145
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterWithIdentifier*>(object);
146
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
147
    auto optionalIndex = parseIndex(propertyName);
148
    if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {
149
        auto index = optionalIndex.value();
150
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
151
        return true;
152
    }
153
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
154
        return true;
155
    JSValue proto = thisObject->getPrototypeDirect();
156
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
157
        return false;
158
159
    if (!optionalIndex && thisObject->classInfo() == info() && !propertyName.isSymbol()) {
160
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
161
        if (!IDLDOMString::isNullValue(item)) {
162
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
163
            return true;
164
        }
165
    }
166
    return false;
167
}
168
169
bool JSTestNamedAndIndexedSetterWithIdentifier::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
170
{
171
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterWithIdentifier*>(object);
172
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
173
    if (LIKELY(index < thisObject->wrapped().length())) {
174
        slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, thisObject->wrapped().item(index)));
175
        return true;
176
    }
177
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
178
}
179
180
void JSTestNamedAndIndexedSetterWithIdentifier::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
181
{
182
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterWithIdentifier*>(object);
183
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
184
    for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
185
        propertyNames.add(Identifier::from(state, i));
186
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
187
        propertyNames.add(Identifier::fromString(state, propertyName));
188
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
189
}
190
191
bool JSTestNamedAndIndexedSetterWithIdentifier::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
192
{
193
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterWithIdentifier*>(cell);
194
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
195
196
    if (auto index = parseIndex(propertyName)) {
197
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
198
        auto nativeValue = convert<IDLDOMString>(*state, value);
199
        RETURN_IF_EXCEPTION(throwScope, true);
200
        thisObject->wrapped().indexedSetter(index.value(), WTFMove(nativeValue));
201
        return true;
202
    }
203
204
    if (!propertyName.isSymbol()) {
205
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
206
        JSValue prototype = thisObject->getPrototypeDirect();
207
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
208
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
209
            auto nativeValue = convert<IDLDOMString>(*state, value);
210
            RETURN_IF_EXCEPTION(throwScope, true);
211
            thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
212
            return true;
213
        }
214
    }
215
216
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
217
}
218
219
bool JSTestNamedAndIndexedSetterWithIdentifier::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
220
{
221
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterWithIdentifier*>(cell);
222
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
223
224
    if (LIKELY(index <= MAX_ARRAY_INDEX)) {
225
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
226
        auto nativeValue = convert<IDLDOMString>(*state, value);
227
        RETURN_IF_EXCEPTION(throwScope, true);
228
        thisObject->wrapped().indexedSetter(index, WTFMove(nativeValue));
229
        return true;
230
    }
231
232
    Identifier propertyName = Identifier::from(state, index);
233
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
234
    JSValue prototype = thisObject->getPrototypeDirect();
235
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
236
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
237
        auto nativeValue = convert<IDLDOMString>(*state, value);
238
        RETURN_IF_EXCEPTION(throwScope, true);
239
        thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
240
        return true;
241
    }
242
243
    return Base::putByIndex(cell, state, index, value, shouldThrow);
244
}
245
246
bool JSTestNamedAndIndexedSetterWithIdentifier::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
247
{
248
    auto* thisObject = jsCast<JSTestNamedAndIndexedSetterWithIdentifier*>(object);
249
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
250
251
    if (auto index = parseIndex(propertyName)) {
252
        if (!propertyDescriptor.isDataDescriptor())
253
            return false;
254
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
255
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
256
        RETURN_IF_EXCEPTION(throwScope, true);
257
        thisObject->wrapped().indexedSetter(index.value(), WTFMove(nativeValue));
258
        return true;
259
    }
260
261
    if (!propertyName.isSymbol()) {
262
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
263
        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
264
            if (!propertyDescriptor.isDataDescriptor())
265
                return false;
266
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
267
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
268
            RETURN_IF_EXCEPTION(throwScope, true);
269
            thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
270
            return true;
271
        }
272
    }
273
274
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
275
    newPropertyDescriptor.setConfigurable(true);
276
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
277
}
278
279
template<> inline JSTestNamedAndIndexedSetterWithIdentifier* IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::cast(ExecState& state)
280
{
281
    return jsDynamicDowncast<JSTestNamedAndIndexedSetterWithIdentifier*>(state.vm(), state.thisValue());
282
}
283
284
EncodedJSValue jsTestNamedAndIndexedSetterWithIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
285
{
286
    VM& vm = state->vm();
287
    auto throwScope = DECLARE_THROW_SCOPE(vm);
288
    auto* prototype = jsDynamicDowncast<JSTestNamedAndIndexedSetterWithIdentifierPrototype*>(vm, JSValue::decode(thisValue));
289
    if (UNLIKELY(!prototype))
290
        return throwVMTypeError(state, throwScope);
291
    return JSValue::encode(JSTestNamedAndIndexedSetterWithIdentifier::getConstructor(state->vm(), prototype->globalObject()));
292
}
293
294
bool setJSTestNamedAndIndexedSetterWithIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
295
{
296
    VM& vm = state->vm();
297
    auto throwScope = DECLARE_THROW_SCOPE(vm);
298
    auto* prototype = jsDynamicDowncast<JSTestNamedAndIndexedSetterWithIdentifierPrototype*>(vm, JSValue::decode(thisValue));
299
    if (UNLIKELY(!prototype)) {
300
        throwVMTypeError(state, throwScope);
301
        return false;
302
    }
303
    // Shadowing a built-in constructor
304
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
305
}
306
307
static inline JSC::EncodedJSValue jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetterBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
308
{
309
    UNUSED_PARAM(state);
310
    UNUSED_PARAM(throwScope);
311
    auto& impl = castedThis->wrapped();
312
    if (UNLIKELY(state->argumentCount() < 2))
313
        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
314
    auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
315
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
316
    auto value = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
317
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
318
    impl.namedSetter(WTFMove(name), WTFMove(value));
319
    return JSValue::encode(jsUndefined());
320
}
321
322
EncodedJSValue JSC_HOST_CALL jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetter(ExecState* state)
323
{
324
    return IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::call<jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionNamedSetterBody>(*state, "namedSetter");
325
}
326
327
static inline JSC::EncodedJSValue jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
328
{
329
    UNUSED_PARAM(state);
330
    UNUSED_PARAM(throwScope);
331
    auto& impl = castedThis->wrapped();
332
    if (UNLIKELY(state->argumentCount() < 2))
333
        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
334
    auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0));
335
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
336
    auto value = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
337
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
338
    impl.indexedSetter(WTFMove(index), WTFMove(value));
339
    return JSValue::encode(jsUndefined());
340
}
341
342
EncodedJSValue JSC_HOST_CALL jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetter(ExecState* state)
343
{
344
    return IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::call<jsTestNamedAndIndexedSetterWithIdentifierPrototypeFunctionIndexedSetterBody>(*state, "indexedSetter");
345
}
346
347
bool JSTestNamedAndIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
348
{
349
    UNUSED_PARAM(handle);
350
    UNUSED_PARAM(visitor);
351
    return false;
352
}
353
354
void JSTestNamedAndIndexedSetterWithIdentifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
355
{
356
    auto* jsTestNamedAndIndexedSetterWithIdentifier = static_cast<JSTestNamedAndIndexedSetterWithIdentifier*>(handle.slot()->asCell());
357
    auto& world = *static_cast<DOMWrapperWorld*>(context);
358
    uncacheWrapper(world, &jsTestNamedAndIndexedSetterWithIdentifier->wrapped(), jsTestNamedAndIndexedSetterWithIdentifier);
359
}
360
361
#if ENABLE(BINDING_INTEGRITY)
362
#if PLATFORM(WIN)
363
#pragma warning(disable: 4483)
364
extern "C" { extern void (*const __identifier("??_7TestNamedAndIndexedSetterWithIdentifier@WebCore@@6B@")[])(); }
365
#else
366
extern "C" { extern void* _ZTVN7WebCore39TestNamedAndIndexedSetterWithIdentifierE[]; }
367
#endif
368
#endif
369
370
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedAndIndexedSetterWithIdentifier>&& impl)
371
{
372
373
#if ENABLE(BINDING_INTEGRITY)
374
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
375
#if PLATFORM(WIN)
376
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedAndIndexedSetterWithIdentifier@WebCore@@6B@"));
377
#else
378
    void* expectedVTablePointer = &_ZTVN7WebCore39TestNamedAndIndexedSetterWithIdentifierE[2];
379
#if COMPILER(CLANG)
380
    // If this fails TestNamedAndIndexedSetterWithIdentifier does not have a vtable, so you need to add the
381
    // ImplementationLacksVTable attribute to the interface definition
382
    static_assert(__is_polymorphic(TestNamedAndIndexedSetterWithIdentifier), "TestNamedAndIndexedSetterWithIdentifier is not polymorphic");
383
#endif
384
#endif
385
    // If you hit this assertion you either have a use after free bug, or
386
    // TestNamedAndIndexedSetterWithIdentifier has subclasses. If TestNamedAndIndexedSetterWithIdentifier has subclasses that get passed
387
    // to toJS() we currently require TestNamedAndIndexedSetterWithIdentifier you to opt out of binding hardening
388
    // by adding the SkipVTableValidation attribute to the interface IDL definition
389
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
390
#endif
391
    return createWrapper<TestNamedAndIndexedSetterWithIdentifier>(globalObject, WTFMove(impl));
392
}
393
394
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedAndIndexedSetterWithIdentifier& impl)
395
{
396
    return wrap(state, globalObject, impl);
397
}
398
399
TestNamedAndIndexedSetterWithIdentifier* JSTestNamedAndIndexedSetterWithIdentifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
400
{
401
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedAndIndexedSetterWithIdentifier*>(vm, value))
402
        return &wrapper->wrapped();
403
    return nullptr;
404
}
405
406
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedAndIndexedSetterWithIdentifier.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedAndIndexedSetterWithIdentifier : public JSDOMWrapper<TestNamedAndIndexedSetterWithIdentifier> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedAndIndexedSetterWithIdentifier>;
32
    static JSTestNamedAndIndexedSetterWithIdentifier* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedAndIndexedSetterWithIdentifier>&& impl)
33
    {
34
        JSTestNamedAndIndexedSetterWithIdentifier* ptr = new (NotNull, JSC::allocateCell<JSTestNamedAndIndexedSetterWithIdentifier>(globalObject->vm().heap)) JSTestNamedAndIndexedSetterWithIdentifier(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedAndIndexedSetterWithIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedAndIndexedSetterWithIdentifier(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedAndIndexedSetterWithIdentifier>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedAndIndexedSetterWithIdentifierOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedAndIndexedSetterWithIdentifier*)
73
{
74
    static NeverDestroyed<JSTestNamedAndIndexedSetterWithIdentifierOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedAndIndexedSetterWithIdentifier* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedAndIndexedSetterWithIdentifier&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedAndIndexedSetterWithIdentifier* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedAndIndexedSetterWithIdentifier>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedAndIndexedSetterWithIdentifier>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedAndIndexedSetterWithIdentifier> {
89
    using WrapperClass = JSTestNamedAndIndexedSetterWithIdentifier;
90
    using ToWrappedReturnType = TestNamedAndIndexedSetterWithIdentifier*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h -1 / +1 lines
Lines 41-46 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h_sec1
41
    static TestNamedDeleterNoIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
41
    static TestNamedDeleterNoIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
44
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static void destroy(JSC::JSCell*);
47
    static void destroy(JSC::JSCell*);
Lines 52-58 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h_sec2
52
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
    }
54
    }
54
55
55
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
57
public:
57
public:
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h -1 / +1 lines
Lines 41-46 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h_sec1
41
    static TestNamedDeleterThrowingException* toWrapped(JSC::VM&, JSC::JSValue);
41
    static TestNamedDeleterThrowingException* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
44
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static void destroy(JSC::JSCell*);
47
    static void destroy(JSC::JSCell*);
Lines 52-58 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h_sec2
52
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
    }
54
    }
54
55
55
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
57
public:
57
public:
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp -8 / +8 lines
Lines 37-43 namespace WebCore { Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp_sec1
37
37
38
// Functions
38
// Functions
39
39
40
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedDeleterWithIdentifierPrototypeFunctionRemove(JSC::ExecState*);
40
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleter(JSC::ExecState*);
41
41
42
// Attributes
42
// Attributes
43
43
Lines 91-97 template<> const ClassInfo JSTestNamedDe Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp_sec2
91
static const HashTableValue JSTestNamedDeleterWithIdentifierPrototypeTableValues[] =
91
static const HashTableValue JSTestNamedDeleterWithIdentifierPrototypeTableValues[] =
92
{
92
{
93
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedDeleterWithIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedDeleterWithIdentifierConstructor) } },
93
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedDeleterWithIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedDeleterWithIdentifierConstructor) } },
94
    { "remove", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedDeleterWithIdentifierPrototypeFunctionRemove), (intptr_t) (1) } },
94
    { "namedDeleter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleter), (intptr_t) (1) } },
95
};
95
};
96
96
97
const ClassInfo JSTestNamedDeleterWithIdentifierPrototype::s_info = { "TestNamedDeleterWithIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedDeleterWithIdentifierPrototype) };
97
const ClassInfo JSTestNamedDeleterWithIdentifierPrototype::s_info = { "TestNamedDeleterWithIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedDeleterWithIdentifierPrototype) };
Lines 186-192 bool JSTestNamedDeleterWithIdentifier::d Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp_sec3
186
    auto& thisObject = *jsCast<JSTestNamedDeleterWithIdentifier*>(cell);
186
    auto& thisObject = *jsCast<JSTestNamedDeleterWithIdentifier*>(cell);
187
    auto& impl = thisObject.wrapped();
187
    auto& impl = thisObject.wrapped();
188
    if (isVisibleNamedProperty<false>(*state, thisObject, propertyName)) {
188
    if (isVisibleNamedProperty<false>(*state, thisObject, propertyName)) {
189
        impl.remove(propertyNameToString(propertyName));
189
        impl.namedDeleter(propertyNameToString(propertyName));
190
        return true;
190
        return true;
191
    }
191
    }
192
    return Base::deleteProperty(cell, state, propertyName);
192
    return Base::deleteProperty(cell, state, propertyName);
Lines 198-204 bool JSTestNamedDeleterWithIdentifier::d Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp_sec4
198
    auto& impl = thisObject.wrapped();
198
    auto& impl = thisObject.wrapped();
199
    auto propertyName = Identifier::from(state, index);
199
    auto propertyName = Identifier::from(state, index);
200
    if (isVisibleNamedProperty<false>(*state, thisObject, propertyName)) {
200
    if (isVisibleNamedProperty<false>(*state, thisObject, propertyName)) {
201
        impl.remove(propertyNameToString(propertyName));
201
        impl.namedDeleter(propertyNameToString(propertyName));
202
        return true;
202
        return true;
203
    }
203
    }
204
    return Base::deletePropertyByIndex(cell, state, index);
204
    return Base::deletePropertyByIndex(cell, state, index);
Lines 232-238 bool setJSTestNamedDeleterWithIdentifier Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp_sec5
232
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
232
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
233
}
233
}
234
234
235
static inline JSC::EncodedJSValue jsTestNamedDeleterWithIdentifierPrototypeFunctionRemoveBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedDeleterWithIdentifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
235
static inline JSC::EncodedJSValue jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleterBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedDeleterWithIdentifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
236
{
236
{
237
    UNUSED_PARAM(state);
237
    UNUSED_PARAM(state);
238
    UNUSED_PARAM(throwScope);
238
    UNUSED_PARAM(throwScope);
Lines 241-253 static inline JSC::EncodedJSValue jsTest Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp_sec6
241
        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
241
        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
242
    auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
242
    auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
243
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
243
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
244
    impl.remove(WTFMove(name));
244
    impl.namedDeleter(WTFMove(name));
245
    return JSValue::encode(jsUndefined());
245
    return JSValue::encode(jsUndefined());
246
}
246
}
247
247
248
EncodedJSValue JSC_HOST_CALL jsTestNamedDeleterWithIdentifierPrototypeFunctionRemove(ExecState* state)
248
EncodedJSValue JSC_HOST_CALL jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleter(ExecState* state)
249
{
249
{
250
    return IDLOperation<JSTestNamedDeleterWithIdentifier>::call<jsTestNamedDeleterWithIdentifierPrototypeFunctionRemoveBody>(*state, "remove");
250
    return IDLOperation<JSTestNamedDeleterWithIdentifier>::call<jsTestNamedDeleterWithIdentifierPrototypeFunctionNamedDeleterBody>(*state, "namedDeleter");
251
}
251
}
252
252
253
bool JSTestNamedDeleterWithIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
253
bool JSTestNamedDeleterWithIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h -1 / +1 lines
Lines 41-46 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h_sec1
41
    static TestNamedDeleterWithIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
41
    static TestNamedDeleterWithIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
44
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static void destroy(JSC::JSCell*);
47
    static void destroy(JSC::JSCell*);
Lines 52-58 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h_sec2
52
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
    }
54
    }
54
55
55
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
57
public:
57
public:
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h -1 / +1 lines
Lines 41-46 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h_sec1
41
    static TestNamedDeleterWithIndexedGetter* toWrapped(JSC::VM&, JSC::JSValue);
41
    static TestNamedDeleterWithIndexedGetter* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
44
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);
45
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);
46
    static void destroy(JSC::JSCell*);
47
    static void destroy(JSC::JSCell*);
Lines 52-58 public: Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h_sec2
52
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
53
    }
54
    }
54
55
55
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
56
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
57
public:
57
public:
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
58
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp +321 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedSetterNoIdentifier.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include <runtime/FunctionPrototype.h>
30
#include <wtf/GetPtr.h>
31
32
using namespace JSC;
33
34
namespace WebCore {
35
36
// Attributes
37
38
JSC::EncodedJSValue jsTestNamedSetterNoIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
39
bool setJSTestNamedSetterNoIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
40
41
class JSTestNamedSetterNoIdentifierPrototype : public JSC::JSNonFinalObject {
42
public:
43
    using Base = JSC::JSNonFinalObject;
44
    static JSTestNamedSetterNoIdentifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
45
    {
46
        JSTestNamedSetterNoIdentifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterNoIdentifierPrototype>(vm.heap)) JSTestNamedSetterNoIdentifierPrototype(vm, globalObject, structure);
47
        ptr->finishCreation(vm);
48
        return ptr;
49
    }
50
51
    DECLARE_INFO;
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
private:
58
    JSTestNamedSetterNoIdentifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
59
        : JSC::JSNonFinalObject(vm, structure)
60
    {
61
    }
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
using JSTestNamedSetterNoIdentifierConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterNoIdentifier>;
67
68
template<> JSValue JSTestNamedSetterNoIdentifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
69
{
70
    UNUSED_PARAM(vm);
71
    return globalObject.functionPrototype();
72
}
73
74
template<> void JSTestNamedSetterNoIdentifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
75
{
76
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterNoIdentifier::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
77
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterNoIdentifier"))), ReadOnly | DontEnum);
78
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
79
}
80
81
template<> const ClassInfo JSTestNamedSetterNoIdentifierConstructor::s_info = { "TestNamedSetterNoIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterNoIdentifierConstructor) };
82
83
/* Hash table for prototype */
84
85
static const HashTableValue JSTestNamedSetterNoIdentifierPrototypeTableValues[] =
86
{
87
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterNoIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterNoIdentifierConstructor) } },
88
};
89
90
const ClassInfo JSTestNamedSetterNoIdentifierPrototype::s_info = { "TestNamedSetterNoIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterNoIdentifierPrototype) };
91
92
void JSTestNamedSetterNoIdentifierPrototype::finishCreation(VM& vm)
93
{
94
    Base::finishCreation(vm);
95
    reifyStaticProperties(vm, JSTestNamedSetterNoIdentifierPrototypeTableValues, *this);
96
}
97
98
const ClassInfo JSTestNamedSetterNoIdentifier::s_info = { "TestNamedSetterNoIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterNoIdentifier) };
99
100
JSTestNamedSetterNoIdentifier::JSTestNamedSetterNoIdentifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterNoIdentifier>&& impl)
101
    : JSDOMWrapper<TestNamedSetterNoIdentifier>(structure, globalObject, WTFMove(impl))
102
{
103
}
104
105
void JSTestNamedSetterNoIdentifier::finishCreation(VM& vm)
106
{
107
    Base::finishCreation(vm);
108
    ASSERT(inherits(vm, info()));
109
110
}
111
112
JSObject* JSTestNamedSetterNoIdentifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
113
{
114
    return JSTestNamedSetterNoIdentifierPrototype::create(vm, &globalObject, JSTestNamedSetterNoIdentifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
115
}
116
117
JSObject* JSTestNamedSetterNoIdentifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
118
{
119
    return getDOMPrototype<JSTestNamedSetterNoIdentifier>(vm, globalObject);
120
}
121
122
JSValue JSTestNamedSetterNoIdentifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
123
{
124
    return getDOMConstructor<JSTestNamedSetterNoIdentifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
125
}
126
127
void JSTestNamedSetterNoIdentifier::destroy(JSC::JSCell* cell)
128
{
129
    JSTestNamedSetterNoIdentifier* thisObject = static_cast<JSTestNamedSetterNoIdentifier*>(cell);
130
    thisObject->JSTestNamedSetterNoIdentifier::~JSTestNamedSetterNoIdentifier();
131
}
132
133
bool JSTestNamedSetterNoIdentifier::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
134
{
135
    auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(object);
136
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
137
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
138
        return true;
139
    JSValue proto = thisObject->getPrototypeDirect();
140
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
141
        return false;
142
143
    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {
144
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
145
        if (!IDLDOMString::isNullValue(item)) {
146
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
147
            return true;
148
        }
149
    }
150
    return false;
151
}
152
153
bool JSTestNamedSetterNoIdentifier::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
154
{
155
    auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(object);
156
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
157
    Identifier propertyName = Identifier::from(state, index);
158
    if (thisObject->classInfo() == info()) {
159
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
160
        if (!IDLDOMString::isNullValue(item)) {
161
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
162
            return true;
163
        }
164
    }
165
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
166
}
167
168
void JSTestNamedSetterNoIdentifier::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
169
{
170
    auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(object);
171
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
172
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
173
        propertyNames.add(Identifier::fromString(state, propertyName));
174
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
175
}
176
177
bool JSTestNamedSetterNoIdentifier::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
178
{
179
    auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(cell);
180
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
181
182
    if (!propertyName.isSymbol()) {
183
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
184
        JSValue prototype = thisObject->getPrototypeDirect();
185
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
186
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
187
            auto nativeValue = convert<IDLDOMString>(*state, value);
188
            RETURN_IF_EXCEPTION(throwScope, true);
189
            thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
190
            return true;
191
        }
192
    }
193
194
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
195
}
196
197
bool JSTestNamedSetterNoIdentifier::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
198
{
199
    auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(cell);
200
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
201
202
    Identifier propertyName = Identifier::from(state, index);
203
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
204
    JSValue prototype = thisObject->getPrototypeDirect();
205
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
206
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
207
        auto nativeValue = convert<IDLDOMString>(*state, value);
208
        RETURN_IF_EXCEPTION(throwScope, true);
209
        thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
210
        return true;
211
    }
212
213
    return Base::putByIndex(cell, state, index, value, shouldThrow);
214
}
215
216
bool JSTestNamedSetterNoIdentifier::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
217
{
218
    auto* thisObject = jsCast<JSTestNamedSetterNoIdentifier*>(object);
219
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
220
221
    if (!propertyName.isSymbol()) {
222
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
223
        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
224
            if (!propertyDescriptor.isDataDescriptor())
225
                return false;
226
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
227
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
228
            RETURN_IF_EXCEPTION(throwScope, true);
229
            thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
230
            return true;
231
        }
232
    }
233
234
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
235
    newPropertyDescriptor.setConfigurable(true);
236
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
237
}
238
239
EncodedJSValue jsTestNamedSetterNoIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
240
{
241
    VM& vm = state->vm();
242
    auto throwScope = DECLARE_THROW_SCOPE(vm);
243
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterNoIdentifierPrototype*>(vm, JSValue::decode(thisValue));
244
    if (UNLIKELY(!prototype))
245
        return throwVMTypeError(state, throwScope);
246
    return JSValue::encode(JSTestNamedSetterNoIdentifier::getConstructor(state->vm(), prototype->globalObject()));
247
}
248
249
bool setJSTestNamedSetterNoIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
250
{
251
    VM& vm = state->vm();
252
    auto throwScope = DECLARE_THROW_SCOPE(vm);
253
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterNoIdentifierPrototype*>(vm, JSValue::decode(thisValue));
254
    if (UNLIKELY(!prototype)) {
255
        throwVMTypeError(state, throwScope);
256
        return false;
257
    }
258
    // Shadowing a built-in constructor
259
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
260
}
261
262
bool JSTestNamedSetterNoIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
263
{
264
    UNUSED_PARAM(handle);
265
    UNUSED_PARAM(visitor);
266
    return false;
267
}
268
269
void JSTestNamedSetterNoIdentifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
270
{
271
    auto* jsTestNamedSetterNoIdentifier = static_cast<JSTestNamedSetterNoIdentifier*>(handle.slot()->asCell());
272
    auto& world = *static_cast<DOMWrapperWorld*>(context);
273
    uncacheWrapper(world, &jsTestNamedSetterNoIdentifier->wrapped(), jsTestNamedSetterNoIdentifier);
274
}
275
276
#if ENABLE(BINDING_INTEGRITY)
277
#if PLATFORM(WIN)
278
#pragma warning(disable: 4483)
279
extern "C" { extern void (*const __identifier("??_7TestNamedSetterNoIdentifier@WebCore@@6B@")[])(); }
280
#else
281
extern "C" { extern void* _ZTVN7WebCore27TestNamedSetterNoIdentifierE[]; }
282
#endif
283
#endif
284
285
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterNoIdentifier>&& impl)
286
{
287
288
#if ENABLE(BINDING_INTEGRITY)
289
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
290
#if PLATFORM(WIN)
291
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedSetterNoIdentifier@WebCore@@6B@"));
292
#else
293
    void* expectedVTablePointer = &_ZTVN7WebCore27TestNamedSetterNoIdentifierE[2];
294
#if COMPILER(CLANG)
295
    // If this fails TestNamedSetterNoIdentifier does not have a vtable, so you need to add the
296
    // ImplementationLacksVTable attribute to the interface definition
297
    static_assert(__is_polymorphic(TestNamedSetterNoIdentifier), "TestNamedSetterNoIdentifier is not polymorphic");
298
#endif
299
#endif
300
    // If you hit this assertion you either have a use after free bug, or
301
    // TestNamedSetterNoIdentifier has subclasses. If TestNamedSetterNoIdentifier has subclasses that get passed
302
    // to toJS() we currently require TestNamedSetterNoIdentifier you to opt out of binding hardening
303
    // by adding the SkipVTableValidation attribute to the interface IDL definition
304
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
305
#endif
306
    return createWrapper<TestNamedSetterNoIdentifier>(globalObject, WTFMove(impl));
307
}
308
309
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterNoIdentifier& impl)
310
{
311
    return wrap(state, globalObject, impl);
312
}
313
314
TestNamedSetterNoIdentifier* JSTestNamedSetterNoIdentifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
315
{
316
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterNoIdentifier*>(vm, value))
317
        return &wrapper->wrapped();
318
    return nullptr;
319
}
320
321
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedSetterNoIdentifier.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedSetterNoIdentifier : public JSDOMWrapper<TestNamedSetterNoIdentifier> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedSetterNoIdentifier>;
32
    static JSTestNamedSetterNoIdentifier* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterNoIdentifier>&& impl)
33
    {
34
        JSTestNamedSetterNoIdentifier* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterNoIdentifier>(globalObject->vm().heap)) JSTestNamedSetterNoIdentifier(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedSetterNoIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedSetterNoIdentifier(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedSetterNoIdentifier>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedSetterNoIdentifierOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedSetterNoIdentifier*)
73
{
74
    static NeverDestroyed<JSTestNamedSetterNoIdentifierOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedSetterNoIdentifier* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedSetterNoIdentifier&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterNoIdentifier* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedSetterNoIdentifier>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedSetterNoIdentifier>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedSetterNoIdentifier> {
89
    using WrapperClass = JSTestNamedSetterNoIdentifier;
90
    using ToWrappedReturnType = TestNamedSetterNoIdentifier*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp +321 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedSetterThrowingException.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include <runtime/FunctionPrototype.h>
30
#include <wtf/GetPtr.h>
31
32
using namespace JSC;
33
34
namespace WebCore {
35
36
// Attributes
37
38
JSC::EncodedJSValue jsTestNamedSetterThrowingExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
39
bool setJSTestNamedSetterThrowingExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
40
41
class JSTestNamedSetterThrowingExceptionPrototype : public JSC::JSNonFinalObject {
42
public:
43
    using Base = JSC::JSNonFinalObject;
44
    static JSTestNamedSetterThrowingExceptionPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
45
    {
46
        JSTestNamedSetterThrowingExceptionPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterThrowingExceptionPrototype>(vm.heap)) JSTestNamedSetterThrowingExceptionPrototype(vm, globalObject, structure);
47
        ptr->finishCreation(vm);
48
        return ptr;
49
    }
50
51
    DECLARE_INFO;
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
private:
58
    JSTestNamedSetterThrowingExceptionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
59
        : JSC::JSNonFinalObject(vm, structure)
60
    {
61
    }
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
using JSTestNamedSetterThrowingExceptionConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterThrowingException>;
67
68
template<> JSValue JSTestNamedSetterThrowingExceptionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
69
{
70
    UNUSED_PARAM(vm);
71
    return globalObject.functionPrototype();
72
}
73
74
template<> void JSTestNamedSetterThrowingExceptionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
75
{
76
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterThrowingException::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
77
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterThrowingException"))), ReadOnly | DontEnum);
78
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
79
}
80
81
template<> const ClassInfo JSTestNamedSetterThrowingExceptionConstructor::s_info = { "TestNamedSetterThrowingException", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterThrowingExceptionConstructor) };
82
83
/* Hash table for prototype */
84
85
static const HashTableValue JSTestNamedSetterThrowingExceptionPrototypeTableValues[] =
86
{
87
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterThrowingExceptionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterThrowingExceptionConstructor) } },
88
};
89
90
const ClassInfo JSTestNamedSetterThrowingExceptionPrototype::s_info = { "TestNamedSetterThrowingExceptionPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterThrowingExceptionPrototype) };
91
92
void JSTestNamedSetterThrowingExceptionPrototype::finishCreation(VM& vm)
93
{
94
    Base::finishCreation(vm);
95
    reifyStaticProperties(vm, JSTestNamedSetterThrowingExceptionPrototypeTableValues, *this);
96
}
97
98
const ClassInfo JSTestNamedSetterThrowingException::s_info = { "TestNamedSetterThrowingException", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterThrowingException) };
99
100
JSTestNamedSetterThrowingException::JSTestNamedSetterThrowingException(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterThrowingException>&& impl)
101
    : JSDOMWrapper<TestNamedSetterThrowingException>(structure, globalObject, WTFMove(impl))
102
{
103
}
104
105
void JSTestNamedSetterThrowingException::finishCreation(VM& vm)
106
{
107
    Base::finishCreation(vm);
108
    ASSERT(inherits(vm, info()));
109
110
}
111
112
JSObject* JSTestNamedSetterThrowingException::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
113
{
114
    return JSTestNamedSetterThrowingExceptionPrototype::create(vm, &globalObject, JSTestNamedSetterThrowingExceptionPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
115
}
116
117
JSObject* JSTestNamedSetterThrowingException::prototype(VM& vm, JSDOMGlobalObject& globalObject)
118
{
119
    return getDOMPrototype<JSTestNamedSetterThrowingException>(vm, globalObject);
120
}
121
122
JSValue JSTestNamedSetterThrowingException::getConstructor(VM& vm, const JSGlobalObject* globalObject)
123
{
124
    return getDOMConstructor<JSTestNamedSetterThrowingExceptionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
125
}
126
127
void JSTestNamedSetterThrowingException::destroy(JSC::JSCell* cell)
128
{
129
    JSTestNamedSetterThrowingException* thisObject = static_cast<JSTestNamedSetterThrowingException*>(cell);
130
    thisObject->JSTestNamedSetterThrowingException::~JSTestNamedSetterThrowingException();
131
}
132
133
bool JSTestNamedSetterThrowingException::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
134
{
135
    auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(object);
136
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
137
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
138
        return true;
139
    JSValue proto = thisObject->getPrototypeDirect();
140
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
141
        return false;
142
143
    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {
144
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
145
        if (!IDLDOMString::isNullValue(item)) {
146
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
147
            return true;
148
        }
149
    }
150
    return false;
151
}
152
153
bool JSTestNamedSetterThrowingException::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
154
{
155
    auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(object);
156
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
157
    Identifier propertyName = Identifier::from(state, index);
158
    if (thisObject->classInfo() == info()) {
159
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
160
        if (!IDLDOMString::isNullValue(item)) {
161
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
162
            return true;
163
        }
164
    }
165
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
166
}
167
168
void JSTestNamedSetterThrowingException::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
169
{
170
    auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(object);
171
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
172
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
173
        propertyNames.add(Identifier::fromString(state, propertyName));
174
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
175
}
176
177
bool JSTestNamedSetterThrowingException::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
178
{
179
    auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(cell);
180
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
181
182
    if (!propertyName.isSymbol()) {
183
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
184
        JSValue prototype = thisObject->getPrototypeDirect();
185
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
186
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
187
            auto nativeValue = convert<IDLDOMString>(*state, value);
188
            RETURN_IF_EXCEPTION(throwScope, true);
189
            propagateException(*state, throwScope, thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue)));
190
            return true;
191
        }
192
    }
193
194
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
195
}
196
197
bool JSTestNamedSetterThrowingException::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
198
{
199
    auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(cell);
200
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
201
202
    Identifier propertyName = Identifier::from(state, index);
203
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
204
    JSValue prototype = thisObject->getPrototypeDirect();
205
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
206
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
207
        auto nativeValue = convert<IDLDOMString>(*state, value);
208
        RETURN_IF_EXCEPTION(throwScope, true);
209
        propagateException(*state, throwScope, thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue)));
210
        return true;
211
    }
212
213
    return Base::putByIndex(cell, state, index, value, shouldThrow);
214
}
215
216
bool JSTestNamedSetterThrowingException::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
217
{
218
    auto* thisObject = jsCast<JSTestNamedSetterThrowingException*>(object);
219
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
220
221
    if (!propertyName.isSymbol()) {
222
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
223
        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
224
            if (!propertyDescriptor.isDataDescriptor())
225
                return false;
226
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
227
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
228
            RETURN_IF_EXCEPTION(throwScope, true);
229
            propagateException(*state, throwScope, thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue)));
230
            return true;
231
        }
232
    }
233
234
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
235
    newPropertyDescriptor.setConfigurable(true);
236
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
237
}
238
239
EncodedJSValue jsTestNamedSetterThrowingExceptionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
240
{
241
    VM& vm = state->vm();
242
    auto throwScope = DECLARE_THROW_SCOPE(vm);
243
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterThrowingExceptionPrototype*>(vm, JSValue::decode(thisValue));
244
    if (UNLIKELY(!prototype))
245
        return throwVMTypeError(state, throwScope);
246
    return JSValue::encode(JSTestNamedSetterThrowingException::getConstructor(state->vm(), prototype->globalObject()));
247
}
248
249
bool setJSTestNamedSetterThrowingExceptionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
250
{
251
    VM& vm = state->vm();
252
    auto throwScope = DECLARE_THROW_SCOPE(vm);
253
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterThrowingExceptionPrototype*>(vm, JSValue::decode(thisValue));
254
    if (UNLIKELY(!prototype)) {
255
        throwVMTypeError(state, throwScope);
256
        return false;
257
    }
258
    // Shadowing a built-in constructor
259
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
260
}
261
262
bool JSTestNamedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
263
{
264
    UNUSED_PARAM(handle);
265
    UNUSED_PARAM(visitor);
266
    return false;
267
}
268
269
void JSTestNamedSetterThrowingExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
270
{
271
    auto* jsTestNamedSetterThrowingException = static_cast<JSTestNamedSetterThrowingException*>(handle.slot()->asCell());
272
    auto& world = *static_cast<DOMWrapperWorld*>(context);
273
    uncacheWrapper(world, &jsTestNamedSetterThrowingException->wrapped(), jsTestNamedSetterThrowingException);
274
}
275
276
#if ENABLE(BINDING_INTEGRITY)
277
#if PLATFORM(WIN)
278
#pragma warning(disable: 4483)
279
extern "C" { extern void (*const __identifier("??_7TestNamedSetterThrowingException@WebCore@@6B@")[])(); }
280
#else
281
extern "C" { extern void* _ZTVN7WebCore32TestNamedSetterThrowingExceptionE[]; }
282
#endif
283
#endif
284
285
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterThrowingException>&& impl)
286
{
287
288
#if ENABLE(BINDING_INTEGRITY)
289
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
290
#if PLATFORM(WIN)
291
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedSetterThrowingException@WebCore@@6B@"));
292
#else
293
    void* expectedVTablePointer = &_ZTVN7WebCore32TestNamedSetterThrowingExceptionE[2];
294
#if COMPILER(CLANG)
295
    // If this fails TestNamedSetterThrowingException does not have a vtable, so you need to add the
296
    // ImplementationLacksVTable attribute to the interface definition
297
    static_assert(__is_polymorphic(TestNamedSetterThrowingException), "TestNamedSetterThrowingException is not polymorphic");
298
#endif
299
#endif
300
    // If you hit this assertion you either have a use after free bug, or
301
    // TestNamedSetterThrowingException has subclasses. If TestNamedSetterThrowingException has subclasses that get passed
302
    // to toJS() we currently require TestNamedSetterThrowingException you to opt out of binding hardening
303
    // by adding the SkipVTableValidation attribute to the interface IDL definition
304
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
305
#endif
306
    return createWrapper<TestNamedSetterThrowingException>(globalObject, WTFMove(impl));
307
}
308
309
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterThrowingException& impl)
310
{
311
    return wrap(state, globalObject, impl);
312
}
313
314
TestNamedSetterThrowingException* JSTestNamedSetterThrowingException::toWrapped(JSC::VM& vm, JSC::JSValue value)
315
{
316
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterThrowingException*>(vm, value))
317
        return &wrapper->wrapped();
318
    return nullptr;
319
}
320
321
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedSetterThrowingException.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedSetterThrowingException : public JSDOMWrapper<TestNamedSetterThrowingException> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedSetterThrowingException>;
32
    static JSTestNamedSetterThrowingException* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterThrowingException>&& impl)
33
    {
34
        JSTestNamedSetterThrowingException* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterThrowingException>(globalObject->vm().heap)) JSTestNamedSetterThrowingException(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedSetterThrowingException* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedSetterThrowingException(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedSetterThrowingException>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedSetterThrowingExceptionOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedSetterThrowingException*)
73
{
74
    static NeverDestroyed<JSTestNamedSetterThrowingExceptionOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedSetterThrowingException* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedSetterThrowingException&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterThrowingException* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedSetterThrowingException>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedSetterThrowingException>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedSetterThrowingException> {
89
    using WrapperClass = JSTestNamedSetterThrowingException;
90
    using ToWrappedReturnType = TestNamedSetterThrowingException*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp +352 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedSetterWithIdentifier.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMOperation.h"
29
#include "JSDOMWrapperCache.h"
30
#include <runtime/FunctionPrototype.h>
31
#include <wtf/GetPtr.h>
32
33
using namespace JSC;
34
35
namespace WebCore {
36
37
// Functions
38
39
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetter(JSC::ExecState*);
40
41
// Attributes
42
43
JSC::EncodedJSValue jsTestNamedSetterWithIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
44
bool setJSTestNamedSetterWithIdentifierConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
45
46
class JSTestNamedSetterWithIdentifierPrototype : public JSC::JSNonFinalObject {
47
public:
48
    using Base = JSC::JSNonFinalObject;
49
    static JSTestNamedSetterWithIdentifierPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
50
    {
51
        JSTestNamedSetterWithIdentifierPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithIdentifierPrototype>(vm.heap)) JSTestNamedSetterWithIdentifierPrototype(vm, globalObject, structure);
52
        ptr->finishCreation(vm);
53
        return ptr;
54
    }
55
56
    DECLARE_INFO;
57
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
58
    {
59
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
60
    }
61
62
private:
63
    JSTestNamedSetterWithIdentifierPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
64
        : JSC::JSNonFinalObject(vm, structure)
65
    {
66
    }
67
68
    void finishCreation(JSC::VM&);
69
};
70
71
using JSTestNamedSetterWithIdentifierConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterWithIdentifier>;
72
73
template<> JSValue JSTestNamedSetterWithIdentifierConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
74
{
75
    UNUSED_PARAM(vm);
76
    return globalObject.functionPrototype();
77
}
78
79
template<> void JSTestNamedSetterWithIdentifierConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
80
{
81
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterWithIdentifier::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
82
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterWithIdentifier"))), ReadOnly | DontEnum);
83
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
84
}
85
86
template<> const ClassInfo JSTestNamedSetterWithIdentifierConstructor::s_info = { "TestNamedSetterWithIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithIdentifierConstructor) };
87
88
/* Hash table for prototype */
89
90
static const HashTableValue JSTestNamedSetterWithIdentifierPrototypeTableValues[] =
91
{
92
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterWithIdentifierConstructor) } },
93
    { "namedSetter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetter), (intptr_t) (2) } },
94
};
95
96
const ClassInfo JSTestNamedSetterWithIdentifierPrototype::s_info = { "TestNamedSetterWithIdentifierPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithIdentifierPrototype) };
97
98
void JSTestNamedSetterWithIdentifierPrototype::finishCreation(VM& vm)
99
{
100
    Base::finishCreation(vm);
101
    reifyStaticProperties(vm, JSTestNamedSetterWithIdentifierPrototypeTableValues, *this);
102
}
103
104
const ClassInfo JSTestNamedSetterWithIdentifier::s_info = { "TestNamedSetterWithIdentifier", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithIdentifier) };
105
106
JSTestNamedSetterWithIdentifier::JSTestNamedSetterWithIdentifier(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterWithIdentifier>&& impl)
107
    : JSDOMWrapper<TestNamedSetterWithIdentifier>(structure, globalObject, WTFMove(impl))
108
{
109
}
110
111
void JSTestNamedSetterWithIdentifier::finishCreation(VM& vm)
112
{
113
    Base::finishCreation(vm);
114
    ASSERT(inherits(vm, info()));
115
116
}
117
118
JSObject* JSTestNamedSetterWithIdentifier::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
119
{
120
    return JSTestNamedSetterWithIdentifierPrototype::create(vm, &globalObject, JSTestNamedSetterWithIdentifierPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
121
}
122
123
JSObject* JSTestNamedSetterWithIdentifier::prototype(VM& vm, JSDOMGlobalObject& globalObject)
124
{
125
    return getDOMPrototype<JSTestNamedSetterWithIdentifier>(vm, globalObject);
126
}
127
128
JSValue JSTestNamedSetterWithIdentifier::getConstructor(VM& vm, const JSGlobalObject* globalObject)
129
{
130
    return getDOMConstructor<JSTestNamedSetterWithIdentifierConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
131
}
132
133
void JSTestNamedSetterWithIdentifier::destroy(JSC::JSCell* cell)
134
{
135
    JSTestNamedSetterWithIdentifier* thisObject = static_cast<JSTestNamedSetterWithIdentifier*>(cell);
136
    thisObject->JSTestNamedSetterWithIdentifier::~JSTestNamedSetterWithIdentifier();
137
}
138
139
bool JSTestNamedSetterWithIdentifier::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
140
{
141
    auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(object);
142
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
143
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
144
        return true;
145
    JSValue proto = thisObject->getPrototypeDirect();
146
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
147
        return false;
148
149
    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {
150
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
151
        if (!IDLDOMString::isNullValue(item)) {
152
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
153
            return true;
154
        }
155
    }
156
    return false;
157
}
158
159
bool JSTestNamedSetterWithIdentifier::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
160
{
161
    auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(object);
162
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
163
    Identifier propertyName = Identifier::from(state, index);
164
    if (thisObject->classInfo() == info()) {
165
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
166
        if (!IDLDOMString::isNullValue(item)) {
167
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
168
            return true;
169
        }
170
    }
171
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
172
}
173
174
void JSTestNamedSetterWithIdentifier::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
175
{
176
    auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(object);
177
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
178
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
179
        propertyNames.add(Identifier::fromString(state, propertyName));
180
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
181
}
182
183
bool JSTestNamedSetterWithIdentifier::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
184
{
185
    auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(cell);
186
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
187
188
    if (!propertyName.isSymbol()) {
189
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
190
        JSValue prototype = thisObject->getPrototypeDirect();
191
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
192
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
193
            auto nativeValue = convert<IDLDOMString>(*state, value);
194
            RETURN_IF_EXCEPTION(throwScope, true);
195
            thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
196
            return true;
197
        }
198
    }
199
200
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
201
}
202
203
bool JSTestNamedSetterWithIdentifier::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
204
{
205
    auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(cell);
206
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
207
208
    Identifier propertyName = Identifier::from(state, index);
209
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
210
    JSValue prototype = thisObject->getPrototypeDirect();
211
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
212
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
213
        auto nativeValue = convert<IDLDOMString>(*state, value);
214
        RETURN_IF_EXCEPTION(throwScope, true);
215
        thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
216
        return true;
217
    }
218
219
    return Base::putByIndex(cell, state, index, value, shouldThrow);
220
}
221
222
bool JSTestNamedSetterWithIdentifier::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
223
{
224
    auto* thisObject = jsCast<JSTestNamedSetterWithIdentifier*>(object);
225
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
226
227
    if (!propertyName.isSymbol()) {
228
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
229
        if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
230
            if (!propertyDescriptor.isDataDescriptor())
231
                return false;
232
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
233
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
234
            RETURN_IF_EXCEPTION(throwScope, true);
235
            thisObject->wrapped().namedSetter(propertyNameToString(propertyName), WTFMove(nativeValue));
236
            return true;
237
        }
238
    }
239
240
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
241
    newPropertyDescriptor.setConfigurable(true);
242
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
243
}
244
245
template<> inline JSTestNamedSetterWithIdentifier* IDLOperation<JSTestNamedSetterWithIdentifier>::cast(ExecState& state)
246
{
247
    return jsDynamicDowncast<JSTestNamedSetterWithIdentifier*>(state.vm(), state.thisValue());
248
}
249
250
EncodedJSValue jsTestNamedSetterWithIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
251
{
252
    VM& vm = state->vm();
253
    auto throwScope = DECLARE_THROW_SCOPE(vm);
254
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithIdentifierPrototype*>(vm, JSValue::decode(thisValue));
255
    if (UNLIKELY(!prototype))
256
        return throwVMTypeError(state, throwScope);
257
    return JSValue::encode(JSTestNamedSetterWithIdentifier::getConstructor(state->vm(), prototype->globalObject()));
258
}
259
260
bool setJSTestNamedSetterWithIdentifierConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
261
{
262
    VM& vm = state->vm();
263
    auto throwScope = DECLARE_THROW_SCOPE(vm);
264
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithIdentifierPrototype*>(vm, JSValue::decode(thisValue));
265
    if (UNLIKELY(!prototype)) {
266
        throwVMTypeError(state, throwScope);
267
        return false;
268
    }
269
    // Shadowing a built-in constructor
270
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
271
}
272
273
static inline JSC::EncodedJSValue jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetterBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithIdentifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
274
{
275
    UNUSED_PARAM(state);
276
    UNUSED_PARAM(throwScope);
277
    auto& impl = castedThis->wrapped();
278
    if (UNLIKELY(state->argumentCount() < 2))
279
        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
280
    auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
281
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
282
    auto value = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
283
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
284
    impl.namedSetter(WTFMove(name), WTFMove(value));
285
    return JSValue::encode(jsUndefined());
286
}
287
288
EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetter(ExecState* state)
289
{
290
    return IDLOperation<JSTestNamedSetterWithIdentifier>::call<jsTestNamedSetterWithIdentifierPrototypeFunctionNamedSetterBody>(*state, "namedSetter");
291
}
292
293
bool JSTestNamedSetterWithIdentifierOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
294
{
295
    UNUSED_PARAM(handle);
296
    UNUSED_PARAM(visitor);
297
    return false;
298
}
299
300
void JSTestNamedSetterWithIdentifierOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
301
{
302
    auto* jsTestNamedSetterWithIdentifier = static_cast<JSTestNamedSetterWithIdentifier*>(handle.slot()->asCell());
303
    auto& world = *static_cast<DOMWrapperWorld*>(context);
304
    uncacheWrapper(world, &jsTestNamedSetterWithIdentifier->wrapped(), jsTestNamedSetterWithIdentifier);
305
}
306
307
#if ENABLE(BINDING_INTEGRITY)
308
#if PLATFORM(WIN)
309
#pragma warning(disable: 4483)
310
extern "C" { extern void (*const __identifier("??_7TestNamedSetterWithIdentifier@WebCore@@6B@")[])(); }
311
#else
312
extern "C" { extern void* _ZTVN7WebCore29TestNamedSetterWithIdentifierE[]; }
313
#endif
314
#endif
315
316
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithIdentifier>&& impl)
317
{
318
319
#if ENABLE(BINDING_INTEGRITY)
320
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
321
#if PLATFORM(WIN)
322
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedSetterWithIdentifier@WebCore@@6B@"));
323
#else
324
    void* expectedVTablePointer = &_ZTVN7WebCore29TestNamedSetterWithIdentifierE[2];
325
#if COMPILER(CLANG)
326
    // If this fails TestNamedSetterWithIdentifier does not have a vtable, so you need to add the
327
    // ImplementationLacksVTable attribute to the interface definition
328
    static_assert(__is_polymorphic(TestNamedSetterWithIdentifier), "TestNamedSetterWithIdentifier is not polymorphic");
329
#endif
330
#endif
331
    // If you hit this assertion you either have a use after free bug, or
332
    // TestNamedSetterWithIdentifier has subclasses. If TestNamedSetterWithIdentifier has subclasses that get passed
333
    // to toJS() we currently require TestNamedSetterWithIdentifier you to opt out of binding hardening
334
    // by adding the SkipVTableValidation attribute to the interface IDL definition
335
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
336
#endif
337
    return createWrapper<TestNamedSetterWithIdentifier>(globalObject, WTFMove(impl));
338
}
339
340
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithIdentifier& impl)
341
{
342
    return wrap(state, globalObject, impl);
343
}
344
345
TestNamedSetterWithIdentifier* JSTestNamedSetterWithIdentifier::toWrapped(JSC::VM& vm, JSC::JSValue value)
346
{
347
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterWithIdentifier*>(vm, value))
348
        return &wrapper->wrapped();
349
    return nullptr;
350
}
351
352
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedSetterWithIdentifier.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedSetterWithIdentifier : public JSDOMWrapper<TestNamedSetterWithIdentifier> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedSetterWithIdentifier>;
32
    static JSTestNamedSetterWithIdentifier* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithIdentifier>&& impl)
33
    {
34
        JSTestNamedSetterWithIdentifier* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithIdentifier>(globalObject->vm().heap)) JSTestNamedSetterWithIdentifier(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedSetterWithIdentifier* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedSetterWithIdentifier(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedSetterWithIdentifier>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedSetterWithIdentifierOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedSetterWithIdentifier*)
73
{
74
    static NeverDestroyed<JSTestNamedSetterWithIdentifierOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedSetterWithIdentifier* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedSetterWithIdentifier&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithIdentifier* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedSetterWithIdentifier>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedSetterWithIdentifier>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedSetterWithIdentifier> {
89
    using WrapperClass = JSTestNamedSetterWithIdentifier;
90
    using ToWrappedReturnType = TestNamedSetterWithIdentifier*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp +304 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedSetterWithOverrideBuiltins.h"
23
24
#include "JSDOMBinding.h"
25
#include "JSDOMConstructorNotConstructable.h"
26
#include "JSDOMConvert.h"
27
#include "JSDOMExceptionHandling.h"
28
#include "JSDOMWrapperCache.h"
29
#include <runtime/FunctionPrototype.h>
30
#include <wtf/GetPtr.h>
31
32
using namespace JSC;
33
34
namespace WebCore {
35
36
// Attributes
37
38
JSC::EncodedJSValue jsTestNamedSetterWithOverrideBuiltinsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
39
bool setJSTestNamedSetterWithOverrideBuiltinsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
40
41
class JSTestNamedSetterWithOverrideBuiltinsPrototype : public JSC::JSNonFinalObject {
42
public:
43
    using Base = JSC::JSNonFinalObject;
44
    static JSTestNamedSetterWithOverrideBuiltinsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
45
    {
46
        JSTestNamedSetterWithOverrideBuiltinsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithOverrideBuiltinsPrototype>(vm.heap)) JSTestNamedSetterWithOverrideBuiltinsPrototype(vm, globalObject, structure);
47
        ptr->finishCreation(vm);
48
        return ptr;
49
    }
50
51
    DECLARE_INFO;
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
private:
58
    JSTestNamedSetterWithOverrideBuiltinsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
59
        : JSC::JSNonFinalObject(vm, structure)
60
    {
61
    }
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
using JSTestNamedSetterWithOverrideBuiltinsConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterWithOverrideBuiltins>;
67
68
template<> JSValue JSTestNamedSetterWithOverrideBuiltinsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
69
{
70
    UNUSED_PARAM(vm);
71
    return globalObject.functionPrototype();
72
}
73
74
template<> void JSTestNamedSetterWithOverrideBuiltinsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
75
{
76
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterWithOverrideBuiltins::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
77
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterWithOverrideBuiltins"))), ReadOnly | DontEnum);
78
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
79
}
80
81
template<> const ClassInfo JSTestNamedSetterWithOverrideBuiltinsConstructor::s_info = { "TestNamedSetterWithOverrideBuiltins", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithOverrideBuiltinsConstructor) };
82
83
/* Hash table for prototype */
84
85
static const HashTableValue JSTestNamedSetterWithOverrideBuiltinsPrototypeTableValues[] =
86
{
87
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithOverrideBuiltinsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterWithOverrideBuiltinsConstructor) } },
88
};
89
90
const ClassInfo JSTestNamedSetterWithOverrideBuiltinsPrototype::s_info = { "TestNamedSetterWithOverrideBuiltinsPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithOverrideBuiltinsPrototype) };
91
92
void JSTestNamedSetterWithOverrideBuiltinsPrototype::finishCreation(VM& vm)
93
{
94
    Base::finishCreation(vm);
95
    reifyStaticProperties(vm, JSTestNamedSetterWithOverrideBuiltinsPrototypeTableValues, *this);
96
}
97
98
const ClassInfo JSTestNamedSetterWithOverrideBuiltins::s_info = { "TestNamedSetterWithOverrideBuiltins", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithOverrideBuiltins) };
99
100
JSTestNamedSetterWithOverrideBuiltins::JSTestNamedSetterWithOverrideBuiltins(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterWithOverrideBuiltins>&& impl)
101
    : JSDOMWrapper<TestNamedSetterWithOverrideBuiltins>(structure, globalObject, WTFMove(impl))
102
{
103
}
104
105
void JSTestNamedSetterWithOverrideBuiltins::finishCreation(VM& vm)
106
{
107
    Base::finishCreation(vm);
108
    ASSERT(inherits(vm, info()));
109
110
}
111
112
JSObject* JSTestNamedSetterWithOverrideBuiltins::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
113
{
114
    return JSTestNamedSetterWithOverrideBuiltinsPrototype::create(vm, &globalObject, JSTestNamedSetterWithOverrideBuiltinsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
115
}
116
117
JSObject* JSTestNamedSetterWithOverrideBuiltins::prototype(VM& vm, JSDOMGlobalObject& globalObject)
118
{
119
    return getDOMPrototype<JSTestNamedSetterWithOverrideBuiltins>(vm, globalObject);
120
}
121
122
JSValue JSTestNamedSetterWithOverrideBuiltins::getConstructor(VM& vm, const JSGlobalObject* globalObject)
123
{
124
    return getDOMConstructor<JSTestNamedSetterWithOverrideBuiltinsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
125
}
126
127
void JSTestNamedSetterWithOverrideBuiltins::destroy(JSC::JSCell* cell)
128
{
129
    JSTestNamedSetterWithOverrideBuiltins* thisObject = static_cast<JSTestNamedSetterWithOverrideBuiltins*>(cell);
130
    thisObject->JSTestNamedSetterWithOverrideBuiltins::~JSTestNamedSetterWithOverrideBuiltins();
131
}
132
133
bool JSTestNamedSetterWithOverrideBuiltins::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
134
{
135
    auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(object);
136
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
137
    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {
138
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
139
        if (!IDLDOMString::isNullValue(item)) {
140
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
141
            return true;
142
        }
143
    }
144
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
145
        return true;
146
    return false;
147
}
148
149
bool JSTestNamedSetterWithOverrideBuiltins::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
150
{
151
    auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(object);
152
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
153
    Identifier propertyName = Identifier::from(state, index);
154
    if (thisObject->classInfo() == info()) {
155
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
156
        if (!IDLDOMString::isNullValue(item)) {
157
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
158
            return true;
159
        }
160
    }
161
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
162
}
163
164
void JSTestNamedSetterWithOverrideBuiltins::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
165
{
166
    auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(object);
167
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
168
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
169
        propertyNames.add(Identifier::fromString(state, propertyName));
170
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
171
}
172
173
bool JSTestNamedSetterWithOverrideBuiltins::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
174
{
175
    auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(cell);
176
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
177
178
    if (!propertyName.isSymbol()) {
179
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
180
        auto nativeValue = convert<IDLDOMString>(*state, value);
181
        RETURN_IF_EXCEPTION(throwScope, true);
182
        thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
183
        return true;
184
    }
185
186
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
187
}
188
189
bool JSTestNamedSetterWithOverrideBuiltins::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool)
190
{
191
    auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(cell);
192
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
193
194
    Identifier propertyName = Identifier::from(state, index);
195
    auto throwScope = DECLARE_THROW_SCOPE(state->vm());
196
    auto nativeValue = convert<IDLDOMString>(*state, value);
197
    RETURN_IF_EXCEPTION(throwScope, true);
198
    thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
199
    return true;
200
}
201
202
bool JSTestNamedSetterWithOverrideBuiltins::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
203
{
204
    auto* thisObject = jsCast<JSTestNamedSetterWithOverrideBuiltins*>(object);
205
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
206
207
    if (!propertyName.isSymbol()) {
208
        if (!propertyDescriptor.isDataDescriptor())
209
            return false;
210
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
211
        auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
212
        RETURN_IF_EXCEPTION(throwScope, true);
213
        thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
214
        return true;
215
    }
216
217
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
218
    newPropertyDescriptor.setConfigurable(true);
219
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
220
}
221
222
EncodedJSValue jsTestNamedSetterWithOverrideBuiltinsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
223
{
224
    VM& vm = state->vm();
225
    auto throwScope = DECLARE_THROW_SCOPE(vm);
226
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithOverrideBuiltinsPrototype*>(vm, JSValue::decode(thisValue));
227
    if (UNLIKELY(!prototype))
228
        return throwVMTypeError(state, throwScope);
229
    return JSValue::encode(JSTestNamedSetterWithOverrideBuiltins::getConstructor(state->vm(), prototype->globalObject()));
230
}
231
232
bool setJSTestNamedSetterWithOverrideBuiltinsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
233
{
234
    VM& vm = state->vm();
235
    auto throwScope = DECLARE_THROW_SCOPE(vm);
236
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithOverrideBuiltinsPrototype*>(vm, JSValue::decode(thisValue));
237
    if (UNLIKELY(!prototype)) {
238
        throwVMTypeError(state, throwScope);
239
        return false;
240
    }
241
    // Shadowing a built-in constructor
242
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
243
}
244
245
bool JSTestNamedSetterWithOverrideBuiltinsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
246
{
247
    UNUSED_PARAM(handle);
248
    UNUSED_PARAM(visitor);
249
    return false;
250
}
251
252
void JSTestNamedSetterWithOverrideBuiltinsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
253
{
254
    auto* jsTestNamedSetterWithOverrideBuiltins = static_cast<JSTestNamedSetterWithOverrideBuiltins*>(handle.slot()->asCell());
255
    auto& world = *static_cast<DOMWrapperWorld*>(context);
256
    uncacheWrapper(world, &jsTestNamedSetterWithOverrideBuiltins->wrapped(), jsTestNamedSetterWithOverrideBuiltins);
257
}
258
259
#if ENABLE(BINDING_INTEGRITY)
260
#if PLATFORM(WIN)
261
#pragma warning(disable: 4483)
262
extern "C" { extern void (*const __identifier("??_7TestNamedSetterWithOverrideBuiltins@WebCore@@6B@")[])(); }
263
#else
264
extern "C" { extern void* _ZTVN7WebCore35TestNamedSetterWithOverrideBuiltinsE[]; }
265
#endif
266
#endif
267
268
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithOverrideBuiltins>&& impl)
269
{
270
271
#if ENABLE(BINDING_INTEGRITY)
272
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
273
#if PLATFORM(WIN)
274
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedSetterWithOverrideBuiltins@WebCore@@6B@"));
275
#else
276
    void* expectedVTablePointer = &_ZTVN7WebCore35TestNamedSetterWithOverrideBuiltinsE[2];
277
#if COMPILER(CLANG)
278
    // If this fails TestNamedSetterWithOverrideBuiltins does not have a vtable, so you need to add the
279
    // ImplementationLacksVTable attribute to the interface definition
280
    static_assert(__is_polymorphic(TestNamedSetterWithOverrideBuiltins), "TestNamedSetterWithOverrideBuiltins is not polymorphic");
281
#endif
282
#endif
283
    // If you hit this assertion you either have a use after free bug, or
284
    // TestNamedSetterWithOverrideBuiltins has subclasses. If TestNamedSetterWithOverrideBuiltins has subclasses that get passed
285
    // to toJS() we currently require TestNamedSetterWithOverrideBuiltins you to opt out of binding hardening
286
    // by adding the SkipVTableValidation attribute to the interface IDL definition
287
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
288
#endif
289
    return createWrapper<TestNamedSetterWithOverrideBuiltins>(globalObject, WTFMove(impl));
290
}
291
292
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithOverrideBuiltins& impl)
293
{
294
    return wrap(state, globalObject, impl);
295
}
296
297
TestNamedSetterWithOverrideBuiltins* JSTestNamedSetterWithOverrideBuiltins::toWrapped(JSC::VM& vm, JSC::JSValue value)
298
{
299
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterWithOverrideBuiltins*>(vm, value))
300
        return &wrapper->wrapped();
301
    return nullptr;
302
}
303
304
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedSetterWithOverrideBuiltins.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedSetterWithOverrideBuiltins : public JSDOMWrapper<TestNamedSetterWithOverrideBuiltins> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedSetterWithOverrideBuiltins>;
32
    static JSTestNamedSetterWithOverrideBuiltins* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithOverrideBuiltins>&& impl)
33
    {
34
        JSTestNamedSetterWithOverrideBuiltins* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithOverrideBuiltins>(globalObject->vm().heap)) JSTestNamedSetterWithOverrideBuiltins(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedSetterWithOverrideBuiltins* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpure | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedSetterWithOverrideBuiltins(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedSetterWithOverrideBuiltins>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedSetterWithOverrideBuiltinsOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedSetterWithOverrideBuiltins*)
73
{
74
    static NeverDestroyed<JSTestNamedSetterWithOverrideBuiltinsOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedSetterWithOverrideBuiltins* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedSetterWithOverrideBuiltins&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithOverrideBuiltins* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedSetterWithOverrideBuiltins>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedSetterWithOverrideBuiltins>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedSetterWithOverrideBuiltins> {
89
    using WrapperClass = JSTestNamedSetterWithOverrideBuiltins;
90
    using ToWrappedReturnType = TestNamedSetterWithOverrideBuiltins*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp +390 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedSetterWithUnforgableProperties.h"
23
24
#include "JSDOMAttribute.h"
25
#include "JSDOMBinding.h"
26
#include "JSDOMConstructorNotConstructable.h"
27
#include "JSDOMConvert.h"
28
#include "JSDOMExceptionHandling.h"
29
#include "JSDOMOperation.h"
30
#include "JSDOMWrapperCache.h"
31
#include <runtime/FunctionPrototype.h>
32
#include <wtf/GetPtr.h>
33
34
using namespace JSC;
35
36
namespace WebCore {
37
38
// Functions
39
40
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation(JSC::ExecState*);
41
42
// Attributes
43
44
JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
45
bool setJSTestNamedSetterWithUnforgablePropertiesConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
46
JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47
48
class JSTestNamedSetterWithUnforgablePropertiesPrototype : public JSC::JSNonFinalObject {
49
public:
50
    using Base = JSC::JSNonFinalObject;
51
    static JSTestNamedSetterWithUnforgablePropertiesPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
52
    {
53
        JSTestNamedSetterWithUnforgablePropertiesPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithUnforgablePropertiesPrototype>(vm.heap)) JSTestNamedSetterWithUnforgablePropertiesPrototype(vm, globalObject, structure);
54
        ptr->finishCreation(vm);
55
        return ptr;
56
    }
57
58
    DECLARE_INFO;
59
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
60
    {
61
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
62
    }
63
64
private:
65
    JSTestNamedSetterWithUnforgablePropertiesPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
66
        : JSC::JSNonFinalObject(vm, structure)
67
    {
68
    }
69
70
    void finishCreation(JSC::VM&);
71
};
72
73
using JSTestNamedSetterWithUnforgablePropertiesConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterWithUnforgableProperties>;
74
75
/* Hash table */
76
77
static const struct CompactHashIndex JSTestNamedSetterWithUnforgablePropertiesTableIndex[4] = {
78
    { -1, -1 },
79
    { 1, -1 },
80
    { -1, -1 },
81
    { 0, -1 },
82
};
83
84
85
static const HashTableValue JSTestNamedSetterWithUnforgablePropertiesTableValues[] =
86
{
87
    { "unforgeableAttribute", DontDelete | ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
88
    { "unforgeableOperation", DontDelete | ReadOnly | JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation), (intptr_t) (0) } },
89
};
90
91
static const HashTable JSTestNamedSetterWithUnforgablePropertiesTable = { 2, 3, true, JSTestNamedSetterWithUnforgablePropertiesTableValues, JSTestNamedSetterWithUnforgablePropertiesTableIndex };
92
template<> JSValue JSTestNamedSetterWithUnforgablePropertiesConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
93
{
94
    UNUSED_PARAM(vm);
95
    return globalObject.functionPrototype();
96
}
97
98
template<> void JSTestNamedSetterWithUnforgablePropertiesConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
99
{
100
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterWithUnforgableProperties::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
101
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterWithUnforgableProperties"))), ReadOnly | DontEnum);
102
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
103
}
104
105
template<> const ClassInfo JSTestNamedSetterWithUnforgablePropertiesConstructor::s_info = { "TestNamedSetterWithUnforgableProperties", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesConstructor) };
106
107
/* Hash table for prototype */
108
109
static const HashTableValue JSTestNamedSetterWithUnforgablePropertiesPrototypeTableValues[] =
110
{
111
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithUnforgablePropertiesConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterWithUnforgablePropertiesConstructor) } },
112
};
113
114
const ClassInfo JSTestNamedSetterWithUnforgablePropertiesPrototype::s_info = { "TestNamedSetterWithUnforgablePropertiesPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesPrototype) };
115
116
void JSTestNamedSetterWithUnforgablePropertiesPrototype::finishCreation(VM& vm)
117
{
118
    Base::finishCreation(vm);
119
    reifyStaticProperties(vm, JSTestNamedSetterWithUnforgablePropertiesPrototypeTableValues, *this);
120
}
121
122
const ClassInfo JSTestNamedSetterWithUnforgableProperties::s_info = { "TestNamedSetterWithUnforgableProperties", &Base::s_info, &JSTestNamedSetterWithUnforgablePropertiesTable, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgableProperties) };
123
124
JSTestNamedSetterWithUnforgableProperties::JSTestNamedSetterWithUnforgableProperties(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterWithUnforgableProperties>&& impl)
125
    : JSDOMWrapper<TestNamedSetterWithUnforgableProperties>(structure, globalObject, WTFMove(impl))
126
{
127
}
128
129
void JSTestNamedSetterWithUnforgableProperties::finishCreation(VM& vm)
130
{
131
    Base::finishCreation(vm);
132
    ASSERT(inherits(vm, info()));
133
134
}
135
136
JSObject* JSTestNamedSetterWithUnforgableProperties::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
137
{
138
    return JSTestNamedSetterWithUnforgablePropertiesPrototype::create(vm, &globalObject, JSTestNamedSetterWithUnforgablePropertiesPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
139
}
140
141
JSObject* JSTestNamedSetterWithUnforgableProperties::prototype(VM& vm, JSDOMGlobalObject& globalObject)
142
{
143
    return getDOMPrototype<JSTestNamedSetterWithUnforgableProperties>(vm, globalObject);
144
}
145
146
JSValue JSTestNamedSetterWithUnforgableProperties::getConstructor(VM& vm, const JSGlobalObject* globalObject)
147
{
148
    return getDOMConstructor<JSTestNamedSetterWithUnforgablePropertiesConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
149
}
150
151
void JSTestNamedSetterWithUnforgableProperties::destroy(JSC::JSCell* cell)
152
{
153
    JSTestNamedSetterWithUnforgableProperties* thisObject = static_cast<JSTestNamedSetterWithUnforgableProperties*>(cell);
154
    thisObject->JSTestNamedSetterWithUnforgableProperties::~JSTestNamedSetterWithUnforgableProperties();
155
}
156
157
bool JSTestNamedSetterWithUnforgableProperties::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
158
{
159
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
160
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
161
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
162
        return true;
163
    JSValue proto = thisObject->getPrototypeDirect();
164
    if (proto.isObject() && jsCast<JSObject*>(proto)->hasProperty(state, propertyName))
165
        return false;
166
167
    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {
168
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
169
        if (!IDLDOMString::isNullValue(item)) {
170
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
171
            return true;
172
        }
173
    }
174
    return false;
175
}
176
177
bool JSTestNamedSetterWithUnforgableProperties::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
178
{
179
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
180
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
181
    Identifier propertyName = Identifier::from(state, index);
182
    if (thisObject->classInfo() == info()) {
183
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
184
        if (!IDLDOMString::isNullValue(item)) {
185
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
186
            return true;
187
        }
188
    }
189
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
190
}
191
192
void JSTestNamedSetterWithUnforgableProperties::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
193
{
194
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
195
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
196
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
197
        propertyNames.add(Identifier::fromString(state, propertyName));
198
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
199
}
200
201
bool JSTestNamedSetterWithUnforgableProperties::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
202
{
203
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(cell);
204
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
205
206
    if (!propertyName.isSymbol()) {
207
        PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
208
        JSValue prototype = thisObject->getPrototypeDirect();
209
        if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
210
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
211
            auto nativeValue = convert<IDLDOMString>(*state, value);
212
            RETURN_IF_EXCEPTION(throwScope, true);
213
            thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
214
            return true;
215
        }
216
    }
217
218
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
219
}
220
221
bool JSTestNamedSetterWithUnforgableProperties::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
222
{
223
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(cell);
224
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
225
226
    Identifier propertyName = Identifier::from(state, index);
227
    PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
228
    JSValue prototype = thisObject->getPrototypeDirect();
229
    if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
230
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
231
        auto nativeValue = convert<IDLDOMString>(*state, value);
232
        RETURN_IF_EXCEPTION(throwScope, true);
233
        thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
234
        return true;
235
    }
236
237
    return Base::putByIndex(cell, state, index, value, shouldThrow);
238
}
239
240
bool JSTestNamedSetterWithUnforgableProperties::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
241
{
242
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
243
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
244
245
    if (!propertyName.isSymbol()) {
246
static bool isUnforgeablePropertyName(PropertyName propertyName)
247
{
248
    return propertyName == "unforgeableAttribute" || propertyName == "unforgeableOperation";
249
}
250
251
        if (!isUnforgeablePropertyName(propertyName)) {
252
            PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
253
            if (!Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
254
                if (!propertyDescriptor.isDataDescriptor())
255
                    return false;
256
                auto throwScope = DECLARE_THROW_SCOPE(state->vm());
257
                auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
258
                RETURN_IF_EXCEPTION(throwScope, true);
259
                thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
260
                return true;
261
            }
262
        }
263
    }
264
265
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
266
    newPropertyDescriptor.setConfigurable(true);
267
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
268
}
269
270
template<> inline JSTestNamedSetterWithUnforgableProperties* IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::cast(ExecState& state, EncodedJSValue thisValue)
271
{
272
    return jsDynamicDowncast<JSTestNamedSetterWithUnforgableProperties*>(state.vm(), JSValue::decode(thisValue));
273
}
274
275
template<> inline JSTestNamedSetterWithUnforgableProperties* IDLOperation<JSTestNamedSetterWithUnforgableProperties>::cast(ExecState& state)
276
{
277
    return jsDynamicDowncast<JSTestNamedSetterWithUnforgableProperties*>(state.vm(), state.thisValue());
278
}
279
280
EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
281
{
282
    VM& vm = state->vm();
283
    auto throwScope = DECLARE_THROW_SCOPE(vm);
284
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesPrototype*>(vm, JSValue::decode(thisValue));
285
    if (UNLIKELY(!prototype))
286
        return throwVMTypeError(state, throwScope);
287
    return JSValue::encode(JSTestNamedSetterWithUnforgableProperties::getConstructor(state->vm(), prototype->globalObject()));
288
}
289
290
bool setJSTestNamedSetterWithUnforgablePropertiesConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
291
{
292
    VM& vm = state->vm();
293
    auto throwScope = DECLARE_THROW_SCOPE(vm);
294
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesPrototype*>(vm, JSValue::decode(thisValue));
295
    if (UNLIKELY(!prototype)) {
296
        throwVMTypeError(state, throwScope);
297
        return false;
298
    }
299
    // Shadowing a built-in constructor
300
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
301
}
302
303
static inline JSValue jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttributeGetter(ExecState& state, JSTestNamedSetterWithUnforgableProperties& thisObject, ThrowScope& throwScope)
304
{
305
    UNUSED_PARAM(throwScope);
306
    UNUSED_PARAM(state);
307
    auto& impl = thisObject.wrapped();
308
    JSValue result = toJS<IDLDOMString>(state, impl.unforgeableAttribute());
309
    return result;
310
}
311
312
EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
313
{
314
    return IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::get<jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttributeGetter>(*state, thisValue, "unforgeableAttribute");
315
}
316
317
static inline JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperationBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithUnforgableProperties>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
318
{
319
    UNUSED_PARAM(state);
320
    UNUSED_PARAM(throwScope);
321
    auto& impl = castedThis->wrapped();
322
    impl.unforgeableOperation();
323
    return JSValue::encode(jsUndefined());
324
}
325
326
EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation(ExecState* state)
327
{
328
    return IDLOperation<JSTestNamedSetterWithUnforgableProperties>::call<jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperationBody>(*state, "unforgeableOperation");
329
}
330
331
bool JSTestNamedSetterWithUnforgablePropertiesOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
332
{
333
    UNUSED_PARAM(handle);
334
    UNUSED_PARAM(visitor);
335
    return false;
336
}
337
338
void JSTestNamedSetterWithUnforgablePropertiesOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
339
{
340
    auto* jsTestNamedSetterWithUnforgableProperties = static_cast<JSTestNamedSetterWithUnforgableProperties*>(handle.slot()->asCell());
341
    auto& world = *static_cast<DOMWrapperWorld*>(context);
342
    uncacheWrapper(world, &jsTestNamedSetterWithUnforgableProperties->wrapped(), jsTestNamedSetterWithUnforgableProperties);
343
}
344
345
#if ENABLE(BINDING_INTEGRITY)
346
#if PLATFORM(WIN)
347
#pragma warning(disable: 4483)
348
extern "C" { extern void (*const __identifier("??_7TestNamedSetterWithUnforgableProperties@WebCore@@6B@")[])(); }
349
#else
350
extern "C" { extern void* _ZTVN7WebCore39TestNamedSetterWithUnforgablePropertiesE[]; }
351
#endif
352
#endif
353
354
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithUnforgableProperties>&& impl)
355
{
356
357
#if ENABLE(BINDING_INTEGRITY)
358
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
359
#if PLATFORM(WIN)
360
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedSetterWithUnforgableProperties@WebCore@@6B@"));
361
#else
362
    void* expectedVTablePointer = &_ZTVN7WebCore39TestNamedSetterWithUnforgablePropertiesE[2];
363
#if COMPILER(CLANG)
364
    // If this fails TestNamedSetterWithUnforgableProperties does not have a vtable, so you need to add the
365
    // ImplementationLacksVTable attribute to the interface definition
366
    static_assert(__is_polymorphic(TestNamedSetterWithUnforgableProperties), "TestNamedSetterWithUnforgableProperties is not polymorphic");
367
#endif
368
#endif
369
    // If you hit this assertion you either have a use after free bug, or
370
    // TestNamedSetterWithUnforgableProperties has subclasses. If TestNamedSetterWithUnforgableProperties has subclasses that get passed
371
    // to toJS() we currently require TestNamedSetterWithUnforgableProperties you to opt out of binding hardening
372
    // by adding the SkipVTableValidation attribute to the interface IDL definition
373
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
374
#endif
375
    return createWrapper<TestNamedSetterWithUnforgableProperties>(globalObject, WTFMove(impl));
376
}
377
378
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithUnforgableProperties& impl)
379
{
380
    return wrap(state, globalObject, impl);
381
}
382
383
TestNamedSetterWithUnforgableProperties* JSTestNamedSetterWithUnforgableProperties::toWrapped(JSC::VM& vm, JSC::JSValue value)
384
{
385
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterWithUnforgableProperties*>(vm, value))
386
        return &wrapper->wrapped();
387
    return nullptr;
388
}
389
390
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedSetterWithUnforgableProperties.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedSetterWithUnforgableProperties : public JSDOMWrapper<TestNamedSetterWithUnforgableProperties> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedSetterWithUnforgableProperties>;
32
    static JSTestNamedSetterWithUnforgableProperties* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithUnforgableProperties>&& impl)
33
    {
34
        JSTestNamedSetterWithUnforgableProperties* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithUnforgableProperties>(globalObject->vm().heap)) JSTestNamedSetterWithUnforgableProperties(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedSetterWithUnforgableProperties* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpureForPropertyAbsence | JSC::HasStaticPropertyTable | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedSetterWithUnforgableProperties(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedSetterWithUnforgableProperties>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedSetterWithUnforgablePropertiesOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedSetterWithUnforgableProperties*)
73
{
74
    static NeverDestroyed<JSTestNamedSetterWithUnforgablePropertiesOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedSetterWithUnforgableProperties* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedSetterWithUnforgableProperties&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithUnforgableProperties* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedSetterWithUnforgableProperties>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedSetterWithUnforgableProperties>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedSetterWithUnforgableProperties> {
89
    using WrapperClass = JSTestNamedSetterWithUnforgableProperties;
90
    using ToWrappedReturnType = TestNamedSetterWithUnforgableProperties*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp +373 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#include "config.h"
22
#include "JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h"
23
24
#include "JSDOMAttribute.h"
25
#include "JSDOMBinding.h"
26
#include "JSDOMConstructorNotConstructable.h"
27
#include "JSDOMConvert.h"
28
#include "JSDOMExceptionHandling.h"
29
#include "JSDOMOperation.h"
30
#include "JSDOMWrapperCache.h"
31
#include <runtime/FunctionPrototype.h>
32
#include <wtf/GetPtr.h>
33
34
using namespace JSC;
35
36
namespace WebCore {
37
38
// Functions
39
40
JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperation(JSC::ExecState*);
41
42
// Attributes
43
44
JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
45
bool setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
46
JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsUnforgeableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
47
48
class JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype : public JSC::JSNonFinalObject {
49
public:
50
    using Base = JSC::JSNonFinalObject;
51
    static JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
52
    {
53
        JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype>(vm.heap)) JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype(vm, globalObject, structure);
54
        ptr->finishCreation(vm);
55
        return ptr;
56
    }
57
58
    DECLARE_INFO;
59
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
60
    {
61
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
62
    }
63
64
private:
65
    JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
66
        : JSC::JSNonFinalObject(vm, structure)
67
    {
68
    }
69
70
    void finishCreation(JSC::VM&);
71
};
72
73
using JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>;
74
75
/* Hash table */
76
77
static const struct CompactHashIndex JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsTableIndex[4] = {
78
    { -1, -1 },
79
    { 1, -1 },
80
    { -1, -1 },
81
    { 0, -1 },
82
};
83
84
85
static const HashTableValue JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsTableValues[] =
86
{
87
    { "unforgeableAttribute", DontDelete | ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsUnforgeableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
88
    { "unforgeableOperation", DontDelete | ReadOnly | JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperation), (intptr_t) (0) } },
89
};
90
91
static const HashTable JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsTable = { 2, 3, true, JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsTableValues, JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsTableIndex };
92
template<> JSValue JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
93
{
94
    UNUSED_PARAM(vm);
95
    return globalObject.functionPrototype();
96
}
97
98
template<> void JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
99
{
100
    putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
101
    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins"))), ReadOnly | DontEnum);
102
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
103
}
104
105
template<> const ClassInfo JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor::s_info = { "TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor) };
106
107
/* Hash table for prototype */
108
109
static const HashTableValue JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototypeTableValues[] =
110
{
111
    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor) } },
112
};
113
114
const ClassInfo JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype::s_info = { "TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype) };
115
116
void JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype::finishCreation(VM& vm)
117
{
118
    Base::finishCreation(vm);
119
    reifyStaticProperties(vm, JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototypeTableValues, *this);
120
}
121
122
const ClassInfo JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::s_info = { "TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins", &Base::s_info, &JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsTable, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins) };
123
124
JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>&& impl)
125
    : JSDOMWrapper<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>(structure, globalObject, WTFMove(impl))
126
{
127
}
128
129
void JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::finishCreation(VM& vm)
130
{
131
    Base::finishCreation(vm);
132
    ASSERT(inherits(vm, info()));
133
134
}
135
136
JSObject* JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
137
{
138
    return JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype::create(vm, &globalObject, JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
139
}
140
141
JSObject* JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::prototype(VM& vm, JSDOMGlobalObject& globalObject)
142
{
143
    return getDOMPrototype<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>(vm, globalObject);
144
}
145
146
JSValue JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getConstructor(VM& vm, const JSGlobalObject* globalObject)
147
{
148
    return getDOMConstructor<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
149
}
150
151
void JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::destroy(JSC::JSCell* cell)
152
{
153
    JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* thisObject = static_cast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(cell);
154
    thisObject->JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::~JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins();
155
}
156
157
bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
158
{
159
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(object);
160
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
161
    if (thisObject->classInfo() == info() && !propertyName.isSymbol()) {
162
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
163
        if (!IDLDOMString::isNullValue(item)) {
164
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
165
            return true;
166
        }
167
    }
168
    if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot))
169
        return true;
170
    return false;
171
}
172
173
bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
174
{
175
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(object);
176
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
177
    Identifier propertyName = Identifier::from(state, index);
178
    if (thisObject->classInfo() == info()) {
179
        auto item = thisObject->wrapped().namedItem(propertyNameToAtomicString(propertyName));
180
        if (!IDLDOMString::isNullValue(item)) {
181
            slot.setValue(thisObject, 0, toJS<IDLDOMString>(*state, item));
182
            return true;
183
        }
184
    }
185
    return Base::getOwnPropertySlotByIndex(thisObject, state, index, slot);
186
}
187
188
void JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
189
{
190
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(object);
191
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
192
    for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
193
        propertyNames.add(Identifier::fromString(state, propertyName));
194
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
195
}
196
197
bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
198
{
199
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(cell);
200
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
201
202
    if (!propertyName.isSymbol()) {
203
        auto throwScope = DECLARE_THROW_SCOPE(state->vm());
204
        auto nativeValue = convert<IDLDOMString>(*state, value);
205
        RETURN_IF_EXCEPTION(throwScope, true);
206
        thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
207
        return true;
208
    }
209
210
    return Base::put(thisObject, state, propertyName, value, putPropertySlot);
211
}
212
213
bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool)
214
{
215
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(cell);
216
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
217
218
    Identifier propertyName = Identifier::from(state, index);
219
    auto throwScope = DECLARE_THROW_SCOPE(state->vm());
220
    auto nativeValue = convert<IDLDOMString>(*state, value);
221
    RETURN_IF_EXCEPTION(throwScope, true);
222
    thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
223
    return true;
224
}
225
226
bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
227
{
228
    auto* thisObject = jsCast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(object);
229
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
230
231
    if (!propertyName.isSymbol()) {
232
static bool isUnforgeablePropertyName(PropertyName propertyName)
233
{
234
    return propertyName == "unforgeableAttribute" || propertyName == "unforgeableOperation";
235
}
236
237
        if (!isUnforgeablePropertyName(propertyName)) {
238
            if (!propertyDescriptor.isDataDescriptor())
239
                return false;
240
            auto throwScope = DECLARE_THROW_SCOPE(state->vm());
241
            auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
242
            RETURN_IF_EXCEPTION(throwScope, true);
243
            thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
244
            return true;
245
        }
246
    }
247
248
    PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
249
    newPropertyDescriptor.setConfigurable(true);
250
    return Base::defineOwnProperty(object, state, propertyName, configurablePropertyDescriptor, shouldThrow);
251
}
252
253
template<> inline JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* IDLAttribute<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast(ExecState& state, EncodedJSValue thisValue)
254
{
255
    return jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(state.vm(), JSValue::decode(thisValue));
256
}
257
258
template<> inline JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* IDLOperation<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast(ExecState& state)
259
{
260
    return jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(state.vm(), state.thisValue());
261
}
262
263
EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
264
{
265
    VM& vm = state->vm();
266
    auto throwScope = DECLARE_THROW_SCOPE(vm);
267
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype*>(vm, JSValue::decode(thisValue));
268
    if (UNLIKELY(!prototype))
269
        return throwVMTypeError(state, throwScope);
270
    return JSValue::encode(JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::getConstructor(state->vm(), prototype->globalObject()));
271
}
272
273
bool setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
274
{
275
    VM& vm = state->vm();
276
    auto throwScope = DECLARE_THROW_SCOPE(vm);
277
    auto* prototype = jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsPrototype*>(vm, JSValue::decode(thisValue));
278
    if (UNLIKELY(!prototype)) {
279
        throwVMTypeError(state, throwScope);
280
        return false;
281
    }
282
    // Shadowing a built-in constructor
283
    return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
284
}
285
286
static inline JSValue jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsUnforgeableAttributeGetter(ExecState& state, JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins& thisObject, ThrowScope& throwScope)
287
{
288
    UNUSED_PARAM(throwScope);
289
    UNUSED_PARAM(state);
290
    auto& impl = thisObject.wrapped();
291
    JSValue result = toJS<IDLDOMString>(state, impl.unforgeableAttribute());
292
    return result;
293
}
294
295
EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsUnforgeableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
296
{
297
    return IDLAttribute<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::get<jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsUnforgeableAttributeGetter>(*state, thisValue, "unforgeableAttribute");
298
}
299
300
static inline JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperationBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
301
{
302
    UNUSED_PARAM(state);
303
    UNUSED_PARAM(throwScope);
304
    auto& impl = castedThis->wrapped();
305
    impl.unforgeableOperation();
306
    return JSValue::encode(jsUndefined());
307
}
308
309
EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperation(ExecState* state)
310
{
311
    return IDLOperation<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::call<jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsInstanceFunctionUnforgeableOperationBody>(*state, "unforgeableOperation");
312
}
313
314
bool JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
315
{
316
    UNUSED_PARAM(handle);
317
    UNUSED_PARAM(visitor);
318
    return false;
319
}
320
321
void JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
322
{
323
    auto* jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins = static_cast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(handle.slot()->asCell());
324
    auto& world = *static_cast<DOMWrapperWorld*>(context);
325
    uncacheWrapper(world, &jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins->wrapped(), jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins);
326
}
327
328
#if ENABLE(BINDING_INTEGRITY)
329
#if PLATFORM(WIN)
330
#pragma warning(disable: 4483)
331
extern "C" { extern void (*const __identifier("??_7TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins@WebCore@@6B@")[])(); }
332
#else
333
extern "C" { extern void* _ZTVN7WebCore58TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsE[]; }
334
#endif
335
#endif
336
337
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>&& impl)
338
{
339
340
#if ENABLE(BINDING_INTEGRITY)
341
    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
342
#if PLATFORM(WIN)
343
    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins@WebCore@@6B@"));
344
#else
345
    void* expectedVTablePointer = &_ZTVN7WebCore58TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsE[2];
346
#if COMPILER(CLANG)
347
    // If this fails TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins does not have a vtable, so you need to add the
348
    // ImplementationLacksVTable attribute to the interface definition
349
    static_assert(__is_polymorphic(TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins), "TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins is not polymorphic");
350
#endif
351
#endif
352
    // If you hit this assertion you either have a use after free bug, or
353
    // TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins has subclasses. If TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins has subclasses that get passed
354
    // to toJS() we currently require TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins you to opt out of binding hardening
355
    // by adding the SkipVTableValidation attribute to the interface IDL definition
356
    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
357
#endif
358
    return createWrapper<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>(globalObject, WTFMove(impl));
359
}
360
361
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins& impl)
362
{
363
    return wrap(state, globalObject, impl);
364
}
365
366
TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::toWrapped(JSC::VM& vm, JSC::JSValue value)
367
{
368
    if (auto* wrapper = jsDynamicDowncast<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*>(vm, value))
369
        return &wrapper->wrapped();
370
    return nullptr;
371
}
372
373
}
- Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h +93 lines
Line 0 Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h_sec1
1
/*
2
    This file is part of the WebKit open source project.
3
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5
    This library is free software; you can redistribute it and/or
6
    modify it under the terms of the GNU Library General Public
7
    License as published by the Free Software Foundation; either
8
    version 2 of the License, or (at your option) any later version.
9
10
    This library is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
    Library General Public License for more details.
14
15
    You should have received a copy of the GNU Library General Public License
16
    along with this library; see the file COPYING.LIB.  If not, write to
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
    Boston, MA 02110-1301, USA.
19
*/
20
21
#pragma once
22
23
#include "JSDOMWrapper.h"
24
#include "TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h"
25
#include <wtf/NeverDestroyed.h>
26
27
namespace WebCore {
28
29
class JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins : public JSDOMWrapper<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins> {
30
public:
31
    using Base = JSDOMWrapper<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>;
32
    static JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>&& impl)
33
    {
34
        JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>(globalObject->vm().heap)) JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins(structure, *globalObject, WTFMove(impl));
35
        ptr->finishCreation(globalObject->vm());
36
        return ptr;
37
    }
38
39
    static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
40
    static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
41
    static TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
45
    static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
46
    static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
47
    static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, const JSC::PropertyDescriptor&, bool shouldThrow);
48
    static void destroy(JSC::JSCell*);
49
50
    DECLARE_INFO;
51
52
    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
53
    {
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
57
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
public:
59
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpure | JSC::HasStaticPropertyTable | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
60
protected:
61
    JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins(JSC::Structure*, JSDOMGlobalObject&, Ref<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>&&);
62
63
    void finishCreation(JSC::VM&);
64
};
65
66
class JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsOwner : public JSC::WeakHandleOwner {
67
public:
68
    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
69
    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
70
};
71
72
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*)
73
{
74
    static NeverDestroyed<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsOwner> owner;
75
    return &owner.get();
76
}
77
78
inline void* wrapperKey(TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* wrappableObject)
79
{
80
    return wrappableObject;
81
}
82
83
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins&);
84
inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
85
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>&&);
86
inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
87
88
template<> struct JSDOMWrapperConverterTraits<TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins> {
89
    using WrapperClass = JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins;
90
    using ToWrappedReturnType = TestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins*;
91
};
92
93
} // namespace WebCore
- Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp -63 / +63 lines
Lines 1972-1977 void JSTestObj::getOwnPropertyNames(JSOb Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp_sec1
1972
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
1972
    Base::getOwnPropertyNames(thisObject, state, propertyNames, mode);
1973
}
1973
}
1974
1974
1975
static inline EncodedJSValue callJSTestObj1(ExecState* state)
1976
{
1977
    VM& vm = state->vm();
1978
    auto throwScope = DECLARE_THROW_SCOPE(vm);
1979
    UNUSED_PARAM(throwScope);
1980
    auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
1981
    ASSERT(castedThis);
1982
    auto& impl = castedThis->wrapped();
1983
    auto param = convert<IDLLong>(*state, state->uncheckedArgument(0));
1984
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
1985
    impl.legacyCallerNamed(WTFMove(param));
1986
    return JSValue::encode(jsUndefined());
1987
}
1988
1989
static inline EncodedJSValue callJSTestObj2(ExecState* state)
1990
{
1991
    VM& vm = state->vm();
1992
    auto throwScope = DECLARE_THROW_SCOPE(vm);
1993
    UNUSED_PARAM(throwScope);
1994
    auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
1995
    ASSERT(castedThis);
1996
    auto& impl = castedThis->wrapped();
1997
    auto param = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
1998
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
1999
    return JSValue::encode(toJS<IDLLong>(impl.legacyCallerOperationFromBindings(WTFMove(param))));
2000
}
2001
2002
static inline EncodedJSValue callJSTestObj3(ExecState* state)
2003
{
2004
    VM& vm = state->vm();
2005
    auto throwScope = DECLARE_THROW_SCOPE(vm);
2006
    UNUSED_PARAM(throwScope);
2007
    auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
2008
    ASSERT(castedThis);
2009
    auto& impl = castedThis->wrapped();
2010
    impl.legacyCallerOperationFromBindings();
2011
    return JSValue::encode(jsUndefined());
2012
}
2013
2014
EncodedJSValue JSC_HOST_CALL callJSTestObj(ExecState* state)
2015
{
2016
    VM& vm = state->vm();
2017
    auto throwScope = DECLARE_THROW_SCOPE(vm);
2018
    UNUSED_PARAM(throwScope);
2019
    size_t argsCount = std::min<size_t>(1, state->argumentCount());
2020
    if (argsCount == 0) {
2021
        return callJSTestObj3(state);
2022
    }
2023
    if (argsCount == 1) {
2024
        JSValue distinguishingArg = state->uncheckedArgument(0);
2025
        if (distinguishingArg.isNumber())
2026
            return callJSTestObj1(state);
2027
        return callJSTestObj2(state);
2028
    }
2029
    return throwVMTypeError(state, throwScope);
2030
}
2031
2032
CallType JSTestObj::getCallData(JSCell*, CallData& callData)
2033
{
2034
    callData.native.function = callJSTestObj;
2035
    return CallType::Host;
2036
}
2037
1975
template<> inline JSTestObj* IDLAttribute<JSTestObj>::cast(ExecState& state, EncodedJSValue thisValue)
2038
template<> inline JSTestObj* IDLAttribute<JSTestObj>::cast(ExecState& state, EncodedJSValue thisValue)
1976
{
2039
{
1977
    return jsDynamicDowncast<JSTestObj*>(state.vm(), JSValue::decode(thisValue));
2040
    return jsDynamicDowncast<JSTestObj*>(state.vm(), JSValue::decode(thisValue));
Lines 7794-7862 EncodedJSValue JSC_HOST_CALL jsTestObjPr Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp_sec2
7794
    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionToStringBody>(*state, "toString");
7857
    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionToStringBody>(*state, "toString");
7795
}
7858
}
7796
7859
7797
static inline EncodedJSValue callJSTestObj1(ExecState* state)
7798
{
7799
    VM& vm = state->vm();
7800
    auto throwScope = DECLARE_THROW_SCOPE(vm);
7801
    UNUSED_PARAM(throwScope);
7802
    auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
7803
    ASSERT(castedThis);
7804
    auto& impl = castedThis->wrapped();
7805
    auto param = convert<IDLLong>(*state, state->uncheckedArgument(0));
7806
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
7807
    impl.legacyCallerNamed(WTFMove(param));
7808
    return JSValue::encode(jsUndefined());
7809
}
7810
7811
static inline EncodedJSValue callJSTestObj2(ExecState* state)
7812
{
7813
    VM& vm = state->vm();
7814
    auto throwScope = DECLARE_THROW_SCOPE(vm);
7815
    UNUSED_PARAM(throwScope);
7816
    auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
7817
    ASSERT(castedThis);
7818
    auto& impl = castedThis->wrapped();
7819
    auto param = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
7820
    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
7821
    return JSValue::encode(toJS<IDLLong>(impl.legacyCallerOperationFromBindings(WTFMove(param))));
7822
}
7823
7824
static inline EncodedJSValue callJSTestObj3(ExecState* state)
7825
{
7826
    VM& vm = state->vm();
7827
    auto throwScope = DECLARE_THROW_SCOPE(vm);
7828
    UNUSED_PARAM(throwScope);
7829
    auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
7830
    ASSERT(castedThis);
7831
    auto& impl = castedThis->wrapped();
7832
    impl.legacyCallerOperationFromBindings();
7833
    return JSValue::encode(jsUndefined());
7834
}
7835
7836
EncodedJSValue JSC_HOST_CALL callJSTestObj(ExecState* state)
7837
{
7838
    VM& vm = state->vm();
7839
    auto throwScope = DECLARE_THROW_SCOPE(vm);
7840
    UNUSED_PARAM(throwScope);
7841
    size_t argsCount = std::min<size_t>(1, state->argumentCount());
7842
    if (argsCount == 0) {
7843
        return callJSTestObj3(state);
7844
    }
7845
    if (argsCount == 1) {
7846
        JSValue distinguishingArg = state->uncheckedArgument(0);
7847
        if (distinguishingArg.isNumber())
7848
            return callJSTestObj1(state);
7849
        return callJSTestObj2(state);
7850
    }
7851
    return throwVMTypeError(state, throwScope);
7852
}
7853
7854
CallType JSTestObj::getCallData(JSCell*, CallData& callData)
7855
{
7856
    callData.native.function = callJSTestObj;
7857
    return CallType::Host;
7858
}
7859
7860
JSC::JSObject* JSTestObj::serialize(ExecState* state, JSTestObj* thisObject, ThrowScope& throwScope)
7860
JSC::JSObject* JSTestObj::serialize(ExecState* state, JSTestObj* thisObject, ThrowScope& throwScope)
7861
{
7861
{
7862
    auto& vm = state->vm();
7862
    auto& vm = state->vm();
- Source/WebCore/bindings/scripts/test/JS/JSTestObj.h -1 / +1 lines
Lines 43-48 public: Source/WebCore/bindings/scripts/test/JS/JSTestObj.h_sec1
43
    static TestObj* toWrapped(JSC::VM&, JSC::JSValue);
43
    static TestObj* toWrapped(JSC::VM&, JSC::JSValue);
44
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
44
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
45
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
45
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
46
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
46
    static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
47
    static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);
47
48
48
    static void destroy(JSC::JSCell*);
49
    static void destroy(JSC::JSCell*);
Lines 54-60 public: Source/WebCore/bindings/scripts/test/JS/JSTestObj.h_sec2
54
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
55
    }
56
    }
56
57
57
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
58
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
58
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
59
    static JSC::JSObject* serialize(JSC::ExecState*, JSTestObj* thisObject, JSC::ThrowScope&);
59
    static JSC::JSObject* serialize(JSC::ExecState*, JSTestObj* thisObject, JSC::ThrowScope&);
60
    mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1;
60
    mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1;
- Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.h -1 / +1 lines
Lines 41-46 public: Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.h_sec1
41
    static TestOverrideBuiltins* toWrapped(JSC::VM&, JSC::JSValue);
41
    static TestOverrideBuiltins* toWrapped(JSC::VM&, JSC::JSValue);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
42
    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
43
    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
44
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
44
    static void destroy(JSC::JSCell*);
45
    static void destroy(JSC::JSCell*);
45
46
46
    DECLARE_INFO;
47
    DECLARE_INFO;
Lines 50-56 public: Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.h_sec2
50
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
51
        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
51
    }
52
    }
52
53
53
    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
54
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
54
    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
55
public:
55
public:
56
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpure | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
56
    static const unsigned StructureFlags = JSC::GetOwnPropertySlotIsImpure | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
- Source/WebCore/css/CSSStyleDeclaration.idl -1 / +1 lines
Lines 20-29 Source/WebCore/css/CSSStyleDeclaration.idl_sec1
20
20
21
[
21
[
22
    CustomEnumerateProperty,
22
    CustomEnumerateProperty,
23
    CustomGetOwnPropertySlotAndDescriptor,
23
    CustomNamedSetter,
24
    CustomNamedSetter,
24
    ExportMacro=WEBCORE_EXPORT,
25
    ExportMacro=WEBCORE_EXPORT,
25
    GenerateIsReachable,
26
    GenerateIsReachable,
26
    JSCustomGetOwnPropertySlotAndDescriptor,
27
    JSCustomHeader,
27
    JSCustomHeader,
28
    JSCustomMarkFunction,
28
    JSCustomMarkFunction,
29
    SkipVTableValidation,
29
    SkipVTableValidation,
- Source/WebCore/dom/DOMStringMap.idl -5 / +1 lines
Lines 24-39 Source/WebCore/dom/DOMStringMap.idl_sec1
24
 */
24
 */
25
25
26
[
26
[
27
    CustomNamedSetter,
28
    GenerateIsReachable=ImplElementRoot,
27
    GenerateIsReachable=ImplElementRoot,
29
    OverrideBuiltins,
28
    OverrideBuiltins,
30
    SkipVTableValidation,
29
    SkipVTableValidation,
31
] interface DOMStringMap {
30
] interface DOMStringMap {
32
    getter DOMString (DOMString name);
31
    getter DOMString (DOMString name);
33
32
    [CEReactions, MayThrowException] setter void (DOMString name, DOMString value);
34
    // FIXME: Add support for the named setter special.
35
    // [CEReactions] setter void (DOMString name, DOMString value);
36
37
    [CEReactions] deleter void (DOMString name);
33
    [CEReactions] deleter void (DOMString name);
38
};
34
};
39
35
- Source/WebCore/dom/DatasetDOMStringMap.cpp -1 / +1 lines
Lines 217-223 String DatasetDOMStringMap::namedItem(co Source/WebCore/dom/DatasetDOMStringMap.cpp_sec1
217
    return item(name).value_or(String { });
217
    return item(name).value_or(String { });
218
}
218
}
219
219
220
ExceptionOr<void> DatasetDOMStringMap::setItem(const String& name, const String& value)
220
ExceptionOr<void> DatasetDOMStringMap::setNamedItem(const String& name, const String& value)
221
{
221
{
222
    if (!isValidPropertyName(name))
222
    if (!isValidPropertyName(name))
223
        return Exception { SYNTAX_ERR };
223
        return Exception { SYNTAX_ERR };
- Source/WebCore/dom/DatasetDOMStringMap.h -1 / +1 lines
Lines 47-53 public: Source/WebCore/dom/DatasetDOMStringMap.h_sec1
47
    Vector<String> supportedPropertyNames() const;
47
    Vector<String> supportedPropertyNames() const;
48
48
49
    String namedItem(const AtomicString& name) const;
49
    String namedItem(const AtomicString& name) const;
50
    ExceptionOr<void> setItem(const String& name, const String& value);
50
    ExceptionOr<void> setNamedItem(const String& name, const String& value);
51
    bool deleteNamedProperty(const String& name);
51
    bool deleteNamedProperty(const String& name);
52
52
53
    Element& element() { return m_element; }
53
    Element& element() { return m_element; }
- Source/WebCore/dom/Node.idl -1 / +1 lines
Lines 20-31 Source/WebCore/dom/Node.idl_sec1
20
20
21
[
21
[
22
    CustomIsReachable,
22
    CustomIsReachable,
23
    CustomPushEventHandlerScope,
23
    CustomToJSObject,
24
    CustomToJSObject,
24
    DOMJIT,
25
    DOMJIT,
25
    ExportMacro=WEBCORE_EXPORT,
26
    ExportMacro=WEBCORE_EXPORT,
26
    JSCustomHeader,
27
    JSCustomHeader,
27
    JSCustomMarkFunction,
28
    JSCustomMarkFunction,
28
    JSCustomPushEventHandlerScope,
29
] interface Node : EventTarget {
29
] interface Node : EventTarget {
30
    const unsigned short ELEMENT_NODE = 1;
30
    const unsigned short ELEMENT_NODE = 1;
31
    const unsigned short ATTRIBUTE_NODE = 2;
31
    const unsigned short ATTRIBUTE_NODE = 2;
- Source/WebCore/html/HTMLAppletElement.idl -1 / +1 lines
Lines 20-27 Source/WebCore/html/HTMLAppletElement.idl_sec1
20
20
21
[
21
[
22
    CustomCall,
22
    CustomCall,
23
    CustomGetOwnPropertySlotAndDescriptor,
23
    CustomNamedSetter,
24
    CustomNamedSetter,
24
    JSCustomGetOwnPropertySlotAndDescriptor,
25
] interface HTMLAppletElement : HTMLElement {
25
] interface HTMLAppletElement : HTMLElement {
26
    [Reflect] attribute DOMString align;
26
    [Reflect] attribute DOMString align;
27
    [Reflect] attribute DOMString alt;
27
    [Reflect] attribute DOMString alt;
- Source/WebCore/html/HTMLCollection.cpp +13 lines
Lines 179-184 const Vector<AtomicString>& HTMLCollecti Source/WebCore/html/HTMLCollection.cpp_sec1
179
    return m_namedElementCache->propertyNames();
179
    return m_namedElementCache->propertyNames();
180
}
180
}
181
181
182
bool HTMLCollection::isSupportedPropertyName(const String& name)
183
{
184
    updateNamedElementCache();
185
    ASSERT(m_namedElementCache);
186
    
187
    if (m_namedElementCache->findElementsWithId(name))
188
        return true;
189
    if (m_namedElementCache->findElementsWithName(name))
190
        return true;
191
192
    return false;
193
}
194
182
void HTMLCollection::updateNamedElementCache() const
195
void HTMLCollection::updateNamedElementCache() const
183
{
196
{
184
    if (hasNamedElementCache())
197
    if (hasNamedElementCache())
- Source/WebCore/html/HTMLCollection.h -1 / +2 lines
Lines 38-44 public: Source/WebCore/html/HTMLCollection.h_sec1
38
    const Vector<Element*>* findElementsWithId(const AtomicString& id) const;
38
    const Vector<Element*>* findElementsWithId(const AtomicString& id) const;
39
    const Vector<Element*>* findElementsWithName(const AtomicString& name) const;
39
    const Vector<Element*>* findElementsWithName(const AtomicString& name) const;
40
    const Vector<AtomicString>& propertyNames() const { return m_propertyNames; }
40
    const Vector<AtomicString>& propertyNames() const { return m_propertyNames; }
41
41
    
42
    void appendToIdCache(const AtomicString& id, Element&);
42
    void appendToIdCache(const AtomicString& id, Element&);
43
    void appendToNameCache(const AtomicString& name, Element&);
43
    void appendToNameCache(const AtomicString& name, Element&);
44
    void didPopulate();
44
    void didPopulate();
Lines 69-74 public: Source/WebCore/html/HTMLCollection.h_sec2
69
    Element* item(unsigned index) const override = 0; // Tighten return type from NodeList::item().
69
    Element* item(unsigned index) const override = 0; // Tighten return type from NodeList::item().
70
    virtual Element* namedItem(const AtomicString& name) const = 0;
70
    virtual Element* namedItem(const AtomicString& name) const = 0;
71
    const Vector<AtomicString>& supportedPropertyNames();
71
    const Vector<AtomicString>& supportedPropertyNames();
72
    bool isSupportedPropertyName(const String& name);
72
73
73
    // Non-DOM API
74
    // Non-DOM API
74
    Vector<Ref<Element>> namedItems(const AtomicString& name) const;
75
    Vector<Ref<Element>> namedItems(const AtomicString& name) const;
- Source/WebCore/html/HTMLElement.idl -1 / +1 lines
Lines 20-27 Source/WebCore/html/HTMLElement.idl_sec1
20
20
21
[
21
[
22
    CustomConstructor(),
22
    CustomConstructor(),
23
    CustomPushEventHandlerScope,
23
    ExportMacro=WEBCORE_EXPORT,
24
    ExportMacro=WEBCORE_EXPORT,
24
    JSCustomPushEventHandlerScope,
25
    JSGenerateToNativeObject,
25
    JSGenerateToNativeObject,
26
] interface HTMLElement : Element {
26
] interface HTMLElement : Element {
27
    // Metadata attributes.
27
    // Metadata attributes.
- Source/WebCore/html/HTMLEmbedElement.idl -1 / +1 lines
Lines 20-27 Source/WebCore/html/HTMLEmbedElement.idl_sec1
20
20
21
[
21
[
22
    CustomCall,
22
    CustomCall,
23
    CustomGetOwnPropertySlotAndDescriptor,
23
    CustomNamedSetter,
24
    CustomNamedSetter,
24
    JSCustomGetOwnPropertySlotAndDescriptor,
25
] interface HTMLEmbedElement : HTMLElement {
25
] interface HTMLEmbedElement : HTMLElement {
26
    [Reflect] attribute DOMString align;
26
    [Reflect] attribute DOMString align;
27
    [Reflect] attribute DOMString height;
27
    [Reflect] attribute DOMString height;
- Source/WebCore/html/HTMLObjectElement.idl -2 / +2 lines
Lines 20-27 Source/WebCore/html/HTMLObjectElement.idl_sec1
20
20
21
[
21
[
22
    CustomCall,
22
    CustomCall,
23
    CustomNamedSetter,
23
    CustomGetOwnPropertySlotAndDescriptor,
24
    JSCustomGetOwnPropertySlotAndDescriptor,
24
    CustomNamedSetter
25
] interface HTMLObjectElement : HTMLElement {
25
] interface HTMLObjectElement : HTMLElement {
26
    readonly attribute HTMLFormElement form;
26
    readonly attribute HTMLFormElement form;
27
    [Reflect] attribute DOMString code;
27
    [Reflect] attribute DOMString code;
- Source/WebCore/html/HTMLOptionsCollection.h -3 / +12 lines
Lines 31-36 namespace WebCore { Source/WebCore/html/HTMLOptionsCollection.h_sec1
31
31
32
class HTMLOptionsCollection final : public CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType> {
32
class HTMLOptionsCollection final : public CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType> {
33
public:
33
public:
34
    using Base = CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType>;
35
34
    static Ref<HTMLOptionsCollection> create(HTMLSelectElement&, CollectionType);
36
    static Ref<HTMLOptionsCollection> create(HTMLSelectElement&, CollectionType);
35
37
36
    HTMLSelectElement& selectElement() { return downcast<HTMLSelectElement>(ownerNode()); }
38
    HTMLSelectElement& selectElement() { return downcast<HTMLSelectElement>(ownerNode()); }
Lines 38-44 public: Source/WebCore/html/HTMLOptionsCollection.h_sec2
38
40
39
    HTMLOptionElement* item(unsigned offset) const final;
41
    HTMLOptionElement* item(unsigned offset) const final;
40
    HTMLOptionElement* namedItem(const AtomicString& name) const final;
42
    HTMLOptionElement* namedItem(const AtomicString& name) const final;
41
43
    
44
    ExceptionOr<void> setItem(unsigned index, HTMLOptionElement*);
45
    
42
    using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>;
46
    using OptionOrOptGroupElement = Variant<RefPtr<HTMLOptionElement>, RefPtr<HTMLOptGroupElement>>;
43
    using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>;
47
    using HTMLElementOrInt = Variant<RefPtr<HTMLElement>, int>;
44
    WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const std::optional<HTMLElementOrInt>& before);
48
    WEBCORE_EXPORT ExceptionOr<void> add(const OptionOrOptGroupElement&, const std::optional<HTMLElementOrInt>& before);
Lines 58-69 private: Source/WebCore/html/HTMLOptionsCollection.h_sec3
58
62
59
inline HTMLOptionElement* HTMLOptionsCollection::item(unsigned offset) const
63
inline HTMLOptionElement* HTMLOptionsCollection::item(unsigned offset) const
60
{
64
{
61
    return downcast<HTMLOptionElement>(CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType>::item(offset));
65
    return downcast<HTMLOptionElement>(Base::item(offset));
62
}
66
}
63
67
64
inline HTMLOptionElement* HTMLOptionsCollection::namedItem(const AtomicString& name) const
68
inline HTMLOptionElement* HTMLOptionsCollection::namedItem(const AtomicString& name) const
65
{
69
{
66
    return downcast<HTMLOptionElement>(CachedHTMLCollection<HTMLOptionsCollection, CollectionTypeTraits<SelectOptions>::traversalType>::namedItem(name));
70
    return downcast<HTMLOptionElement>(Base::namedItem(name));
71
}
72
73
inline ExceptionOr<void> HTMLOptionsCollection::setItem(unsigned index, HTMLOptionElement* optionElement)
74
{
75
    return selectElement().setItem(index, optionElement);
67
}
76
}
68
77
69
inline bool HTMLOptionsCollection::elementMatches(Element& element) const
78
inline bool HTMLOptionsCollection::elementMatches(Element& element) const
- Source/WebCore/html/HTMLOptionsCollection.idl -2 / +1 lines
Lines 19-31 Source/WebCore/html/HTMLOptionsCollection.idl_sec1
19
 */
19
 */
20
20
21
[
21
[
22
    CustomIndexedSetter,
23
    ExportToWrappedFunction,
22
    ExportToWrappedFunction,
24
    GenerateIsReachable=ImplOwnerNodeRoot,
23
    GenerateIsReachable=ImplOwnerNodeRoot,
25
    JSGenerateToNativeObject,
24
    JSGenerateToNativeObject,
26
] interface HTMLOptionsCollection : HTMLCollection {
25
] interface HTMLOptionsCollection : HTMLCollection {
27
    [CEReactions, SetterMayThrowException] attribute unsigned long length;
26
    [CEReactions, SetterMayThrowException] attribute unsigned long length;
28
    // [CEReactions] setter void (unsigned long index, HTMLOptionElement? option);
27
    [CEReactions] setter void (unsigned long index, HTMLOptionElement? option);
29
    [CEReactions, MayThrowException] void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
28
    [CEReactions, MayThrowException] void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
30
    [CEReactions] void remove(long index);
29
    [CEReactions] void remove(long index);
31
30
- Source/WebCore/html/HTMLSelectElement.idl -18 / +12 lines
Lines 19-53 Source/WebCore/html/HTMLSelectElement.idl_sec1
19
 */
19
 */
20
20
21
[
21
[
22
    CustomIndexedSetter,
23
    ExportMacro=WEBCORE_EXPORT,
22
    ExportMacro=WEBCORE_EXPORT,
24
    JSGenerateToNativeObject,
23
    JSGenerateToNativeObject,
25
] interface HTMLSelectElement : HTMLElement {
24
] interface HTMLSelectElement : HTMLElement {
26
    [Reflect] attribute boolean autofocus;
25
    [CEReactions] attribute DOMString autocomplete;
27
    [Reflect] attribute boolean disabled;
26
    [CEReactions, Reflect] attribute boolean autofocus;
27
    [CEReactions, Reflect] attribute boolean disabled;
28
    readonly attribute HTMLFormElement? form;
28
    readonly attribute HTMLFormElement? form;
29
    attribute boolean multiple;
29
    [CEReactions] attribute boolean multiple;
30
    [Reflect] attribute DOMString name;
30
    [CEReactions, Reflect] attribute DOMString name;
31
    [Reflect] attribute boolean required;
31
    [CEReactions, Reflect] attribute boolean required;
32
32
    [CEReactions] attribute unsigned long size;
33
    attribute unsigned long size;
34
33
35
    readonly attribute DOMString type;
34
    readonly attribute DOMString type;
36
35
37
    readonly attribute HTMLOptionsCollection options;
36
    /* [SameObject] */ readonly attribute HTMLOptionsCollection options;
38
    [CEReactions, SetterMayThrowException] attribute unsigned long length;
37
    [CEReactions, SetterMayThrowException] attribute unsigned long length;
39
38
    getter HTMLOptionElement? item(unsigned long index); // FIXME: The spec has this returning Element?.
40
    getter HTMLOptionElement? item(unsigned long index);
41
    HTMLOptionElement? namedItem(DOMString name);
39
    HTMLOptionElement? namedItem(DOMString name);
42
43
    [CEReactions, MayThrowException] void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
40
    [CEReactions, MayThrowException] void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
44
41
    [CEReactions, MayThrowException] void remove(); // ChildNode overload
45
    [MayThrowException] void remove(); // ChildNode overload
46
    [CEReactions] void remove(long index);
42
    [CEReactions] void remove(long index);
43
    [CEReactions] setter void (unsigned long index, HTMLOptionElement? option);
47
44
48
    readonly attribute HTMLCollection selectedOptions;
45
    /* [SameObject] */ readonly attribute HTMLCollection selectedOptions;
49
    attribute long selectedIndex;
46
    attribute long selectedIndex;
50
51
    attribute DOMString value;
47
    attribute DOMString value;
52
48
53
    readonly attribute boolean willValidate;
49
    readonly attribute boolean willValidate;
Lines 58-63 Source/WebCore/html/HTMLSelectElement.idl_sec2
58
    void setCustomValidity(DOMString error);
54
    void setCustomValidity(DOMString error);
59
55
60
    readonly attribute NodeList labels;
56
    readonly attribute NodeList labels;
61
62
    attribute DOMString autocomplete;
63
};
57
};
- Source/WebCore/page/DOMWindow.idl -1 / +2 lines
Lines 28-36 typedef USVString CSSOMString; Source/WebCore/page/DOMWindow.idl_sec1
28
28
29
[
29
[
30
    CheckSecurity,
30
    CheckSecurity,
31
    CustomDefineOwnProperty,
31
    CustomDeleteProperty,
32
    CustomDeleteProperty,
32
    CustomEnumerateProperty,
33
    CustomEnumerateProperty,
33
    CustomGetOwnPropertySlot,
34
    CustomGetOwnPropertySlot,
35
    CustomGetOwnPropertySlotByIndex,
34
    CustomGetPrototype,
36
    CustomGetPrototype,
35
    CustomPreventExtensions,
37
    CustomPreventExtensions,
36
    CustomProxyToJSObject,
38
    CustomProxyToJSObject,
Lines 41-47 typedef USVString CSSOMString; Source/WebCore/page/DOMWindow.idl_sec2
41
    InterfaceName=Window,
43
    InterfaceName=Window,
42
    IsImmutablePrototypeExoticObject,
44
    IsImmutablePrototypeExoticObject,
43
    IsImmutablePrototypeExoticObjectOnPrototype,
45
    IsImmutablePrototypeExoticObjectOnPrototype,
44
    JSCustomDefineOwnProperty,
45
    JSCustomMarkFunction,
46
    JSCustomMarkFunction,
46
    JSCustomToNativeObject,
47
    JSCustomToNativeObject,
47
    JSLegacyParent=JSDOMWindowBase,
48
    JSLegacyParent=JSDOMWindowBase,
- Source/WebCore/page/Location.idl -4 / +4 lines
Lines 28-45 Source/WebCore/page/Location.idl_sec1
28
28
29
[
29
[
30
    CheckSecurity,
30
    CheckSecurity,
31
    CustomDefineOwnProperty,
32
    CustomDefineOwnPropertyOnPrototype,
31
    CustomDeleteProperty,
33
    CustomDeleteProperty,
32
    CustomEnumerateProperty,
34
    CustomEnumerateProperty,
35
    CustomGetOwnPropertySlotAndDescriptor,
33
    CustomGetPrototype,
36
    CustomGetPrototype,
37
    CustomNamedGetterOnPrototype,
34
    CustomNamedSetter,
38
    CustomNamedSetter,
35
    CustomPreventExtensions,
39
    CustomPreventExtensions,
36
    CustomToStringName,
40
    CustomToStringName,
37
    GenerateIsReachable=ImplFrame,
41
    GenerateIsReachable=ImplFrame,
38
    IsImmutablePrototypeExoticObject,
42
    IsImmutablePrototypeExoticObject,
39
    JSCustomDefineOwnProperty,
40
    JSCustomDefineOwnPropertyOnPrototype,
41
    JSCustomGetOwnPropertySlotAndDescriptor,
42
    JSCustomNamedGetterOnPrototype,
43
    Unforgeable,
43
    Unforgeable,
44
] interface Location {
44
] interface Location {
45
    [SetterCallWith=ActiveWindow&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
45
    [SetterCallWith=ActiveWindow&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
- Source/WebCore/page/UserMessageHandlersNamespace.idl -2 / +2 lines
Lines 24-30 Source/WebCore/page/UserMessageHandlersNamespace.idl_sec1
24
 */
24
 */
25
25
26
[
26
[
27
    JSCustomGetOwnPropertySlotAndDescriptor,
27
    Conditional=USER_MESSAGE_HANDLERS,
28
    Conditional=USER_MESSAGE_HANDLERS
28
    CustomGetOwnPropertySlotAndDescriptor,
29
] interface UserMessageHandlersNamespace {
29
] interface UserMessageHandlersNamespace {
30
};
30
};
- Source/WebCore/storage/Storage.idl -2 / +1 lines
Lines 25-38 Source/WebCore/storage/Storage.idl_sec1
25
25
26
[
26
[
27
    CustomEnumerateProperty,
27
    CustomEnumerateProperty,
28
    CustomNamedSetter,
29
    GenerateIsReachable=ImplFrame,
28
    GenerateIsReachable=ImplFrame,
30
    SkipVTableValidation,
29
    SkipVTableValidation,
31
] interface Storage {
30
] interface Storage {
32
    [GetterMayThrowException] readonly attribute unsigned long length;
31
    [GetterMayThrowException] readonly attribute unsigned long length;
33
    [MayThrowException] DOMString? key(unsigned long index);
32
    [MayThrowException] DOMString? key(unsigned long index);
34
    [MayThrowException] getter DOMString? getItem(DOMString key);
33
    [MayThrowException] getter DOMString? getItem(DOMString key);
35
    [MayThrowException] /*setter*/ void setItem(DOMString key, DOMString data);
34
    [MayThrowException] setter void setItem(DOMString key, DOMString data);
36
    [MayThrowException] deleter void removeItem(DOMString key);
35
    [MayThrowException] deleter void removeItem(DOMString key);
37
    [MayThrowException] void clear();
36
    [MayThrowException] void clear();
38
};
37
};
- LayoutTests/ChangeLog +19 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2017-06-03  Sam Weinig  <sam@webkit.org>
2
3
        Can't use Object.defineProperty() to add an item to a DOMStringMap or Storage
4
        https://bugs.webkit.org/show_bug.cgi?id=172687
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * js/dom/legacy-platform-object-defineOwnProperty-expected.txt: Added.
9
        * js/dom/legacy-platform-object-defineOwnProperty.html: Added.
10
        New tests for Object.defineProperty on Storage and DOMStringMap.
11
12
        * js/dom/named-property-deleter.html:
13
        Fix test which was deleting the wrong property. This doesn't change the result,
14
        but is now actually testing the thing it meant to.
15
16
        * storage/domstorage/localstorage/delete-defineproperty-removal-expected.txt:
17
        * storage/domstorage/localstorage/delete-defineproperty-removal.html:
18
        Convert to testharness.js and show that the results are now correct.
19
1
2017-06-03  Chris Dumez  <cdumez@apple.com>
20
2017-06-03  Chris Dumez  <cdumez@apple.com>
2
21
3
        Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
22
        Implement DOMMatrix's fromFloat32Array / fromFloat64Array & toFloat32Array / toFloat64Array
- LayoutTests/js/dom/legacy-platform-object-defineOwnProperty-expected.txt +16 lines
Line 0 LayoutTests/js/dom/legacy-platform-object-defineOwnProperty-expected.txt_sec1
1
2
PASS Test that the setting a non-existing named property with Object.defineProperty creates the property ([OverrideBuiltins] specified). 
3
PASS Test that the setting a non-existing indexed property with Object.defineProperty creates the property ([OverrideBuiltins] specified). 
4
PASS Test that the setting an existing named property with Object.defineProperty replaces the value ([OverrideBuiltins] specified). 
5
PASS Test that the setting an existing indexed property with Object.defineProperty replaces the value ([OverrideBuiltins] specified). 
6
PASS Test that the setting a non-existing but invalid named property with Object.defineProperty throws ([OverrideBuiltins] specified). 
7
PASS Test that the setting a non-data descriptor property with Object.defineProperty does not set anything ([OverrideBuiltins] specified). 
8
PASS Test that the setting a named property with Object.defineProperty that shadows an existing prototype value still creates the item ([OverrideBuiltins] specified). 
9
PASS Test that the setting a non-existing named property with Object.defineProperty creates the property ([OverrideBuiltins] not specified). 
10
PASS Test that the setting a non-existing indexed property with Object.defineProperty creates the property ([OverrideBuiltins] not specified). 
11
PASS Test that the setting an existing named property with Object.defineProperty replaces the value ([OverrideBuiltins] not specified). 
12
PASS Test that the setting an existing indexed property with Object.defineProperty replaces the value ([OverrideBuiltins] not specified). 
13
PASS Test that the setting a non-data descriptor property with Object.defineProperty does not set anything ([OverrideBuiltins] not specified). 
14
PASS Test that the setting a named property with Object.defineProperty that shadows an existing prototype value still creates the item ([OverrideBuiltins] not specified). 
15
PASS Test that the trying to set a named property, matching a builtin property name, with Object.defineProperty does nothing ([OverrideBuiltins] not specified). 
16
- LayoutTests/js/dom/legacy-platform-object-defineOwnProperty.html +209 lines
Line 0 LayoutTests/js/dom/legacy-platform-object-defineOwnProperty.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <script src="../../resources/testharness.js"></script>
5
    <script src="../../resources/testharnessreport.js"></script>
6
</head>
7
<body>
8
<script>
9
    // To test a named property setter with [OverrideBuiltins] specified, we use DOMStringMap via element.dataset.
10
    test(() => {
11
        let element = document.createElement("div");
12
        element.dataset["a"] = "value1";
13
        element.dataset["b"] = "value2";
14
        
15
        Object.defineProperty(element.dataset, "c", { value: "value3" });
16
        assert_equals(element.dataset["c"], "value3");
17
        assert_equals(element.getAttribute("data-c"), "value3")
18
    }, "Test that the setting a non-existing named property with Object.defineProperty creates the property ([OverrideBuiltins] specified).");
19
20
    test(() => {
21
        let element = document.createElement("div");
22
        element.dataset[1] = "value1";
23
        element.dataset[2] = "value2";
24
        
25
        Object.defineProperty(element.dataset, 3, { value: "value3" });
26
        assert_equals(element.dataset[3], "value3");
27
        assert_equals(element.getAttribute("data-3"), "value3")
28
    }, "Test that the setting a non-existing indexed property with Object.defineProperty creates the property ([OverrideBuiltins] specified).");
29
30
    test(() => {
31
        let element = document.createElement("div");
32
        element.dataset["a"] = "value1";
33
        element.dataset["b"] = "value2";
34
        
35
        Object.defineProperty(element.dataset, "a", { value: "value3" });
36
        assert_equals(element.dataset["a"], "value3");
37
        assert_equals(element.getAttribute("data-a"), "value3")
38
    }, "Test that the setting an existing named property with Object.defineProperty replaces the value ([OverrideBuiltins] specified).");
39
40
    test(() => {
41
        let element = document.createElement("div");
42
        element.dataset[1] = "value1";
43
        element.dataset[2] = "value2";
44
        
45
        Object.defineProperty(element.dataset, 1, { value: "value3" });
46
        assert_equals(element.dataset[1], "value3");
47
        assert_equals(element.getAttribute("data-1"), "value3")
48
    }, "Test that the setting an existing indexed property with Object.defineProperty replaces the value ([OverrideBuiltins] specified).");
49
50
    test(() => {
51
        let element = document.createElement("div");
52
        element.dataset["a"] = "value1";
53
        element.dataset["b"] = "value2";
54
        
55
        assert_throws("SyntaxError", () => {
56
            Object.defineProperty(element.dataset, "-invalid", { value: "value3" });            
57
        });
58
        assert_not_equals(element.dataset["-invalid"], 'value3');
59
        assert_not_equals(element.getAttribute("data--invalid"), "value3")
60
    }, "Test that the setting a non-existing but invalid named property with Object.defineProperty throws ([OverrideBuiltins] specified).");
61
62
    test(() => {
63
        let element = document.createElement("div");
64
        element.dataset["a"] = "value1";
65
        element.dataset["b"] = "value2";
66
        
67
        assert_equals(element.dataset["c"], undefined);
68
        Object.defineProperty(element.dataset, "c", { 
69
            get: function() { return 1; },
70
            set: function(newValue) { }
71
        });
72
        assert_equals(element.dataset["c"], undefined);
73
    }, "Test that the setting a non-data descriptor property with Object.defineProperty does not set anything ([OverrideBuiltins] specified).");
74
75
    test((t) => {
76
        t.add_cleanup(() => {
77
          delete DOMStringMap.prototype["c"];
78
        });
79
    
80
        let element = document.createElement("div");
81
    
82
        DOMStringMap.prototype["c"] = 'prototype-value';
83
        Object.defineProperty(element.dataset, "c", { value: "map-value" });
84
        
85
        assert_equals(element.dataset["c"], "map-value");
86
        assert_equals(element.getAttribute("data-c"), "map-value")
87
        assert_equals(DOMStringMap.prototype["c"], "prototype-value")
88
    }, "Test that the setting a named property with Object.defineProperty that shadows an existing prototype value still creates the item ([OverrideBuiltins] specified).");
89
90
91
    // To test a named property setter without [OverrideBuiltins] specified, we use Storage via window.sessionStorage.
92
    test((t) => {
93
        t.add_cleanup(() => {
94
          window.sessionStorage.clear();
95
        });
96
        
97
        window.sessionStorage.clear();
98
        assert_equals(window.sessionStorage.length, 0);
99
    
100
        window.sessionStorage["a"] = "value1";
101
        window.sessionStorage["b"] = "value2";
102
        
103
        Object.defineProperty(window.sessionStorage, "c", { value: "value3" });
104
        assert_equals(window.sessionStorage["c"], "value3");
105
        assert_equals(window.sessionStorage.getItem("c"), "value3")
106
    }, "Test that the setting a non-existing named property with Object.defineProperty creates the property ([OverrideBuiltins] not specified).");
107
108
    test((t) => {
109
        t.add_cleanup(() => {
110
          window.sessionStorage.clear();
111
        });
112
        
113
        window.sessionStorage.clear();
114
        assert_equals(window.sessionStorage.length, 0);
115
    
116
        window.sessionStorage["a"] = "value1";
117
        window.sessionStorage["b"] = "value2";
118
            
119
        Object.defineProperty(window.sessionStorage, 3, { value: "value3" });
120
        assert_equals(window.sessionStorage[3], "value3");
121
        assert_equals(window.sessionStorage.getItem("3"), "value3")
122
    }, "Test that the setting a non-existing indexed property with Object.defineProperty creates the property ([OverrideBuiltins] not specified).");
123
124
    test((t) => {
125
        t.add_cleanup(() => {
126
          window.sessionStorage.clear();
127
        });
128
        
129
        window.sessionStorage.clear();
130
        assert_equals(window.sessionStorage.length, 0);
131
    
132
        window.sessionStorage["a"] = "value1";
133
        window.sessionStorage["b"] = "value2";
134
        
135
        Object.defineProperty(window.sessionStorage, "a", { value: "value3" });
136
        assert_equals(window.sessionStorage["a"], "value3");
137
        assert_equals(window.sessionStorage.getItem("a"), "value3")
138
    }, "Test that the setting an existing named property with Object.defineProperty replaces the value ([OverrideBuiltins] not specified).");
139
140
    test((t) => {
141
        t.add_cleanup(() => {
142
          window.sessionStorage.clear();
143
        });
144
        
145
        window.sessionStorage.clear();
146
        assert_equals(window.sessionStorage.length, 0);
147
    
148
        window.sessionStorage["a"] = "value1";
149
        window.sessionStorage["b"] = "value2";
150
            
151
        Object.defineProperty(window.sessionStorage, 1, { value: "value3" });
152
        assert_equals(window.sessionStorage[1], "value3");
153
        assert_equals(window.sessionStorage.getItem("1"), "value3")
154
    }, "Test that the setting an existing indexed property with Object.defineProperty replaces the value ([OverrideBuiltins] not specified).");
155
156
    test((t) => {
157
        t.add_cleanup(() => {
158
          window.sessionStorage.clear();
159
        });
160
        
161
        window.sessionStorage.clear();
162
        assert_equals(window.sessionStorage.length, 0);
163
    
164
        window.sessionStorage["a"] = "value1";
165
        window.sessionStorage["b"] = "value2";
166
        
167
        assert_equals(window.sessionStorage["c"], undefined);
168
        Object.defineProperty(window.sessionStorage, "c", { 
169
            get: function() { return 1; },
170
            set: function(newValue) { }
171
        });
172
        assert_equals(window.sessionStorage["c"], undefined);
173
    }, "Test that the setting a non-data descriptor property with Object.defineProperty does not set anything ([OverrideBuiltins] not specified).");
174
175
    test((t) => {
176
        t.add_cleanup(() => {
177
            window.sessionStorage.clear();
178
            delete Storage.prototype["c"];
179
        });
180
        
181
        Storage.prototype["c"] = 'prototype-value';
182
        Object.defineProperty(window.sessionStorage, "c", { value: "map-value" });
183
        
184
        assert_equals(window.sessionStorage["c"], "prototype-value");
185
        assert_equals(window.sessionStorage.getItem("c"), "map-value")
186
        assert_equals(Storage.prototype["c"], "prototype-value")
187
    }, "Test that the setting a named property with Object.defineProperty that shadows an existing prototype value still creates the item ([OverrideBuiltins] not specified).");
188
189
190
    test((t) => {
191
        t.add_cleanup(() => {
192
          window.sessionStorage.clear();
193
        });
194
        
195
        window.sessionStorage.clear();
196
        assert_equals(window.sessionStorage.length, 0);
197
    
198
        window.sessionStorage["a"] = "value1";
199
        window.sessionStorage["b"] = "value2";
200
201
        let currentLength = window.sessionStorage.length;
202
        
203
        Object.defineProperty(window.sessionStorage, "length", { value: "value3" });
204
        assert_equals(window.sessionStorage['length'], currentLength + 1);
205
        assert_equals(window.sessionStorage.getItem("length"), "value3")
206
    }, "Test that the trying to set a named property, matching a builtin property name, with Object.defineProperty does nothing ([OverrideBuiltins] not specified).");
207
</script>
208
</body>
209
</html>
- LayoutTests/js/dom/named-property-deleter.html -1 / +1 lines
Lines 36-42 LayoutTests/js/dom/named-property-deleter.html_sec1
36
        let element = document.createElement("div");
36
        let element = document.createElement("div");
37
37
38
        DOMStringMap.prototype["customProperty"] = 'prototype-value';
38
        DOMStringMap.prototype["customProperty"] = 'prototype-value';
39
        assert_true(delete element["customProperty"], "");
39
        assert_true(delete element.dataset["customProperty"], "");
40
        assert_equals(DOMStringMap.prototype["customProperty"], 'prototype-value');
40
        assert_equals(DOMStringMap.prototype["customProperty"], 'prototype-value');
41
    }, "Test that deleting a property that does not exist in the map, but does on the prototype, will return true and not remove the property from the prototype ([OverrideBuiltins] specified).");
41
    }, "Test that deleting a property that does not exist in the map, but does on the prototype, will return true and not remove the property from the prototype ([OverrideBuiltins] specified).");
42
42
- LayoutTests/storage/domstorage/localstorage/delete-defineproperty-removal-expected.txt -30 / +4 lines
Lines 1-32 LayoutTests/storage/domstorage/localstorage/delete-defineproperty-removal-expected.txt_sec1
1
localStorage.clear()
2
Object.getOwnPropertyNames(localStorage) is ()
3
4
Object.defineProperty(localStorage, '1', {value: 'present'})
5
Object.getOwnPropertyNames(localStorage) is (1)
6
localStorage.getItem('1') is null
7
8
delete localStorage[1]
9
Object.getOwnPropertyNames(localStorage) is (1)
10
11
Object.defineProperty(localStorage, '2', {value: 'present',  configurable: true})
12
Object.getOwnPropertyNames(localStorage) is (1,2)
13
localStorage.getItem('2') is null
14
15
delete localStorage[2]
16
Object.getOwnPropertyNames(localStorage) is (1)
17
18
Object.defineProperty(localStorage, 'Test', {value: 'present',  configurable: true})
19
Object.getOwnPropertyNames(localStorage) is (1,Test)
20
localStorage.getItem('Test') is null
21
22
delete localStorage['Test']
23
Object.getOwnPropertyNames(localStorage) is (1)
24
25
Object.defineProperty(localStorage, 'Test1', {value: 'present'})
26
Object.getOwnPropertyNames(localStorage) is (1,Test1)
27
localStorage.getItem('Test1') is null
28
29
delete localStorage['Test1']
30
Object.getOwnPropertyNames(localStorage) is (1,Test1)
31
1
2
PASS Object.getOwnPropertyNames(localStorage) on an empty local storage should return an empty array. 
3
PASS Object.defineProperty can be used to add items to localStorage. 
4
PASS Operator delete can be used to remove items from localStorage. 
5
PASS The configurable modifier does effect the result when used in adding properties to localStorage with Object.defineProperty. 
32
6
- LayoutTests/storage/domstorage/localstorage/delete-defineproperty-removal.html -55 / +29 lines
Lines 1-60 LayoutTests/storage/domstorage/localstorage/delete-defineproperty-removal.html_sec1
1
<pre id='console'></pre>
1
<head>
2
    <script src="../../../resources/testharness.js"></script>
3
    <script src="../../../resources/testharnessreport.js"></script>
4
</head>
5
<body>
2
<script>
6
<script>
3
function runTest() {
7
    localStorage.clear();
4
    function log(msg)
5
    {
6
        document.getElementById('console').append(msg + '\n');
7
    }
8
8
9
    function logAndEval(str)
9
    test(() => {
10
    {
10
        assert_array_equals(Object.getOwnPropertyNames(localStorage), []);
11
        log(str);
11
    }, "Object.getOwnPropertyNames(localStorage) on an empty local storage should return an empty array.");
12
        eval(str);
12
13
    }
13
    test(() => {
14
        Object.defineProperty(localStorage, '1', {value: 'present'});
15
        assert_equals(localStorage.getItem('1'), 'present');
16
        assert_array_equals(Object.getOwnPropertyNames(localStorage), ['1']);
17
    }, "Object.defineProperty can be used to add items to localStorage.");
18
19
    test(() => {
20
        assert_equals(delete localStorage[1], true);
21
        assert_array_equals(Object.getOwnPropertyNames(localStorage), []);
22
    }, "Operator delete can be used to remove items from localStorage.");
23
24
    test(() => {
25
        Object.defineProperty(localStorage, '2', {value: 'present', configurable: false});
26
        assert_equals(localStorage.getItem('2'), 'present');
27
        assert_array_equals(Object.getOwnPropertyNames(localStorage), ['2']);
28
        
29
        assert_equals(delete localStorage[2], true);
30
        assert_array_equals(Object.getOwnPropertyNames(localStorage), []);
31
    }, "The configurable modifier does effect the result when used in adding properties to localStorage with Object.defineProperty.");
14
32
15
    if (window.testRunner)
16
       testRunner.dumpAsText();
17
18
    if (!window.localStorage) {
19
        log("window.localStorage DOES NOT exist");
20
        return;
21
    }
22
23
    logAndEval("localStorage.clear()");
24
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")\n");
25
    
26
    logAndEval("Object.defineProperty(localStorage, '1', {value: 'present'})");
27
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")");
28
    // FIXME: This is incorrect. It should return 'present'. See https://webkit.org/b/172687.
29
    log("localStorage.getItem('1') is " + localStorage.getItem('1') + "\n");
30
    
31
    logAndEval("delete localStorage[1]");
32
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")\n");
33
    
34
    logAndEval("Object.defineProperty(localStorage, '2', {value: 'present',  configurable: true})");
35
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")");
36
    // FIXME: This is incorrect. It should return 'present'. See https://webkit.org/b/172687.
37
    log("localStorage.getItem('2') is " + localStorage.getItem('2') + "\n");
38
    
39
    logAndEval("delete localStorage[2]");
40
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")\n");
41
42
    logAndEval("Object.defineProperty(localStorage, 'Test', {value: 'present',  configurable: true})");
43
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")");
44
    // FIXME: This is incorrect. It should return 'present'. See https://webkit.org/b/172687.
45
    log("localStorage.getItem('Test') is " + localStorage.getItem('Test') + "\n");
46
  
47
    logAndEval("delete localStorage['Test']");
48
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")\n");
49
50
    logAndEval("Object.defineProperty(localStorage, 'Test1', {value: 'present'})");
51
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")");
52
    // FIXME: This is incorrect. It should return 'present'. See https://webkit.org/b/172687.
53
    log("localStorage.getItem('Test1') is " + localStorage.getItem('Test1') + "\n");
54
  
55
    logAndEval("delete localStorage['Test1']");
56
    log("Object.getOwnPropertyNames(localStorage) is (" + Object.getOwnPropertyNames(localStorage) + ")\n");
57
}
58
</script>
33
</script>
59
<body onload="runTest();">
60
</body>
34
</body>

Return to Bug 172687