Changeset 219302 in webkit
- Timestamp:
- Jul 10, 2017 11:27:26 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 3 deleted
- 20 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r219301 r219302 1190 1190 bindings/js/JSEventTargetCustom.cpp 1191 1191 bindings/js/JSExceptionBase.cpp 1192 bindings/js/JSHTMLAppletElementCustom.cpp1193 1192 bindings/js/JSHTMLCanvasElementCustom.cpp 1194 1193 bindings/js/JSHTMLCollectionCustom.cpp 1195 1194 bindings/js/JSHTMLDocumentCustom.cpp 1196 1195 bindings/js/JSHTMLElementCustom.cpp 1197 bindings/js/JSHTMLEmbedElementCustom.cpp1198 bindings/js/JSHTMLObjectElementCustom.cpp1199 1196 bindings/js/JSHTMLTemplateElementCustom.cpp 1200 1197 bindings/js/JSHistoryCustom.cpp -
trunk/Source/WebCore/ChangeLog
r219301 r219302 1 2017-07-10 Sam Weinig <sam@webkit.org> 2 3 [WebIDL] Move plugin object customization into the generator 4 https://bugs.webkit.org/show_bug.cgi?id=174238 5 6 Reviewed by Chris Dumez. 7 8 - Added [Plugin] extended attribute to forward the necessary hooks 9 for get/set/delete to the plugin code. 10 - Removed [CustomNamedSetter] and replaced it's remaining uses 11 [CustomPut] (formally called [CustomPutFunction]). 12 - Renamed [CustomNamedGetterOnPrototype] to [CustomPutOnPrototype] 13 because that is actually what it does. 14 - Removed [CustomGetOwnPropertySlotByIndex] and made 15 [CustomGetOwnPropertySlot] imply it, as the other custom hooks 16 do. 17 - Renamed [CustomEnumerateProperty] to [CustomGetOwnPropertyNames] 18 to conform with other attribute names. 19 - Renamed [CustomCall] to [CustomGetCallData] to conform with other 20 attribute names. 21 22 * CMakeLists.txt: 23 * WebCore.xcodeproj/project.pbxproj: 24 * bindings/js/JSBindingsAllInOne.cpp: 25 * bindings/js/JSHTMLAppletElementCustom.cpp: Removed. 26 * bindings/js/JSHTMLEmbedElementCustom.cpp: Removed. 27 * bindings/js/JSHTMLObjectElementCustom.cpp: Removed. 28 Remove custom bindings. 29 30 * bindings/js/JSCSSStyleDeclarationCustom.cpp: 31 (WebCore::putCommon): 32 (WebCore::JSCSSStyleDeclaration::put): 33 (WebCore::JSCSSStyleDeclaration::putByIndex): 34 (WebCore::JSCSSStyleDeclaration::putDelegate): Deleted. 35 Use [CustomPut] rather than [CustomNamedSetter] to allow us 36 to get rid of [CustomNamedSetter]. Reuse put delegate as 37 common code to share between put and putByIndex. 38 39 * bindings/js/JSLocationCustom.cpp: 40 (WebCore::getOwnPropertySlotCommon): 41 (WebCore::JSLocation::getOwnPropertySlot): 42 (WebCore::JSLocation::getOwnPropertySlotByIndex): 43 Replace [CustomGetOwnPropertySlotAndDescriptor] with [CustomGetOwnPropertySlot] 44 which is more clear and reduces the number of variants of this hook override 45 we need. 46 47 (WebCore::putCommon): 48 (WebCore::JSLocation::put): 49 (WebCore::JSLocation::putByIndex): 50 Use [CustomPut] rather than [CustomNamedSetter] to allow us 51 to get rid of [CustomNamedSetter]. Reuse put delegate as 52 common code to share between put and putByIndex. 53 54 (WebCore::JSLocationPrototype::put): 55 [CustomPutOnPrototype] (which weirdly used incorrectly be called 56 [CustomNamedGetterOnPrototype]) now works like [CustomPut] meaning 57 you need to call Base. 58 59 * bindings/js/JSPluginElementFunctions.cpp: 60 (WebCore::pluginElementPropertyGetter): 61 (WebCore::pluginElementCustomGetOwnPropertySlot): 62 (WebCore::pluginElementCustomPut): 63 * bindings/js/JSPluginElementFunctions.h: 64 (WebCore::pluginElementCustomGetOwnPropertySlot): Deleted. 65 Remove templatized pluginElementCustomGetOwnPropertySlot, which was 66 completely unnecessary and merge its functionality into the out of 67 line overload. Remove pluginElementPropertyGetter from the header, 68 since it is only used in implementation, and unify the naming and 69 argument position (JSHTMLElement* comes first) of the hooks. 70 71 * bindings/scripts/CodeGeneratorJS.pm: 72 (GenerateIndexedGetter): 73 (GenerateNamedGetter): 74 (GenerateGetOwnPropertySlot): 75 (GenerateGetOwnPropertySlotByIndex): 76 (GenerateGetOwnPropertyNames): 77 (GeneratePut): 78 (GeneratePutByIndex): 79 (GenerateDeleteProperty): 80 (GenerateDeletePropertyByIndex): 81 (GenerateNamedDeleterDefinition): 82 (InstanceOverridesGetOwnPropertySlot): 83 (InstanceOverridesGetOwnPropertyNames): 84 (InstanceOverridesPut): 85 (InstanceOverridesDeleteProperty): 86 (GenerateHeader): 87 (GenerateImplementation): 88 (GenerateGetCallData): 89 (GeneratePluginCall): 90 (GenerateLegacyCallerDefinitions): 91 (GenerateLegacyCallerDefinition): 92 (GeneratePrototypeDeclaration): 93 (InstanceOverridesGetCallData): 94 (HeaderNeedsPrototypeDeclaration): 95 - Add support for [Plugin] 96 - Remove support for [CustomNamedSetter] 97 - Replace [CustomGetOwnPropertySlotByIndex] with [CustomGetOwnPropertySlot] 98 - Replace [CustomEnumerateProperty] with [CustomGetOwnPropertyNames] 99 - Replace [CustomPutFunction] with [CustomPut]. 100 - Make subroutine names more consistent (remove a few Definition suffixes) 101 102 * bindings/scripts/IDLAttributes.json: 103 Update for new / removed attributes. 104 105 * bindings/scripts/test/JS/JSTestInterface.cpp: 106 * bindings/scripts/test/JS/JSTestInterface.h: 107 * bindings/scripts/test/JS/JSTestPluginInterface.cpp: Added. 108 * bindings/scripts/test/JS/JSTestPluginInterface.h: Added. 109 * bindings/scripts/test/TestInterface.idl: 110 * bindings/scripts/test/TestPluginInterface.idl: Added. 111 Update / add tests. 112 113 * css/CSSStyleDeclaration.idl: 114 * html/HTMLAppletElement.idl: 115 * html/HTMLEmbedElement.idl: 116 * html/HTMLObjectElement.idl: 117 * page/DOMWindow.idl: 118 * page/Location.idl: 119 * storage/Storage.idl: 120 Update for new / renamed attributes. 121 1 122 2017-07-03 Brian Burg <bburg@apple.com> 2 123 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r219301 r219302 5602 5602 BC305C790C076BB300CD20F0 /* JSHTMLObjectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC305C770C076BB300CD20F0 /* JSHTMLObjectElement.cpp */; }; 5603 5603 BC305C7A0C076BB300CD20F0 /* JSHTMLObjectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC305C780C076BB300CD20F0 /* JSHTMLObjectElement.h */; }; 5604 BC305CA40C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */; };5605 5604 BC33FB1B0F30EE85002CDD7C /* RenderLineBoxList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC33FB1A0F30EE85002CDD7C /* RenderLineBoxList.cpp */; }; 5606 5605 BC348BBE0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */; }; … … 5641 5640 BC491B780C023EFD009D6316 /* JSHTMLMarqueeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC491B760C023EFD009D6316 /* JSHTMLMarqueeElement.cpp */; }; 5642 5641 BC491B790C023EFD009D6316 /* JSHTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC491B770C023EFD009D6316 /* JSHTMLMarqueeElement.h */; }; 5643 BC4EDEF40C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */; };5644 5642 BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */; }; 5645 5643 BC51580B0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */; }; … … 5721 5719 BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6932710D7E293900AE44D1 /* JSDOMWindowBase.cpp */; }; 5722 5720 BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6932720D7E293900AE44D1 /* JSDOMWindowBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5723 BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */; };5724 5721 BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */; }; 5725 5722 BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */; }; … … 14071 14068 BC305C770C076BB300CD20F0 /* JSHTMLObjectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLObjectElement.cpp; sourceTree = "<group>"; }; 14072 14069 BC305C780C076BB300CD20F0 /* JSHTMLObjectElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLObjectElement.h; sourceTree = "<group>"; }; 14073 BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLObjectElementCustom.cpp; sourceTree = "<group>"; };14074 14070 BC33FB1A0F30EE85002CDD7C /* RenderLineBoxList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLineBoxList.cpp; sourceTree = "<group>"; }; 14075 14071 BC348BA70DB7F1B8004ABAB9 /* XMLHttpRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLHttpRequest.idl; sourceTree = "<group>"; }; … … 14110 14106 BC491B760C023EFD009D6316 /* JSHTMLMarqueeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMarqueeElement.cpp; sourceTree = "<group>"; }; 14111 14107 BC491B770C023EFD009D6316 /* JSHTMLMarqueeElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLMarqueeElement.h; sourceTree = "<group>"; }; 14112 BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAppletElementCustom.cpp; sourceTree = "<group>"; };14113 14108 BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollAnimatorMac.mm; sourceTree = "<group>"; }; 14114 14109 BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDocumentCustom.cpp; sourceTree = "<group>"; }; … … 14196 14191 BC6932710D7E293900AE44D1 /* JSDOMWindowBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowBase.cpp; sourceTree = "<group>"; }; 14197 14192 BC6932720D7E293900AE44D1 /* JSDOMWindowBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowBase.h; sourceTree = "<group>"; }; 14198 BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElementCustom.cpp; sourceTree = "<group>"; };14199 14193 BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElement.cpp; sourceTree = "<group>"; }; 14200 14194 BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLEmbedElement.h; sourceTree = "<group>"; }; … … 23620 23614 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, 23621 23615 BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, 23622 BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,23623 23616 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */, 23624 23617 BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */, 23625 BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */,23626 BC305CA30C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp */,23627 23618 D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */, 23628 23619 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */, … … 31974 31965 1A4A2DEF0A1B852A00C807F8 /* JSHTMLAnchorElement.cpp in Sources */, 31975 31966 1A4A2DF10A1B852A00C807F8 /* JSHTMLAppletElement.cpp in Sources */, 31976 BC4EDEF40C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp in Sources */,31977 31967 1AE2AA1E0A1CDAB400B42B25 /* JSHTMLAreaElement.cpp in Sources */, 31978 31968 7C9DBFED1A9C49B1000D6B25 /* JSHTMLAttachmentElement.cpp in Sources */, … … 31998 31988 938E65F709F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp in Sources */, 31999 31989 BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */, 32000 BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */,32001 31990 1AE2AA260A1CDAB400B42B25 /* JSHTMLFieldSetElement.cpp in Sources */, 32002 31991 1AE2AA280A1CDAB400B42B25 /* JSHTMLFontElement.cpp in Sources */, … … 32025 32014 1AE2AB290A1CE63B00B42B25 /* JSHTMLModElement.cpp in Sources */, 32026 32015 BC305C790C076BB300CD20F0 /* JSHTMLObjectElement.cpp in Sources */, 32027 BC305CA40C0781BB00CD20F0 /* JSHTMLObjectElementCustom.cpp in Sources */,32028 32016 1A85B1EA0A1B240500D8C87C /* JSHTMLOListElement.cpp in Sources */, 32029 32017 A80E7E9C0A1A83E3007FB8C5 /* JSHTMLOptGroupElement.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r218960 r219302 65 65 #include "JSEventTargetCustom.cpp" 66 66 #include "JSExceptionBase.cpp" 67 #include "JSHTMLAppletElementCustom.cpp"68 67 #include "JSHTMLCanvasElementCustom.cpp" 69 68 #include "JSHTMLCollectionCustom.cpp" 70 69 #include "JSHTMLDocumentCustom.cpp" 71 70 #include "JSHTMLElementCustom.cpp" 72 #include "JSHTMLEmbedElementCustom.cpp"73 #include "JSHTMLObjectElementCustom.cpp"74 71 #include "JSHTMLTemplateElementCustom.cpp" 75 72 #include "JSHistoryCustom.cpp" -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r218342 r219302 314 314 } 315 315 316 // FIXME: This should be converted to be a named getter. 316 317 bool JSCSSStyleDeclaration::getOwnPropertySlotDelegate(ExecState* state, PropertyName propertyName, PropertySlot& slot) 317 318 { … … 323 324 } 324 325 325 bool JSCSSStyleDeclaration::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult) 326 // FIXME: This should be converted to be a named setter. 327 static bool putCommon(JSCSSStyleDeclaration& thisObject, ExecState& state, PropertyName propertyName, JSValue value, bool& putResult) 326 328 { 327 329 CustomElementReactionStack customElementReactionStack; … … 330 332 return false; 331 333 332 auto propertyValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>( *state, value);334 auto propertyValue = convert<IDLTreatNullAsEmptyAdaptor<IDLDOMString>>(state, value); 333 335 if (propertyInfo.hadPixelOrPosPrefix) 334 336 propertyValue.append("px"); … … 343 345 } 344 346 345 auto setPropertyInternalResult = wrapped().setPropertyInternal(propertyInfo.propertyID, propertyValue, important);347 auto setPropertyInternalResult = thisObject.wrapped().setPropertyInternal(propertyInfo.propertyID, propertyValue, important); 346 348 if (setPropertyInternalResult.hasException()) { 347 auto& vm = state ->vm();349 auto& vm = state.vm(); 348 350 auto scope = DECLARE_THROW_SCOPE(vm); 349 propagateException( *state, scope, setPropertyInternalResult.releaseException());351 propagateException(state, scope, setPropertyInternalResult.releaseException()); 350 352 return true; 351 353 } 352 354 putResult = setPropertyInternalResult.releaseReturnValue(); 353 355 return true; 356 } 357 358 bool JSCSSStyleDeclaration::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot) 359 { 360 auto* thisObject = jsCast<JSCSSStyleDeclaration*>(cell); 361 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 362 363 bool putResult = false; 364 if (putCommon(*thisObject, *state, propertyName, value, putResult)) 365 return putResult; 366 367 return JSObject::put(thisObject, state, propertyName, value, putPropertySlot); 368 } 369 370 bool JSCSSStyleDeclaration::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow) 371 { 372 auto* thisObject = jsCast<JSCSSStyleDeclaration*>(cell); 373 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 374 375 bool putResult = false; 376 if (putCommon(*thisObject, *state, Identifier::from(state, index), value, putResult)) 377 return putResult; 378 379 return JSObject::putByIndex(cell, state, index, value, shouldThrow); 354 380 } 355 381 -
trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp
r214135 r219302 35 35 namespace WebCore { 36 36 37 bool JSLocation::getOwnPropertySlotDelegate(ExecState*state, PropertyName propertyName, PropertySlot& slot)38 { 39 VM& vm = state ->vm();37 static bool getOwnPropertySlotCommon(JSLocation& thisObject, ExecState& state, PropertyName propertyName, PropertySlot& slot) 38 { 39 VM& vm = state.vm(); 40 40 auto scope = DECLARE_THROW_SCOPE(vm); 41 41 42 Frame* frame = wrapped().frame();42 Frame* frame = thisObject.wrapped().frame(); 43 43 if (!frame) { 44 44 slot.setUndefined(); … … 52 52 // allowed, return false so the normal lookup will take place. 53 53 String message; 54 if (BindingSecurity::shouldAllowAccessToFrame( *state, *frame, message))54 if (BindingSecurity::shouldAllowAccessToFrame(state, *frame, message)) 55 55 return false; 56 56 57 57 // https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-) 58 if (propertyName == state ->propertyNames().toStringTagSymbol || propertyName == state->propertyNames().hasInstanceSymbol || propertyName == state->propertyNames().isConcatSpreadableSymbol) {59 slot.setValue( this, ReadOnly | DontEnum, jsUndefined());58 if (propertyName == state.propertyNames().toStringTagSymbol || propertyName == state.propertyNames().hasInstanceSymbol || propertyName == state.propertyNames().isConcatSpreadableSymbol) { 59 slot.setValue(&thisObject, ReadOnly | DontEnum, jsUndefined()); 60 60 return true; 61 61 } 62 62 63 63 // We only allow access to Location.replace() cross origin. 64 if (propertyName == state ->propertyNames().replace) {65 slot.setCustom( this, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>);64 if (propertyName == state.propertyNames().replace) { 65 slot.setCustom(&thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>); 66 66 return true; 67 67 } … … 69 69 // Getting location.href cross origin needs to throw. However, getOwnPropertyDescriptor() needs to return 70 70 // a descriptor that has a setter but no getter. 71 if (slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty && propertyName == state ->propertyNames().href) {71 if (slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty && propertyName == state.propertyNames().href) { 72 72 auto* entry = JSLocation::info()->staticPropHashTable->entry(propertyName); 73 73 CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, nullptr, entry->propertyPutter()); 74 slot.setCustomGetterSetter( this, DontEnum | CustomAccessor, customGetterSetter);75 return true; 76 } 77 78 throwSecurityError( *state, scope, message);74 slot.setCustomGetterSetter(&thisObject, DontEnum | CustomAccessor, customGetterSetter); 75 return true; 76 } 77 78 throwSecurityError(state, scope, message); 79 79 slot.setUndefined(); 80 80 return true; 81 81 } 82 82 83 bool JSLocation::putDelegate(ExecState* state, PropertyName propertyName, JSValue, PutPropertySlot&, bool& putResult) 84 { 85 putResult = false; 86 87 Frame* frame = wrapped().frame(); 83 bool JSLocation::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot) 84 { 85 auto* thisObject = jsCast<JSLocation*>(object); 86 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 87 88 if (getOwnPropertySlotCommon(*thisObject, *state, propertyName, slot)) 89 return true; 90 return JSObject::getOwnPropertySlot(object, state, propertyName, slot); 91 } 92 93 bool JSLocation::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot) 94 { 95 auto* thisObject = jsCast<JSLocation*>(object); 96 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 97 98 if (getOwnPropertySlotCommon(*thisObject, *state, Identifier::from(state, index), slot)) 99 return true; 100 return JSObject::getOwnPropertySlotByIndex(object, state, index, slot); 101 } 102 103 static bool putCommon(JSLocation& thisObject, ExecState& state, PropertyName propertyName) 104 { 105 Frame* frame = thisObject.wrapped().frame(); 88 106 if (!frame) 89 107 return true; 90 108 91 109 // Silently block access to toString and valueOf. 92 if (propertyName == state ->propertyNames().toString || propertyName == state->propertyNames().valueOf)110 if (propertyName == state.propertyNames().toString || propertyName == state.propertyNames().valueOf) 93 111 return true; 94 112 … … 96 114 // However, alllowing assigning of pieces might inadvertently disclose parts of the original location. 97 115 // So fall through to the access check for those. 98 if (propertyName == state ->propertyNames().href)116 if (propertyName == state.propertyNames().href) 99 117 return false; 100 118 101 119 // Block access and throw if there is a security error. 102 if (!BindingSecurity::shouldAllowAccessToFrame( state, frame, ThrowSecurityError))120 if (!BindingSecurity::shouldAllowAccessToFrame(&state, frame, ThrowSecurityError)) 103 121 return true; 104 122 105 123 return false; 124 } 125 126 bool JSLocation::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot) 127 { 128 auto* thisObject = jsCast<JSLocation*>(cell); 129 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 130 131 if (putCommon(*thisObject, *state, propertyName)) 132 return false; 133 134 return JSObject::put(thisObject, state, propertyName, value, putPropertySlot); 135 } 136 137 bool JSLocation::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow) 138 { 139 auto* thisObject = jsCast<JSLocation*>(cell); 140 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 141 142 if (putCommon(*thisObject, *state, Identifier::from(state, index))) 143 return false; 144 145 return JSObject::putByIndex(cell, state, index, value, shouldThrow); 106 146 } 107 147 … … 189 229 } 190 230 191 bool JSLocationPrototype::putDelegate(ExecState* exec, PropertyName propertyName, JSValue, PutPropertySlot&, bool& putResult) 192 { 193 putResult = false; 194 return (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf); 231 bool JSLocationPrototype::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot) 232 { 233 auto* thisObject = jsCast<JSLocationPrototype*>(cell); 234 if (propertyName == state->propertyNames().toString || propertyName == state->propertyNames().valueOf) 235 return false; 236 return Base::put(thisObject, state, propertyName, value, slot); 195 237 } 196 238 -
trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp
r211247 r219302 95 95 } 96 96 97 EncodedJSValue pluginElementPropertyGetter(ExecState* exec, EncodedJSValue thisValue, PropertyName propertyName)97 static EncodedJSValue pluginElementPropertyGetter(ExecState* exec, EncodedJSValue thisValue, PropertyName propertyName) 98 98 { 99 99 VM& vm = exec->vm(); … … 110 110 } 111 111 112 bool pluginElementCustomGetOwnPropertySlot( ExecState* exec, PropertyName propertyName, PropertySlot& slot, JSHTMLElement* element)112 bool pluginElementCustomGetOwnPropertySlot(JSHTMLElement* element, ExecState* exec, PropertyName propertyName, PropertySlot& slot) 113 113 { 114 if (!element->globalObject()->world().isNormal()) { 115 JSC::JSValue proto = element->getPrototypeDirect(); 116 if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName)) 117 return false; 118 } 119 114 120 JSObject* scriptObject = pluginScriptObject(exec, element); 115 121 if (!scriptObject) … … 118 124 if (!scriptObject->hasProperty(exec, propertyName)) 119 125 return false; 126 120 127 slot.setCustom(element, DontDelete | DontEnum, pluginElementPropertyGetter); 121 128 return true; 122 129 } 123 130 124 bool pluginElementCustomPut( ExecState* exec, PropertyName propertyName, JSValue value, JSHTMLElement* element, PutPropertySlot& slot, bool& putResult)131 bool pluginElementCustomPut(JSHTMLElement* element, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot, bool& putResult) 125 132 { 126 133 JSObject* scriptObject = pluginScriptObject(exec, element); … … 155 162 } 156 163 157 CallType pluginElement GetCallData(JSHTMLElement* element, CallData& callData)164 CallType pluginElementCustomGetCallData(JSHTMLElement* element, CallData& callData) 158 165 { 159 166 // First, ask the plug-in view base for its runtime object. -
trunk/Source/WebCore/bindings/js/JSPluginElementFunctions.h
r208179 r219302 38 38 WEBCORE_EXPORT JSC::JSObject* pluginScriptObject(JSC::ExecState*, JSHTMLElement*); 39 39 40 JSC::EncodedJSValue pluginElementPropertyGetter(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 41 bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&, JSHTMLElement*); 42 bool pluginElementCustomPut(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSHTMLElement*, JSC::PutPropertySlot&, bool& putResult); 43 JSC::CallType pluginElementGetCallData(JSHTMLElement*, JSC::CallData&); 44 45 template <class Type, class Base> bool pluginElementCustomGetOwnPropertySlot(JSC::ExecState* exec, JSC::PropertyName propertyName, JSC::PropertySlot& slot, Type* element) 46 { 47 if (!element->globalObject()->world().isNormal()) { 48 JSC::JSValue proto = element->getPrototypeDirect(); 49 if (proto.isObject() && JSC::jsCast<JSC::JSObject*>(asObject(proto))->hasProperty(exec, propertyName)) 50 return false; 51 } 52 53 return pluginElementCustomGetOwnPropertySlot(exec, propertyName, slot, element); 54 } 40 bool pluginElementCustomGetOwnPropertySlot(JSHTMLElement*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&); 41 bool pluginElementCustomPut(JSHTMLElement*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult); 42 JSC::CallType pluginElementCustomGetCallData(JSHTMLElement*, JSC::CallData&); 55 43 56 44 } // namespace WebCore -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r219237 r219302 536 536 537 537 my @attributes = (); 538 push(@attributes, "ReadOnly") if !GetIndexedSetterOperation($interface) && !$interface->extendedAttributes->{ CustomNamedSetter};538 push(@attributes, "ReadOnly") if !GetIndexedSetterOperation($interface) && !$interface->extendedAttributes->{Plugin}; 539 539 540 540 my $attributeString = ((@attributes > 0) ? join(" | ", @attributes) : "0"); … … 573 573 574 574 my @attributes = (); 575 push(@attributes, "ReadOnly") if !GetNamedSetterOperation($interface) && !$interface->extendedAttributes->{ CustomNamedSetter};575 push(@attributes, "ReadOnly") if !GetNamedSetterOperation($interface) && !$interface->extendedAttributes->{Plugin}; 576 576 push(@attributes, "DontEnum") if $interface->extendedAttributes->{LegacyUnenumerableNamedProperties}; 577 577 … … 668 668 # NOTE: Setting ignoreNamedProps has the effect of skipping step 2, so we can early return here 669 669 # rather than going through the paces of having an actual ignoreNamedProps update. 670 if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} ) {670 if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} || $interface->extendedAttributes->{Plugin}) { 671 671 push(@$outputArray, " return JSObject::getOwnPropertySlot(object, state, propertyName, slot);\n"); 672 672 } … … 702 702 push(@$outputArray, " }\n"); 703 703 } 704 704 705 # FIXME: There is only one remaining user of this, CSSStyleDeclaration.idl. Let's get them onto named / indexed getters. 705 706 if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) { 706 707 push(@$outputArray, " if (thisObject->getOwnPropertySlotDelegate(state, propertyName, slot))\n"); 707 708 push(@$outputArray, " return true;\n"); 708 709 } 709 710 711 if ($interface->extendedAttributes->{Plugin}) { 712 AddToImplIncludes("JSPluginElementFunctions.h"); 713 push(@$outputArray, " if (pluginElementCustomGetOwnPropertySlot(thisObject, state, propertyName, slot))\n"); 714 push(@$outputArray, " return true;\n"); 715 } 716 710 717 # 3. Return OrdinaryGetOwnProperty(O, P). 711 718 push(@$outputArray, " return JSObject::getOwnPropertySlot(object, state, propertyName, slot);\n"); … … 719 726 my ($outputArray, $interface, $className) = @_; 720 727 721 return if $interface->extendedAttributes->{CustomGetOwnPropertySlot ByIndex};728 return if $interface->extendedAttributes->{CustomGetOwnPropertySlot}; 722 729 723 730 # Sink the int-to-string conversion that happens when we create a PropertyName … … 773 780 # NOTE: Setting ignoreNamedProps has the effect of skipping step 2, so we can early return here 774 781 # rather than going through the paces of having an actual ignoreNamedProps update. 775 if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} ) {782 if ($namedGetterOperation || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} || $interface->extendedAttributes->{Plugin}) { 776 783 push(@$outputArray, " return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);\n"); 777 784 } … … 810 817 } 811 818 819 # FIXME: There is only one remaining user of this, CSSStyleDeclaration.idl. Let's get them onto named / indexed getters. 812 820 if ($interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor}) { 813 821 &$propertyNameGeneration(); … … 816 824 push(@$outputArray, " return true;\n"); 817 825 } 818 826 827 if ($interface->extendedAttributes->{Plugin}) { 828 &$propertyNameGeneration(); 829 830 AddToImplIncludes("JSPluginElementFunctions.h"); 831 push(@$outputArray, " if (pluginElementCustomGetOwnPropertySlot(thisObject, state, propertyName, slot))\n"); 832 push(@$outputArray, " return true;\n"); 833 } 834 819 835 # 3. Return OrdinaryGetOwnProperty(O, P). 820 836 push(@$outputArray, " return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);\n"); … … 828 844 my ($outputArray, $interface, $className) = @_; 829 845 830 return if $interface->extendedAttributes->{Custom EnumerateProperty};846 return if $interface->extendedAttributes->{CustomGetOwnPropertyNames}; 831 847 832 848 my $namedGetterOperation = GetNamedGetterOperation($interface); … … 914 930 my ($outputArray, $interface, $className) = @_; 915 931 916 return if $interface->extendedAttributes->{CustomPut Function};932 return if $interface->extendedAttributes->{CustomPut}; 917 933 918 934 my $namedSetterOperation = GetNamedSetterOperation($interface); … … 962 978 } 963 979 964 assert("Using both a named property setter and [CustomNamedSetter] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{CustomNamedSetter}; 965 if ($interface->extendedAttributes->{CustomNamedSetter}) { 980 assert("Using both a named property setter and [Plugin] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{Plugin}; 981 if ($interface->extendedAttributes->{Plugin}) { 982 AddToImplIncludes("JSPluginElementFunctions.h"); 983 966 984 push(@$outputArray, " bool putResult = false;\n"); 967 push(@$outputArray, " if ( thisObject->putDelegate(state, propertyName, value, putPropertySlot, putResult))\n");985 push(@$outputArray, " if (pluginElementCustomPut(thisObject, state, propertyName, value, putPropertySlot, putResult))\n"); 968 986 push(@$outputArray, " return putResult;\n\n"); 969 987 } 970 988 971 989 push(@$outputArray, " return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);\n"); 972 990 push(@$outputArray, "}\n\n"); … … 977 995 my ($outputArray, $interface, $className) = @_; 978 996 979 return if $interface->extendedAttributes->{CustomPut Function};980 997 return if $interface->extendedAttributes->{CustomPut}; 998 981 999 my $namedSetterOperation = GetNamedSetterOperation($interface); 982 1000 my $indexedSetterOperation = GetIndexedSetterOperation($interface); 983 1001 984 1002 my $overrideBuiltins = $codeGenerator->InheritsExtendedAttribute($interface, "OverrideBuiltins"); 985 my $ellidesCallsToBase = ($namedSetterOperation && $overrideBuiltins) && !$interface->extendedAttributes->{ CustomNamedSetter};1003 my $ellidesCallsToBase = ($namedSetterOperation && $overrideBuiltins) && !$interface->extendedAttributes->{Plugin}; 986 1004 987 1005 push(@$outputArray, "bool ${className}::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool" . (!$ellidesCallsToBase ? " shouldThrow" : "") . ")\n"); … … 1022 1040 } 1023 1041 } 1024 1025 assert("Using both a named property setter and [CustomNamedSetter] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{CustomNamedSetter}; 1026 if ($interface->extendedAttributes->{CustomNamedSetter}) { 1042 1043 assert("Using both a named property setter and [Plugin] together is not supported.") if $namedSetterOperation && $interface->extendedAttributes->{Plugin}; 1044 if ($interface->extendedAttributes->{Plugin}) { 1045 AddToImplIncludes("JSPluginElementFunctions.h"); 1027 1046 push(@$outputArray, " auto propertyName = Identifier::from(state, index);\n"); 1028 push(@$outputArray, " PutPropertySlot slot(thisObject, shouldThrow);\n");1047 push(@$outputArray, " PutPropertySlot putPropertySlot(thisObject, shouldThrow);\n"); 1029 1048 push(@$outputArray, " bool putResult = false;\n"); 1030 push(@$outputArray, " if ( thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");1049 push(@$outputArray, " if (pluginElementCustomPut(thisObject, state, propertyName, value, putPropertySlot, putResult))\n"); 1031 1050 push(@$outputArray, " return putResult;\n\n"); 1032 1051 } 1033 1052 1034 1053 if (!$ellidesCallsToBase) { 1035 1054 push(@$outputArray, " return JSObject::putByIndex(cell, state, index, value, shouldThrow);\n"); … … 1253 1272 } 1254 1273 1255 sub GenerateDeleteProperty Definition1274 sub GenerateDeleteProperty 1256 1275 { 1257 1276 my ($outputArray, $interface, $className, $operation, $conditional) = @_; … … 1284 1303 } 1285 1304 1286 sub GenerateDeletePropertyByIndex Definition1305 sub GenerateDeletePropertyByIndex 1287 1306 { 1288 1307 my ($outputArray, $interface, $className, $operation, $conditional) = @_; … … 1348 1367 } 1349 1368 1350 GenerateDeleteProperty Definition($outputArray, $interface, $className, $namedDeleterOperation, $conditional);1351 GenerateDeletePropertyByIndex Definition($outputArray, $interface, $className, $namedDeleterOperation, $conditional);1369 GenerateDeleteProperty($outputArray, $interface, $className, $namedDeleterOperation, $conditional); 1370 GenerateDeletePropertyByIndex($outputArray, $interface, $className, $namedDeleterOperation, $conditional); 1352 1371 1353 1372 push(@implContent, "#endif\n\n") if $conditional; … … 1809 1828 my $interface = shift; 1810 1829 return $interface->extendedAttributes->{CustomGetOwnPropertySlot} 1811 || $interface->extendedAttributes->{CustomGetOwnPropertySlotByIndex}1812 1830 || $interface->extendedAttributes->{CustomGetOwnPropertySlotAndDescriptor} 1831 || $interface->extendedAttributes->{Plugin} 1813 1832 || GetIndexedGetterOperation($interface) 1814 1833 || GetNamedGetterOperation($interface); … … 1818 1837 { 1819 1838 my $interface = shift; 1820 return $interface->extendedAttributes->{Custom EnumerateProperty}1839 return $interface->extendedAttributes->{CustomGetOwnPropertyNames} 1821 1840 || GetIndexedGetterOperation($interface) 1822 1841 || GetNamedGetterOperation($interface); … … 1826 1845 { 1827 1846 my $interface = shift; 1828 return $interface->extendedAttributes->{Custom NamedSetter}1829 || $interface->extendedAttributes->{ CustomPutFunction}1847 return $interface->extendedAttributes->{CustomPut} 1848 || $interface->extendedAttributes->{Plugin} 1830 1849 || GetIndexedSetterOperation($interface) 1831 1850 || GetNamedSetterOperation($interface); … … 1840 1859 } 1841 1860 1842 sub InstanceOverridesDelete 1861 sub InstanceOverridesDeleteProperty 1843 1862 { 1844 1863 my $interface = shift; … … 2573 2592 } 2574 2593 2575 if (InstanceOverridesDelete ($interface)) {2594 if (InstanceOverridesDeleteProperty($interface)) { 2576 2595 push(@headerContent, " static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName);\n"); 2577 2596 push(@headerContent, " static bool deletePropertyByIndex(JSC::JSCell*, JSC::ExecState*, unsigned);\n"); 2578 2597 } 2579 2598 2580 if (InstanceOverrides Call($interface)) {2599 if (InstanceOverridesGetCallData($interface)) { 2581 2600 push(@headerContent, " static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);\n\n"); 2582 2601 $headerIncludes{"<runtime/CallData.h>"} = 1; … … 2797 2816 push(@headerContent, " bool getOwnPropertySlotDelegate(JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n"); 2798 2817 } 2799 2800 if ($interface->extendedAttributes->{CustomNamedSetter}) { 2801 push(@headerContent, " bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n"); 2802 } 2803 2818 2804 2819 push(@headerContent, "};\n\n"); 2805 2820 … … 4101 4116 } 4102 4117 4103 if ($interface->extendedAttributes->{CustomNamedGetterOnPrototype}) {4104 push(@implContent, "bool ${className}Prototype::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");4105 push(@implContent, "{\n");4106 push(@implContent, " auto* thisObject = jsCast<${className}Prototype*>(cell);\n");4107 push(@implContent, " bool putResult = false;\n");4108 push(@implContent, " if (thisObject->putDelegate(state, propertyName, value, slot, putResult))\n");4109 push(@implContent, " return putResult;\n");4110 push(@implContent, " return Base::put(thisObject, state, propertyName, value, slot);\n");4111 push(@implContent, "}\n\n");4112 }4113 4114 4118 # - Initialize static ClassInfo object 4115 4119 push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleInterfaceName}\", &Base::s_info, "); … … 4298 4302 } 4299 4303 4300 if (InstanceOverridesDelete ($interface)) {4304 if (InstanceOverridesDeleteProperty($interface)) { 4301 4305 GenerateNamedDeleterDefinition(\@implContent, $interface, $className); 4302 4306 } 4303 4307 4304 if (InstanceOverrides Call($interface)) {4305 Generate LegacyCallerDefinitions($interface, $className);4308 if (InstanceOverridesGetCallData($interface)) { 4309 GenerateGetCallData(\@implContent, $interface, $className); 4306 4310 } 4307 4311 … … 5251 5255 } 5252 5256 5257 sub GenerateGetCallData 5258 { 5259 my ($outputArray, $interface, $className) = @_; 5260 5261 return if $interface->extendedAttributes->{CustomGetCallData}; 5262 5263 if ($interface->extendedAttributes->{Plugin}) { 5264 GeneratePluginCall($outputArray, $interface, $className); 5265 } else { 5266 GenerateLegacyCallerDefinitions($outputArray, $interface, $className); 5267 } 5268 } 5269 5270 sub GeneratePluginCall 5271 { 5272 my ($outputArray, $interface, $className) = @_; 5273 5274 AddToImplIncludes("JSPluginElementFunctions.h"); 5275 5276 push(@$outputArray, "CallType ${className}::getCallData(JSCell* cell, CallData& callData)\n"); 5277 push(@$outputArray, "{\n"); 5278 push(@$outputArray, " auto* thisObject = jsCast<${className}*>(cell);\n"); 5279 push(@$outputArray, " ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n"); 5280 5281 push(@$outputArray, " return pluginElementCustomGetCallData(thisObject, callData);\n"); 5282 push(@$outputArray, "}\n"); 5283 push(@$outputArray, "\n"); 5284 } 5285 5253 5286 sub GenerateLegacyCallerDefinitions 5254 5287 { 5255 my ($interface, $className) = @_; 5256 5257 return if $interface->extendedAttributes->{CustomCall}; 5258 5288 my ($outputArray, $interface, $className) = @_; 5289 5259 5290 my @legacyCallers = @{$interface->{LegacyCallers}}; 5260 5291 if (@legacyCallers > 1) { 5261 5292 foreach my $legacyCaller (@legacyCallers) { 5262 GenerateLegacyCallerDefinition($ interface, $className, $legacyCaller);5293 GenerateLegacyCallerDefinition($outputArray, $interface, $className, $legacyCaller); 5263 5294 } 5264 5295 5265 5296 my $overloadFunctionPrefix = "call${className}"; 5266 5297 5267 push(@ implContent, "EncodedJSValue JSC_HOST_CALL ${overloadFunctionPrefix}(ExecState* state)\n");5268 push(@ implContent, "{\n");5269 push(@ implContent, " VM& vm = state->vm();\n");5270 push(@ implContent, " auto throwScope = DECLARE_THROW_SCOPE(vm);\n");5271 push(@ implContent, " UNUSED_PARAM(throwScope);\n");5298 push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${overloadFunctionPrefix}(ExecState* state)\n"); 5299 push(@$outputArray, "{\n"); 5300 push(@$outputArray, " VM& vm = state->vm();\n"); 5301 push(@$outputArray, " auto throwScope = DECLARE_THROW_SCOPE(vm);\n"); 5302 push(@$outputArray, " UNUSED_PARAM(throwScope);\n"); 5272 5303 5273 5304 GenerateOverloadDispatcher($legacyCallers[0], $interface, $overloadFunctionPrefix, "", "state"); 5274 5305 5275 push(@ implContent, "}\n\n");5306 push(@$outputArray, "}\n\n"); 5276 5307 } else { 5277 GenerateLegacyCallerDefinition($ interface, $className, $legacyCallers[0]);5278 } 5279 5280 push(@ implContent, "CallType ${className}::getCallData(JSCell*, CallData& callData)\n");5281 push(@ implContent, "{\n");5282 push(@ implContent, " callData.native.function = call${className};\n");5283 push(@ implContent, " return CallType::Host;\n");5284 push(@ implContent, "}\n");5285 push(@ implContent, "\n");5308 GenerateLegacyCallerDefinition($outputArray, $interface, $className, $legacyCallers[0]); 5309 } 5310 5311 push(@$outputArray, "CallType ${className}::getCallData(JSCell*, CallData& callData)\n"); 5312 push(@$outputArray, "{\n"); 5313 push(@$outputArray, " callData.native.function = call${className};\n"); 5314 push(@$outputArray, " return CallType::Host;\n"); 5315 push(@$outputArray, "}\n"); 5316 push(@$outputArray, "\n"); 5286 5317 } 5287 5318 5288 5319 sub GenerateLegacyCallerDefinition 5289 5320 { 5290 my ($ interface, $className, $operation) = @_;5321 my ($outputArray, $interface, $className, $operation) = @_; 5291 5322 5292 5323 my $isOverloaded = $operation->{overloads} && @{$operation->{overloads}} > 1; 5293 5324 if ($isOverloaded) { 5294 push(@ implContent, "static inline EncodedJSValue call${className}$operation->{overloadIndex}(ExecState* state)\n");5325 push(@$outputArray, "static inline EncodedJSValue call${className}$operation->{overloadIndex}(ExecState* state)\n"); 5295 5326 } else { 5296 push(@ implContent, "static EncodedJSValue JSC_HOST_CALL call${className}(ExecState* state)\n");5297 } 5298 5299 push(@ implContent, "{\n");5300 push(@ implContent, " VM& vm = state->vm();\n");5301 push(@ implContent, " auto throwScope = DECLARE_THROW_SCOPE(vm);\n");5302 push(@ implContent, " UNUSED_PARAM(throwScope);\n");5327 push(@$outputArray, "static EncodedJSValue JSC_HOST_CALL call${className}(ExecState* state)\n"); 5328 } 5329 5330 push(@$outputArray, "{\n"); 5331 push(@$outputArray, " VM& vm = state->vm();\n"); 5332 push(@$outputArray, " auto throwScope = DECLARE_THROW_SCOPE(vm);\n"); 5333 push(@$outputArray, " UNUSED_PARAM(throwScope);\n"); 5303 5334 5304 5335 my $indent = " "; 5305 GenerateArgumentsCountCheck( \@implContent, $operation, $interface, $indent);5306 5307 push(@ implContent, " auto* castedThis = jsCast<${className}*>(state->jsCallee());\n");5308 push(@ implContent, " ASSERT(castedThis);\n");5309 push(@ implContent, " auto& impl = castedThis->wrapped();\n");5336 GenerateArgumentsCountCheck($outputArray, $operation, $interface, $indent); 5337 5338 push(@$outputArray, " auto* castedThis = jsCast<${className}*>(state->jsCallee());\n"); 5339 push(@$outputArray, " ASSERT(castedThis);\n"); 5340 push(@$outputArray, " auto& impl = castedThis->wrapped();\n"); 5310 5341 5311 5342 my $functionImplementationName = $operation->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($operation->name) || "legacyCallerOperationFromBindings"; 5312 my $functionString = GenerateParametersCheck( \@implContent, $operation, $interface, $functionImplementationName, $indent);5313 5314 GenerateImplementationFunctionCall( \@implContent, $operation, $interface, $functionString, $indent);5315 5316 push(@ implContent, "}\n\n");5343 my $functionString = GenerateParametersCheck($outputArray, $operation, $interface, $functionImplementationName, $indent); 5344 5345 GenerateImplementationFunctionCall($outputArray, $operation, $interface, $functionString, $indent); 5346 5347 push(@$outputArray, "}\n\n"); 5317 5348 } 5318 5349 … … 6819 6850 } 6820 6851 6821 if ($interface->extendedAttributes->{CustomNamedGetterOnPrototype}) { 6852 # FIXME: Should this override putByIndex as well? 6853 if ($interface->extendedAttributes->{CustomPutOnPrototype}) { 6822 6854 push(@$outputArray, "\n"); 6823 6855 push(@$outputArray, " static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);\n"); 6824 push(@$outputArray, " bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);\n"); 6825 } 6826 6827 # Custom defineOwnProperty function 6856 } 6857 6828 6858 if ($interface->extendedAttributes->{CustomDefineOwnPropertyOnPrototype}) { 6829 6859 push(@$outputArray, "\n"); … … 7087 7117 } 7088 7118 7089 sub InstanceOverrides Call7119 sub InstanceOverridesGetCallData 7090 7120 { 7091 7121 my $interface = shift; 7092 return $interface-> extendedAttributes->{CustomCall} || $interface->{LegacyCallers}7122 return $interface->{LegacyCallers} || $interface->extendedAttributes->{CustomGetCallData} || $interface->extendedAttributes->{Plugin}; 7093 7123 } 7094 7124 … … 7097 7127 my $interface = shift; 7098 7128 return IsDOMGlobalObject($interface) 7099 || $interface->extendedAttributes->{Custom NamedGetterOnPrototype}7129 || $interface->extendedAttributes->{CustomPutOnPrototype} 7100 7130 || $interface->extendedAttributes->{CustomDefineOwnPropertyOnPrototype}; 7101 7131 } -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.json
r219007 r219302 79 79 "contextsAllowed": ["attribute", "operation"] 80 80 }, 81 "CustomCall": {82 "contextsAllowed": ["interface"]83 },84 81 "CustomConstructor": { 85 82 "contextsAllowed": ["interface"] … … 94 91 "contextsAllowed": ["interface"] 95 92 }, 96 "CustomEnumerateProperty": { 93 "CustomGetCallData": { 94 "contextsAllowed": ["interface"] 95 }, 96 "CustomGetOwnPropertyNames": { 97 97 "contextsAllowed": ["interface"] 98 98 }, … … 100 100 "contextsAllowed": ["interface"] 101 101 }, 102 "CustomGetOwnPropertySlotByIndex": {103 "contextsAllowed": ["interface"]104 },105 102 "CustomGetOwnPropertySlotAndDescriptor": { 106 103 "contextsAllowed": ["interface"] … … 118 115 "contextsAllowed": ["interface"] 119 116 }, 120 "CustomNamedGetterOnPrototype": {121 "contextsAllowed": ["interface"]122 },123 "CustomNamedSetter": {124 "contextsAllowed": ["interface"]125 },126 117 "CustomPreventExtensions": { 127 118 "contextsAllowed": ["interface"] … … 133 124 "contextsAllowed": ["interface"] 134 125 }, 135 "CustomPutFunction": { 126 "CustomPut": { 127 "contextsAllowed": ["interface"] 128 }, 129 "CustomPutOnPrototype": { 136 130 "contextsAllowed": ["interface"] 137 131 }, … … 342 336 "notes" : "Only used by WebKitTestRunner and DumpRenderTree" 343 337 }, 338 "Plugin": { 339 "contextsAllowed": ["interface"], 340 "notes" : "Should only be used by elements that forward to Netscape plug-ins" 341 }, 344 342 "PrimaryGlobal": { 345 343 "contextsAllowed": ["interface"], -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r218997 r219302 414 414 } 415 415 416 bool JSTestInterface::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)417 {418 auto* thisObject = jsCast<JSTestInterface*>(cell);419 ASSERT_GC_OBJECT_INHERITS(thisObject, info());420 421 bool putResult = false;422 if (thisObject->putDelegate(state, propertyName, value, putPropertySlot, putResult))423 return putResult;424 425 return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);426 }427 428 bool JSTestInterface::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)429 {430 auto* thisObject = jsCast<JSTestInterface*>(cell);431 ASSERT_GC_OBJECT_INHERITS(thisObject, info());432 433 auto propertyName = Identifier::from(state, index);434 PutPropertySlot slot(thisObject, shouldThrow);435 bool putResult = false;436 if (thisObject->putDelegate(state, propertyName, value, slot, putResult))437 return putResult;438 439 return JSObject::putByIndex(cell, state, index, value, shouldThrow);440 }441 442 416 template<> inline JSTestInterface* IDLAttribute<JSTestInterface>::cast(ExecState& state, EncodedJSValue thisValue) 443 417 { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
r216198 r219302 80 80 81 81 void finishCreation(JSC::VM&); 82 bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);83 82 }; 84 83 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestPluginInterface.h
r219301 r219302 21 21 #pragma once 22 22 23 #if ENABLE(Condition1) || ENABLE(Condition2)24 25 23 #include "JSDOMWrapper.h" 26 #include "TestInterface.h" 24 #include "TestPluginInterface.h" 25 #include <runtime/CallData.h> 27 26 #include <wtf/NeverDestroyed.h> 28 27 29 28 namespace WebCore { 30 29 31 class WEBCORE_EXPORT JSTestInterface : public JSDOMWrapper<TestInterface> {30 class JSTestPluginInterface : public JSDOMWrapper<TestPluginInterface> { 32 31 public: 33 using Base = JSDOMWrapper<Test Interface>;34 static JSTest Interface* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestInterface>&& impl)32 using Base = JSDOMWrapper<TestPluginInterface>; 33 static JSTestPluginInterface* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestPluginInterface>&& impl) 35 34 { 36 JSTest Interface* ptr = new (NotNull, JSC::allocateCell<JSTestInterface>(globalObject->vm().heap)) JSTestInterface(structure, *globalObject, WTFMove(impl));35 JSTestPluginInterface* ptr = new (NotNull, JSC::allocateCell<JSTestPluginInterface>(globalObject->vm().heap)) JSTestPluginInterface(structure, *globalObject, WTFMove(impl)); 37 36 ptr->finishCreation(globalObject->vm()); 38 37 return ptr; … … 41 40 static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&); 42 41 static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&); 43 static TestInterface* toWrapped(JSC::VM&, JSC::JSValue); 42 static TestPluginInterface* toWrapped(JSC::VM&, JSC::JSValue); 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 45 static bool put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&); 45 46 static bool putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow); 47 static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&); 48 46 49 static void destroy(JSC::JSCell*); 47 50 … … 54 57 55 58 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*); 56 57 // Custom attributes 58 #if ENABLE(Condition22) || ENABLE(Condition23) 59 JSC::JSValue implementsStr3(JSC::ExecState&) const; 60 #endif 61 #if ENABLE(Condition22) || ENABLE(Condition23) 62 void setImplementsStr3(JSC::ExecState&, JSC::JSValue); 63 #endif 64 #if ENABLE(Condition11) || ENABLE(Condition12) 65 JSC::JSValue supplementalStr3(JSC::ExecState&) const; 66 #endif 67 #if ENABLE(Condition11) || ENABLE(Condition12) 68 void setSupplementalStr3(JSC::ExecState&, JSC::JSValue); 69 #endif 70 71 // Custom functions 72 #if ENABLE(Condition22) || ENABLE(Condition23) 73 JSC::JSValue implementsMethod3(JSC::ExecState&); 74 #endif 75 #if ENABLE(Condition11) || ENABLE(Condition12) 76 JSC::JSValue supplementalMethod3(JSC::ExecState&); 77 #endif 59 public: 60 static const unsigned StructureFlags = JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::TypeOfShouldCallGetCallData | Base::StructureFlags; 78 61 protected: 79 JSTest Interface(JSC::Structure*, JSDOMGlobalObject&, Ref<TestInterface>&&);62 JSTestPluginInterface(JSC::Structure*, JSDOMGlobalObject&, Ref<TestPluginInterface>&&); 80 63 81 64 void finishCreation(JSC::VM&); 82 bool putDelegate(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&, bool& putResult);83 65 }; 84 66 85 class JSTest InterfaceOwner : public JSC::WeakHandleOwner {67 class JSTestPluginInterfaceOwner : public JSC::WeakHandleOwner { 86 68 public: 87 69 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&); … … 89 71 }; 90 72 91 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, Test Interface*)73 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestPluginInterface*) 92 74 { 93 static NeverDestroyed<JSTest InterfaceOwner> owner;75 static NeverDestroyed<JSTestPluginInterfaceOwner> owner; 94 76 return &owner.get(); 95 77 } 96 78 97 inline void* wrapperKey(Test Interface* wrappableObject)79 inline void* wrapperKey(TestPluginInterface* wrappableObject) 98 80 { 99 81 return wrappableObject; 100 82 } 101 83 102 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestInterface&);103 inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Test Interface* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }104 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<Test Interface>&&);105 inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<Test Interface>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }84 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestPluginInterface&); 85 inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestPluginInterface* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); } 86 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestPluginInterface>&&); 87 inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestPluginInterface>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); } 106 88 107 template<> struct JSDOMWrapperConverterTraits<Test Interface> {108 using WrapperClass = JSTest Interface;109 using ToWrappedReturnType = Test Interface*;89 template<> struct JSDOMWrapperConverterTraits<TestPluginInterface> { 90 using WrapperClass = JSTestPluginInterface; 91 using ToWrappedReturnType = TestPluginInterface*; 110 92 }; 111 93 112 94 } // namespace WebCore 113 114 #endif // ENABLE(Condition1) || ENABLE(Condition2) -
trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl
r217369 r219302 31 31 [ 32 32 ActiveDOMObject, 33 Custom NamedSetter,33 CustomPut, 34 34 Conditional=Condition1|Condition2, 35 35 ConstructorCallWith=ScriptExecutionContext, -
trunk/Source/WebCore/css/CSSStyleDeclaration.idl
r217773 r219302 20 20 21 21 [ 22 Custom EnumerateProperty,22 CustomGetOwnPropertyNames, 23 23 CustomGetOwnPropertySlotAndDescriptor, 24 Custom NamedSetter,24 CustomPut, 25 25 ExportMacro=WEBCORE_EXPORT, 26 26 GenerateIsReachable, -
trunk/Source/WebCore/html/HTMLAppletElement.idl
r217773 r219302 20 20 21 21 [ 22 CustomCall, 23 CustomGetOwnPropertySlotAndDescriptor, 24 CustomNamedSetter, 22 Plugin 25 23 ] interface HTMLAppletElement : HTMLElement { 26 24 [Reflect] attribute DOMString align; -
trunk/Source/WebCore/html/HTMLEmbedElement.idl
r217773 r219302 20 20 21 21 [ 22 CustomCall, 23 CustomGetOwnPropertySlotAndDescriptor, 24 CustomNamedSetter, 22 Plugin 25 23 ] interface HTMLEmbedElement : HTMLElement { 26 24 [Reflect] attribute DOMString align; -
trunk/Source/WebCore/html/HTMLObjectElement.idl
r217773 r219302 20 20 21 21 [ 22 CustomCall, 23 CustomGetOwnPropertySlotAndDescriptor, 24 CustomNamedSetter 22 Plugin 25 23 ] interface HTMLObjectElement : HTMLElement { 26 24 readonly attribute HTMLFormElement form; -
trunk/Source/WebCore/page/DOMWindow.idl
r217773 r219302 31 31 CustomDefineOwnProperty, 32 32 CustomDeleteProperty, 33 Custom EnumerateProperty,33 CustomGetOwnPropertyNames, 34 34 CustomGetOwnPropertySlot, 35 CustomGetOwnPropertySlotByIndex,36 35 CustomGetPrototype, 37 36 CustomPreventExtensions, 38 37 CustomProxyToJSObject, 39 CustomPut Function,38 CustomPut, 40 39 CustomToStringName, 41 40 ExportMacro=WEBCORE_EXPORT, -
trunk/Source/WebCore/page/Location.idl
r218835 r219302 32 32 CustomDefineOwnPropertyOnPrototype, 33 33 CustomDeleteProperty, 34 Custom EnumerateProperty,35 CustomGetOwnPropertySlot AndDescriptor,34 CustomGetOwnPropertyNames, 35 CustomGetOwnPropertySlot, 36 36 CustomGetPrototype, 37 CustomNamedGetterOnPrototype,38 CustomNamedSetter,39 37 CustomPreventExtensions, 38 CustomPut, 39 CustomPutOnPrototype, 40 40 CustomToStringName, 41 41 GenerateIsReachable=ImplFrame, 42 42 IsImmutablePrototypeExoticObject, 43 Unforgeable ,43 Unforgeable 44 44 ] interface Location { 45 45 [SetterCallWith=ActiveWindow&FirstWindow, SetterMayThrowException, DoNotCheckSecurityOnSetter] stringifier attribute USVString href; -
trunk/Source/WebCore/storage/Storage.idl
r217773 r219302 25 25 26 26 [ 27 Custom EnumerateProperty,27 CustomGetOwnPropertyNames, 28 28 GenerateIsReachable=ImplFrame, 29 29 SkipVTableValidation,
Note: See TracChangeset
for help on using the changeset viewer.