Changeset 239316 in webkit
- Timestamp:
- Dec 17, 2018 8:17:58 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r239315 r239316 1 2018-12-17 Justin Michaud <justin_michaud@apple.com> 2 3 Bindings generator should support Conditional= along with CachedAttribute 4 https://bugs.webkit.org/show_bug.cgi?id=192721 5 6 Reviewed by Ryosuke Niwa. 7 8 Fix a bug where specifying both attributes causes compilation errors because the compile-time 9 condition is not included in the derived code. 10 11 * bindings/scripts/CodeGeneratorJS.pm: 12 (GenerateImplementation): 13 * bindings/scripts/test/JS/JSTestObj.cpp: 14 (WebCore::jsTestObjCachedAttribute3Getter): 15 (WebCore::jsTestObjCachedAttribute3): 16 (WebCore::JSTestObj::visitChildren): 17 * bindings/scripts/test/JS/JSTestObj.h: 18 * bindings/scripts/test/TestObj.idl: 19 1 20 2018-12-17 David Kilzer <ddkilzer@apple.com> 2 21 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r239273 r239316 4525 4525 foreach my $attribute (@{$interface->attributes}) { 4526 4526 if ($attribute->extendedAttributes->{CachedAttribute}) { 4527 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute); 4528 push(@implContent, "#if ${conditionalString}\n") if $conditionalString; 4527 4529 push(@implContent, " visitor.append(thisObject->m_" . $attribute->name . ");\n"); 4530 push(@implContent, "#endif\n") if $conditionalString; 4528 4531 } 4529 4532 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r239273 r239316 1738 1738 JSC::EncodedJSValue jsTestObjCachedAttribute1(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 1739 1739 JSC::EncodedJSValue jsTestObjCachedAttribute2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 1740 #if ENABLE(CONDITION) 1741 JSC::EncodedJSValue jsTestObjCachedAttribute3(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 1742 #endif 1740 1743 JSC::EncodedJSValue jsTestObjAnyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 1741 1744 bool setJSTestObjAnyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); … … 2073 2076 { "cachedAttribute1", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, 2074 2077 { "cachedAttribute2", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, 2078 #if ENABLE(CONDITION) 2079 { "cachedAttribute3", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute3), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, 2080 #else 2081 { 0, 0, NoIntrinsic, { 0, 0 } }, 2082 #endif 2075 2083 { "anyAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAnyAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAnyAttribute) } }, 2076 2084 { "objectAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjObjectAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjObjectAttribute) } }, … … 4544 4552 } 4545 4553 4554 #if ENABLE(CONDITION) 4555 static inline JSValue jsTestObjCachedAttribute3Getter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) 4556 { 4557 UNUSED_PARAM(throwScope); 4558 UNUSED_PARAM(state); 4559 if (JSValue cachedValue = thisObject.m_cachedAttribute3.get()) 4560 return cachedValue; 4561 auto& impl = thisObject.wrapped(); 4562 JSValue result = toJS<IDLAny>(state, throwScope, impl.cachedAttribute3()); 4563 thisObject.m_cachedAttribute3.set(state.vm(), &thisObject, result); 4564 return result; 4565 } 4566 4567 EncodedJSValue jsTestObjCachedAttribute3(ExecState* state, EncodedJSValue thisValue, PropertyName) 4568 { 4569 return IDLAttribute<JSTestObj>::get<jsTestObjCachedAttribute3Getter, CastedThisErrorBehavior::Assert>(*state, thisValue, "cachedAttribute3"); 4570 } 4571 4572 #endif 4573 4546 4574 static inline JSValue jsTestObjAnyAttributeGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) 4547 4575 { … … 8495 8523 visitor.append(thisObject->m_cachedAttribute1); 8496 8524 visitor.append(thisObject->m_cachedAttribute2); 8525 #if ENABLE(CONDITION) 8526 visitor.append(thisObject->m_cachedAttribute3); 8527 #endif 8497 8528 } 8498 8529 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
r239191 r239316 61 61 mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1; 62 62 mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute2; 63 #if ENABLE(CONDITION) 64 mutable JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute3; 65 #endif 63 66 static void visitChildren(JSCell*, JSC::SlotVisitor&); 64 67 -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r237717 r239316 277 277 [CachedAttribute] readonly attribute any cachedAttribute1; 278 278 [CachedAttribute] readonly attribute any cachedAttribute2; 279 [CachedAttribute, Conditional=CONDITION] readonly attribute any cachedAttribute3; 279 280 280 281 attribute any anyAttribute;
Note: See TracChangeset
for help on using the changeset viewer.