Changeset 191841 in webkit
- Timestamp:
- Oct 31, 2015 8:37:03 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r191832 r191841 1 2015-10-31 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Add the support for Symbol attributes on IDL 4 https://bugs.webkit.org/show_bug.cgi?id=150586 5 6 Reviewed by Ryosuke Niwa. 7 8 This patch addes readonly attribute support for Symbols. 9 It involves the IDL generator functionality converting Native type (PrivateName) to Symbol. 10 11 * bindings/scripts/CodeGeneratorGObject.pm: 12 (SkipAttribute): 13 (SkipFunction): 14 * bindings/scripts/CodeGeneratorJS.pm: 15 (NativeToJSValue): 16 * bindings/scripts/CodeGeneratorObjC.pm: 17 (SkipFunction): 18 (SkipAttribute): 19 * bindings/scripts/test/JS/JSTestObj.cpp: 20 (WebCore::jsTestObjReadOnlySymbolAttr): 21 (WebCore::jsTestObjConstructorStaticReadOnlySymbolAttr): 22 * bindings/scripts/test/TestObj.idl: 23 1 24 2015-10-30 Brady Eidson <beidson@apple.com> 2 25 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r191287 r191841 263 263 return 1 if $attribute->signature->type eq "EventHandler"; 264 264 265 return 1 if $attribute->signature->type eq "Symbol"; 266 265 267 if ($attribute->signature->type eq "MediaQueryListListener") { 266 268 return 1; … … 371 373 372 374 return 1 if $function->signature->type eq "Promise"; 375 376 return 1 if $function->signature->type eq "Symbol"; 373 377 374 378 return 1 if $function->signature->type eq "Date"; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r191587 r191841 3939 3939 "octet" => "uint8_t", 3940 3940 "DOMTimeStamp" => "DOMTimeStamp", 3941 "Symbol" => "PrivateName" 3941 3942 ); 3942 3943 … … 4153 4154 } 4154 4155 4156 if ($type eq "Symbol") { 4157 AddToImplIncludes("<runtime/Symbol.h>", $conditional); 4158 return "Symbol::create(state->vm(), *($value).uid())"; 4159 } 4160 4155 4161 if ($signature->extendedAttributes->{"Reflect"} and ($type eq "unsigned long" or $type eq "unsigned short")) { 4156 4162 $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm
r191287 r191841 540 540 541 541 return 1 if $function->signature->type eq "Promise"; 542 return 1 if $function->signature->type eq "Symbol"; 542 543 return 1 if $function->signature->extendedAttributes->{"CustomBinding"}; 543 544 … … 563 564 return 1 if $codeGenerator->IsEnumType($type); 564 565 return 1 if $type eq "EventHandler"; 566 return 1 if $type eq "Symbol"; 565 567 return 1 if $attribute->isStatic; 566 568 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r191287 r191841 62 62 #include <runtime/JSArray.h> 63 63 #include <runtime/JSString.h> 64 #include <runtime/Symbol.h> 64 65 #include <wtf/GetPtr.h> 65 66 … … 212 213 JSC::EncodedJSValue jsTestObjCreate(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName); 213 214 void setJSTestObjCreate(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue); 215 JSC::EncodedJSValue jsTestObjReadOnlySymbolAttr(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName); 216 JSC::EncodedJSValue jsTestObjConstructorStaticReadOnlySymbolAttr(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName); 214 217 JSC::EncodedJSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName); 215 218 void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue); … … 421 424 { "staticStringAttr", DontDelete, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticStringAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConstructorStaticStringAttr) } }, 422 425 { "TestSubObj", DontDelete | ReadOnly, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorTestSubObj), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, 426 { "staticReadOnlySymbolAttr", DontDelete | ReadOnly, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticReadOnlySymbolAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, 423 427 { "staticMethodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg), (intptr_t) (0) } }, 424 428 { "staticMethodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionStaticMethodWithCallbackArg), (intptr_t) (1) } }, … … 495 499 { "XMLObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjXMLObjAttr) } }, 496 500 { "create", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjCreate) } }, 501 { "readOnlySymbolAttr", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlySymbolAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, 497 502 { "reflectedStringAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjReflectedStringAttr) } }, 498 503 { "reflectedIntegralAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedIntegralAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjReflectedIntegralAttr) } }, … … 1026 1031 1027 1032 1033 EncodedJSValue jsTestObjReadOnlySymbolAttr(ExecState* state, JSObject* slotBase, EncodedJSValue thisValue, PropertyName) 1034 { 1035 UNUSED_PARAM(state); 1036 UNUSED_PARAM(slotBase); 1037 UNUSED_PARAM(thisValue); 1038 JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue)); 1039 if (UNLIKELY(!castedThis)) { 1040 if (jsDynamicCast<JSTestObjPrototype*>(slotBase)) 1041 return reportDeprecatedGetterError(*state, "TestObj", "readOnlySymbolAttr"); 1042 return throwGetterTypeError(*state, "TestObj", "readOnlySymbolAttr"); 1043 } 1044 auto& impl = castedThis->impl(); 1045 JSValue result = Symbol::create(state->vm(), *(impl.readOnlySymbolAttr()).uid()); 1046 return JSValue::encode(result); 1047 } 1048 1049 1050 EncodedJSValue jsTestObjConstructorStaticReadOnlySymbolAttr(ExecState* state, JSObject* slotBase, EncodedJSValue thisValue, PropertyName) 1051 { 1052 UNUSED_PARAM(state); 1053 UNUSED_PARAM(slotBase); 1054 UNUSED_PARAM(thisValue); 1055 JSValue result = Symbol::create(state->vm(), *(TestObj::staticReadOnlySymbolAttr()).uid()); 1056 return JSValue::encode(result); 1057 } 1058 1059 1028 1060 EncodedJSValue jsTestObjReflectedStringAttr(ExecState* state, JSObject* slotBase, EncodedJSValue thisValue, PropertyName) 1029 1061 { -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r191287 r191841 63 63 attribute boolean create; 64 64 65 // Readonly Symbol typed attributes. 66 readonly attribute Symbol readOnlySymbolAttr; 67 static readonly attribute Symbol staticReadOnlySymbolAttr; 68 65 69 // Reflected DOM attributes 66 70 [Reflect] attribute DOMString reflectedStringAttr;
Note: See TracChangeset
for help on using the changeset viewer.