Changeset 234636 in webkit
- Timestamp:
- Aug 6, 2018 5:13:16 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r234635 r234636 1 2018-08-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Add CEReactions=NotNeeded for reactions only needed for customized builtins 4 https://bugs.webkit.org/show_bug.cgi?id=187851 5 6 Reviewed by Chris Dumez. 7 8 Added a regression test for enqueuing a custom element reaction in a DOM API marked as [CEReaction] 9 inside another DOM API with [CEReaction=NotNeeded]. WebKit should not hit a debug assertion added 10 by this patch. 11 12 * fast/custom-elements/custom-element-reaction-within-disallowed-scope-expected.txt: Added. 13 * fast/custom-elements/custom-element-reaction-within-disallowed-scope.html: Added. 14 1 15 2018-08-06 Matt Baker <mattbaker@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r234633 r234636 1 2018-08-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Add CEReactions=NotNeeded for reactions only needed for customized builtins 4 https://bugs.webkit.org/show_bug.cgi?id=187851 5 6 Reviewed by Chris Dumez. 7 8 Because WebKit doesn't and will not support customized builtin elements, there are many DOM APIs marked with 9 [CEReactions] which don't actually need CustomElementReactionStack. 10 11 To clarify and document this difference, this patch introduces WebKit extention: [CEReactions=NotNeeded]. 12 When this IDL attribute is specified, we generate CustomElementReactionDisallowedScope in the bindings code 13 to assert that there are no custom elements reactions being enqueued within the DOM API. 14 15 We suppress this assertion in CustomElementReactionStack since a DOM API with [CEReactions=NotNeeded] can 16 synchronously fire an event and otherwise execute arbirary scripts, which in turn could invoke a DOM API 17 with [CEReactions]. 18 19 This patch deployes this change to HTMLIFrameElement since "src" IDL attribute triggers this second scenario. 20 21 Test: fast/custom-elements/custom-element-reaction-within-disallowed-scope.html 22 23 * bindings/scripts/CodeGeneratorJS.pm: 24 (GeneratePut): 25 (GeneratePutByIndex): 26 (GenerateDefineOwnProperty): 27 (GenerateDeletePropertyCommon): 28 (GenerateAttributeSetterBodyDefinition): 29 (GenerateCustomElementReactionsStackIfNeeded): Added. Generate CustomElementReactionStack for [CEReactions] 30 and CustomElementReactionDisallowedScope for [CEReactions=NotNeeded]. 31 * bindings/scripts/test/JS/JSTestCEReactions.cpp: 32 * bindings/scripts/test/TestCEReactions.idl: Added test cases for [CEReactions=NotNeeded]. 33 * bindings/scripts/test/TestCEReactionsStringifier.idl: Ditto. 34 * dom/CustomElementReactionQueue.cpp: 35 (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): Added an assertion to catch cases where 36 a DOM API with [CEReactions=NotNeeded] enqueues a custom element reaction; i.e. cases where [CEReactions] 37 should have been used. 38 (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Ditto. 39 (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Ditto. 40 (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Ditto. 41 (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Ditto. 42 (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto. 43 (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Ditto. 44 * dom/CustomElementReactionQueue.h: 45 (WebCore::CustomElementReactionDisallowedScope): Added. Enables the assertion in enqueue* functions above. 46 (WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): Added. 47 (WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): Added. 48 (WebCore::CustomElementReactionDisallowedScope::isReactionAllowed): Added. 49 (WebCore::CustomElementReactionDisallowedScope::AllowedScope): Added. 50 (WebCore::CustomElementReactionDisallowedScope::AllowedScope::AllowedScope): Added. 51 (WebCore::CustomElementReactionDisallowedScope::AllowedScope::~AllowedScope): Added. 52 (WebCore::CustomElementReactionStack): Suppress the assertion. See above for why this is needed. 53 * html/HTMLIFrameElement.idl: 54 1 55 2018-08-06 Simon Fraser <simon.fraser@apple.com> 2 56 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r234539 r234636 931 931 push(@$outputArray, " auto* thisObject = jsCast<${className}*>(cell);\n"); 932 932 push(@$outputArray, " ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n"); 933 934 if (($namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions}) || ($indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions})) { 935 push(@$outputArray, " CustomElementReactionStack customElementReactionStack(*state);\n\n"); 936 AddToImplIncludes("CustomElementReactionQueue.h"); 933 934 assert("CEReactions is not supported on having both named setters and indexed setters") if $namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions} 935 && $indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions}; 936 if ($namedSetterOperation) { 937 GenerateCustomElementReactionsStackIfNeeded($outputArray, $namedSetterOperation, "*state"); 938 } 939 if ($indexedSetterOperation) { 940 GenerateCustomElementReactionsStackIfNeeded($outputArray, $indexedSetterOperation, "*state"); 937 941 } 938 942 … … 1003 1007 push(@$outputArray, " auto* thisObject = jsCast<${className}*>(cell);\n"); 1004 1008 push(@$outputArray, " ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n"); 1005 1006 if (($namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions}) || ($indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions})) { 1007 push(@$outputArray, " CustomElementReactionStack customElementReactionStack(*state);\n\n"); 1008 AddToImplIncludes("CustomElementReactionQueue.h"); 1009 1010 assert("CEReactions is not supported on having both named setters and indexed setters") if $namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions} 1011 && $indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions}; 1012 if ($namedSetterOperation) { 1013 GenerateCustomElementReactionsStackIfNeeded($outputArray, $namedSetterOperation, "*state"); 1014 } 1015 if ($indexedSetterOperation) { 1016 GenerateCustomElementReactionsStackIfNeeded($outputArray, $indexedSetterOperation, "*state"); 1009 1017 } 1010 1018 … … 1099 1107 push(@$outputArray, " auto* thisObject = jsCast<${className}*>(object);\n"); 1100 1108 push(@$outputArray, " ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n\n"); 1101 1102 if (($namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions}) || ($indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions})) { 1103 push(@$outputArray, " CustomElementReactionStack customElementReactionStack(*state);\n\n"); 1104 AddToImplIncludes("CustomElementReactionQueue.h"); 1109 1110 assert("CEReactions is not supported on having both named setters and indexed setters") if $namedSetterOperation && $namedSetterOperation->extendedAttributes->{CEReactions} 1111 && $indexedSetterOperation && $indexedSetterOperation->extendedAttributes->{CEReactions}; 1112 if ($namedSetterOperation) { 1113 GenerateCustomElementReactionsStackIfNeeded($outputArray, $namedSetterOperation, "*state"); 1114 } 1115 if ($indexedSetterOperation) { 1116 GenerateCustomElementReactionsStackIfNeeded($outputArray, $indexedSetterOperation, "*state"); 1105 1117 } 1106 1118 … … 1224 1236 push(@$outputArray, " if (isVisibleNamedProperty<${overrideBuiltin}>(*state, thisObject, propertyName)) {\n"); 1225 1237 1226 if ($operation->extendedAttributes->{CEReactions}) { 1227 push(@$outputArray, " CustomElementReactionStack customElementReactionStack(*state);\n"); 1228 AddToImplIncludes("CustomElementReactionQueue.h", $conditional); 1229 } 1238 GenerateCustomElementReactionsStackIfNeeded($outputArray, $operation, "*state"); 1230 1239 1231 1240 # 2.1. If O does not implement an interface with a named property deleter, then return false. … … 4843 4852 push(@$outputArray, "{\n"); 4844 4853 push(@$outputArray, " UNUSED_PARAM(throwScope);\n"); 4845 4846 if ($attribute->extendedAttributes->{CEReactions}) { 4847 push(@$outputArray, " CustomElementReactionStack customElementReactionStack(state);\n"); 4848 AddToImplIncludes("CustomElementReactionQueue.h", $conditional); 4849 } 4850 4854 4855 GenerateCustomElementReactionsStackIfNeeded($outputArray, $attribute, "state"); 4856 4851 4857 if ($interface->extendedAttributes->{CheckSecurity} && !$attribute->extendedAttributes->{DoNotCheckSecurity} && !$attribute->extendedAttributes->{DoNotCheckSecurityOnSetter}) { 4852 4858 AddToImplIncludes("JSDOMBindingSecurity.h", $conditional); … … 5069 5075 5070 5076 if (!$generatingOverloadDispatcher) { 5071 if ($operation->extendedAttributes->{CEReactions}) { 5072 AddToImplIncludes("CustomElementReactionQueue.h", $conditional); 5073 push(@$outputArray, " CustomElementReactionStack customElementReactionStack(*state);\n"); 5074 } 5077 GenerateCustomElementReactionsStackIfNeeded($outputArray, $operation, "*state"); 5075 5078 5076 5079 if ($interface->extendedAttributes->{CheckSecurity} and !$operation->extendedAttributes->{DoNotCheckSecurity}) { … … 7411 7414 } 7412 7415 7416 sub GenerateCustomElementReactionsStackIfNeeded 7417 { 7418 my ($outputArray, $context, $stateVariable) = @_; 7419 7420 my $CEReactions = $context->extendedAttributes->{CEReactions}; 7421 7422 return if !$CEReactions; 7423 7424 AddToImplIncludes("CustomElementReactionQueue.h"); 7425 7426 if ($CEReactions eq "NotNeeded") { 7427 push(@$outputArray, " CustomElementReactionDisallowedScope customElementReactionDisallowedScope;\n"); 7428 } else { 7429 push(@$outputArray, " CustomElementReactionStack customElementReactionStack($stateVariable);\n"); 7430 } 7431 } 7432 7413 7433 1; -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp
r234539 r234636 46 46 47 47 JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(JSC::ExecState*); 48 JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeeded(JSC::ExecState*); 48 49 49 50 // Attributes … … 57 58 JSC::EncodedJSValue jsTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 58 59 bool setJSTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); 60 JSC::EncodedJSValue jsTestCEReactionsAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 61 bool setJSTestCEReactionsAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); 62 JSC::EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 63 bool setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); 64 JSC::EncodedJSValue jsTestCEReactionsStringifierAttributeNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 65 bool setJSTestCEReactionsStringifierAttributeNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); 59 66 60 67 class JSTestCEReactionsPrototype : public JSC::JSNonFinalObject { … … 108 115 { "reflectAttributeWithCEReactions", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsReflectAttributeWithCEReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsReflectAttributeWithCEReactions) } }, 109 116 { "stringifierAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierAttribute) } }, 117 { "attributeWithCEReactionsNotNeeded", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsAttributeWithCEReactionsNotNeeded), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsAttributeWithCEReactionsNotNeeded) } }, 118 { "reflectAttributeWithCEReactionsNotNeeded", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsReflectAttributeWithCEReactionsNotNeeded), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeeded) } }, 119 { "stringifierAttributeNotNeeded", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierAttributeNotNeeded), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierAttributeNotNeeded) } }, 110 120 { "methodWithCEReactions", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestCEReactionsPrototypeFunctionMethodWithCEReactions), (intptr_t) (0) } }, 121 { "methodWithCEReactionsNotNeeded", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeeded), (intptr_t) (0) } }, 111 122 }; 112 123 … … 287 298 } 288 299 300 static inline JSValue jsTestCEReactionsAttributeWithCEReactionsNotNeededGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope) 301 { 302 UNUSED_PARAM(throwScope); 303 UNUSED_PARAM(state); 304 auto& impl = thisObject.wrapped(); 305 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithCEReactionsNotNeeded()); 306 return result; 307 } 308 309 EncodedJSValue jsTestCEReactionsAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, PropertyName) 310 { 311 return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsAttributeWithCEReactionsNotNeededGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "attributeWithCEReactionsNotNeeded"); 312 } 313 314 static inline bool setJSTestCEReactionsAttributeWithCEReactionsNotNeededSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope) 315 { 316 UNUSED_PARAM(throwScope); 317 CustomElementReactionDisallowedScope customElementReactionDisallowedScope; 318 auto& impl = thisObject.wrapped(); 319 auto nativeValue = convert<IDLDOMString>(state, value); 320 RETURN_IF_EXCEPTION(throwScope, false); 321 AttributeSetter::call(state, throwScope, [&] { 322 return impl.setAttributeWithCEReactionsNotNeeded(WTFMove(nativeValue)); 323 }); 324 return true; 325 } 326 327 bool setJSTestCEReactionsAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) 328 { 329 return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsAttributeWithCEReactionsNotNeededSetter>(*state, thisValue, encodedValue, "attributeWithCEReactionsNotNeeded"); 330 } 331 332 static inline JSValue jsTestCEReactionsReflectAttributeWithCEReactionsNotNeededGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope) 333 { 334 UNUSED_PARAM(throwScope); 335 UNUSED_PARAM(state); 336 auto& impl = thisObject.wrapped(); 337 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.attributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsnotneededAttr)); 338 return result; 339 } 340 341 EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, PropertyName) 342 { 343 return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsReflectAttributeWithCEReactionsNotNeededGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "reflectAttributeWithCEReactionsNotNeeded"); 344 } 345 346 static inline bool setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeededSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope) 347 { 348 UNUSED_PARAM(throwScope); 349 CustomElementReactionDisallowedScope customElementReactionDisallowedScope; 350 auto& impl = thisObject.wrapped(); 351 auto nativeValue = convert<IDLDOMString>(state, value); 352 RETURN_IF_EXCEPTION(throwScope, false); 353 AttributeSetter::call(state, throwScope, [&] { 354 return impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectattributewithcereactionsnotneededAttr, WTFMove(nativeValue)); 355 }); 356 return true; 357 } 358 359 bool setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) 360 { 361 return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeededSetter>(*state, thisValue, encodedValue, "reflectAttributeWithCEReactionsNotNeeded"); 362 } 363 364 static inline JSValue jsTestCEReactionsStringifierAttributeNotNeededGetter(ExecState& state, JSTestCEReactions& thisObject, ThrowScope& throwScope) 365 { 366 UNUSED_PARAM(throwScope); 367 UNUSED_PARAM(state); 368 auto& impl = thisObject.wrapped(); 369 JSValue result = toJS<IDLInterface<TestCEReactionsStringifier>>(state, *thisObject.globalObject(), throwScope, impl.stringifierAttributeNotNeeded()); 370 return result; 371 } 372 373 EncodedJSValue jsTestCEReactionsStringifierAttributeNotNeeded(ExecState* state, EncodedJSValue thisValue, PropertyName) 374 { 375 return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsStringifierAttributeNotNeededGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "stringifierAttributeNotNeeded"); 376 } 377 378 static inline bool setJSTestCEReactionsStringifierAttributeNotNeededSetter(ExecState& state, JSTestCEReactions& thisObject, JSValue value, ThrowScope& throwScope) 379 { 380 UNUSED_PARAM(throwScope); 381 auto id = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("stringifierAttributeNotNeeded"), strlen("stringifierAttributeNotNeeded")); 382 auto valueToForwardTo = thisObject.get(&state, id); 383 RETURN_IF_EXCEPTION(throwScope, false); 384 if (UNLIKELY(!valueToForwardTo.isObject())) { 385 throwTypeError(&state, throwScope); 386 return false; 387 } 388 auto forwardId = Identifier::fromString(&state.vm(), reinterpret_cast<const LChar*>("valueWithoutReactions"), strlen("valueWithoutReactions")); 389 PutPropertySlot slot(valueToForwardTo, false); 390 asObject(valueToForwardTo)->methodTable(state.vm())->put(asObject(valueToForwardTo), &state, forwardId, value, slot); 391 RETURN_IF_EXCEPTION(throwScope, false); 392 return true; 393 } 394 395 bool setJSTestCEReactionsStringifierAttributeNotNeeded(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) 396 { 397 return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsStringifierAttributeNotNeededSetter>(*state, thisValue, encodedValue, "stringifierAttributeNotNeeded"); 398 } 399 289 400 static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactions>::ClassParameter castedThis, JSC::ThrowScope& throwScope) 290 401 { … … 300 411 { 301 412 return IDLOperation<JSTestCEReactions>::call<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody>(*state, "methodWithCEReactions"); 413 } 414 415 static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeededBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactions>::ClassParameter castedThis, JSC::ThrowScope& throwScope) 416 { 417 UNUSED_PARAM(state); 418 UNUSED_PARAM(throwScope); 419 CustomElementReactionDisallowedScope customElementReactionDisallowedScope; 420 auto& impl = castedThis->wrapped(); 421 impl.methodWithCEReactionsNotNeeded(); 422 return JSValue::encode(jsUndefined()); 423 } 424 425 EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeeded(ExecState* state) 426 { 427 return IDLOperation<JSTestCEReactions>::call<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeededBody>(*state, "methodWithCEReactionsNotNeeded"); 302 428 } 303 429 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp
r234539 r234636 49 49 JSC::EncodedJSValue jsTestCEReactionsStringifierValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 50 50 bool setJSTestCEReactionsStringifierValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); 51 JSC::EncodedJSValue jsTestCEReactionsStringifierValueWithoutReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); 52 bool setJSTestCEReactionsStringifierValueWithoutReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); 51 53 52 54 class JSTestCEReactionsStringifierPrototype : public JSC::JSNonFinalObject { … … 98 100 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierConstructor) } }, 99 101 { "value", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierValue) } }, 102 { "valueWithoutReactions", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierValueWithoutReactions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierValueWithoutReactions) } }, 100 103 { "toString", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestCEReactionsStringifierPrototypeFunctionToString), (intptr_t) (0) } }, 101 104 }; … … 209 212 } 210 213 214 static inline JSValue jsTestCEReactionsStringifierValueWithoutReactionsGetter(ExecState& state, JSTestCEReactionsStringifier& thisObject, ThrowScope& throwScope) 215 { 216 UNUSED_PARAM(throwScope); 217 UNUSED_PARAM(state); 218 auto& impl = thisObject.wrapped(); 219 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.valueWithoutReactions()); 220 return result; 221 } 222 223 EncodedJSValue jsTestCEReactionsStringifierValueWithoutReactions(ExecState* state, EncodedJSValue thisValue, PropertyName) 224 { 225 return IDLAttribute<JSTestCEReactionsStringifier>::get<jsTestCEReactionsStringifierValueWithoutReactionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "valueWithoutReactions"); 226 } 227 228 static inline bool setJSTestCEReactionsStringifierValueWithoutReactionsSetter(ExecState& state, JSTestCEReactionsStringifier& thisObject, JSValue value, ThrowScope& throwScope) 229 { 230 UNUSED_PARAM(throwScope); 231 CustomElementReactionDisallowedScope customElementReactionDisallowedScope; 232 auto& impl = thisObject.wrapped(); 233 auto nativeValue = convert<IDLDOMString>(state, value); 234 RETURN_IF_EXCEPTION(throwScope, false); 235 AttributeSetter::call(state, throwScope, [&] { 236 return impl.setValueWithoutReactions(WTFMove(nativeValue)); 237 }); 238 return true; 239 } 240 241 bool setJSTestCEReactionsStringifierValueWithoutReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) 242 { 243 return IDLAttribute<JSTestCEReactionsStringifier>::set<setJSTestCEReactionsStringifierValueWithoutReactionsSetter>(*state, thisValue, encodedValue, "valueWithoutReactions"); 244 } 245 211 246 static inline JSC::EncodedJSValue jsTestCEReactionsStringifierPrototypeFunctionToStringBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactionsStringifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope) 212 247 { -
trunk/Source/WebCore/bindings/scripts/test/TestCEReactions.idl
r207170 r234636 33 33 34 34 [PutForwards=value] attribute TestCEReactionsStringifier stringifierAttribute; 35 36 [CEReactions=NotNeeded] void methodWithCEReactionsNotNeeded(); 37 [CEReactions=NotNeeded] attribute DOMString attributeWithCEReactionsNotNeeded; 38 [CEReactions=NotNeeded, Reflect] attribute DOMString reflectAttributeWithCEReactionsNotNeeded; 39 40 [PutForwards=valueWithoutReactions] attribute TestCEReactionsStringifier stringifierAttributeNotNeeded; 35 41 }; 36 42 -
trunk/Source/WebCore/bindings/scripts/test/TestCEReactionsStringifier.idl
r207170 r234636 29 29 interface TestCEReactionsStringifier { 30 30 [CEReactions] stringifier attribute DOMString value; 31 [CEReactions=NotNeeded] stringifier attribute DOMString valueWithoutReactions; 31 32 }; -
trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp
r234577 r234636 120 120 void CustomElementReactionQueue::enqueueElementUpgrade(Element& element, bool alreadyScheduledToUpgrade) 121 121 { 122 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 122 123 auto& queue = ensureCurrentQueue(element); 123 124 if (alreadyScheduledToUpgrade) { … … 130 131 void CustomElementReactionQueue::enqueueElementUpgradeIfDefined(Element& element) 131 132 { 133 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 132 134 ASSERT(element.isCustomElementUpgradeCandidate()); 133 135 auto* window = element.document().domWindow(); … … 148 150 void CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(Element& element) 149 151 { 152 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 150 153 ASSERT(element.isDefinedCustomElement()); 151 154 ASSERT(element.document().refCount() > 0); … … 157 160 void CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(Element& element) 158 161 { 162 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 159 163 ASSERT(element.isDefinedCustomElement()); 160 164 if (element.document().refCount() <= 0) … … 167 171 void CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded(Element& element, Document& oldDocument, Document& newDocument) 168 172 { 173 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 169 174 ASSERT(element.isDefinedCustomElement()); 170 175 ASSERT(element.document().refCount() > 0); … … 176 181 void CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(Element& element, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue) 177 182 { 183 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 178 184 ASSERT(element.isDefinedCustomElement()); 179 185 ASSERT(element.document().refCount() > 0); … … 185 191 void CustomElementReactionQueue::enqueuePostUpgradeReactions(Element& element) 186 192 { 193 ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed()); 187 194 ASSERT(element.isCustomElementUpgradeCandidate()); 188 195 if (!element.hasAttributes() && !element.isConnected()) … … 281 288 } 282 289 290 #if !ASSERT_DISABLED 291 unsigned CustomElementReactionDisallowedScope::s_customElementReactionDisallowedCount = 0; 292 #endif 293 283 294 CustomElementReactionStack* CustomElementReactionStack::s_currentProcessingStack = nullptr; 284 295 -
trunk/Source/WebCore/dom/CustomElementReactionQueue.h
r234577 r234636 85 85 }; 86 86 87 class CustomElementReactionStack { 87 class CustomElementReactionDisallowedScope { 88 public: 89 CustomElementReactionDisallowedScope() 90 { 91 #if !ASSERT_DISABLED 92 s_customElementReactionDisallowedCount++; 93 #endif 94 } 95 96 ~CustomElementReactionDisallowedScope() 97 { 98 #if !ASSERT_DISABLED 99 ASSERT(s_customElementReactionDisallowedCount); 100 s_customElementReactionDisallowedCount--; 101 #endif 102 } 103 104 #if !ASSERT_DISABLED 105 static bool isReactionAllowed() { return !s_customElementReactionDisallowedCount; } 106 #endif 107 108 class AllowedScope { 109 #if !ASSERT_DISABLED 110 public: 111 AllowedScope() 112 : m_originalCount(s_customElementReactionDisallowedCount) 113 { 114 s_customElementReactionDisallowedCount = 0; 115 } 116 117 ~AllowedScope() 118 { 119 s_customElementReactionDisallowedCount = m_originalCount; 120 } 121 122 private: 123 unsigned m_originalCount; 124 #endif 125 }; 126 127 private: 128 #if !ASSERT_DISABLED 129 WEBCORE_EXPORT static unsigned s_customElementReactionDisallowedCount; 130 131 friend class AllowedScope; 132 #endif 133 }; 134 135 class CustomElementReactionStack : public CustomElementReactionDisallowedScope::AllowedScope { 88 136 public: 89 137 ALWAYS_INLINE CustomElementReactionStack(JSC::ExecState* state) -
trunk/Source/WebCore/html/HTMLIFrameElement.idl
r231114 r234636 20 20 21 21 interface HTMLIFrameElement : HTMLElement { 22 [Reflect ] attribute DOMString align;23 [Reflect ] attribute DOMString frameBorder;24 [Reflect ] attribute DOMString height;25 [Reflect, URL ] attribute USVString longDesc;26 [Reflect ] attribute [TreatNullAs=EmptyString] DOMString marginHeight;27 [Reflect ] attribute [TreatNullAs=EmptyString] DOMString marginWidth;28 [Reflect ] attribute DOMString name;22 [Reflect, CEReactions=NotNeeded] attribute DOMString align; 23 [Reflect, CEReactions=NotNeeded] attribute DOMString frameBorder; 24 [Reflect, CEReactions=NotNeeded] attribute DOMString height; 25 [Reflect, URL, CEReactions=NotNeeded] attribute USVString longDesc; 26 [Reflect, CEReactions=NotNeeded] attribute [TreatNullAs=EmptyString] DOMString marginHeight; 27 [Reflect, CEReactions=NotNeeded] attribute [TreatNullAs=EmptyString] DOMString marginWidth; 28 [Reflect, CEReactions=NotNeeded] attribute DOMString name; 29 29 30 30 [PutForwards=value] readonly attribute DOMTokenList sandbox; 31 [Reflect ] attribute boolean allowFullscreen;32 [ CEReactions, Reflect] attribute DOMString allow;31 [Reflect, CEReactions=NotNeeded] attribute boolean allowFullscreen; 32 [Reflect, CEReactions=NotNeeded] attribute DOMString allow; 33 33 34 [Reflect ] attribute DOMString scrolling;35 [Reflect, URL ] attribute USVString src;36 [Reflect ] attribute DOMString srcdoc;37 [Reflect ] attribute DOMString width;34 [Reflect, CEReactions=NotNeeded] attribute DOMString scrolling; 35 [Reflect, URL, CEReactions=NotNeeded] attribute USVString src; 36 [Reflect, CEReactions=NotNeeded] attribute DOMString srcdoc; 37 [Reflect, CEReactions=NotNeeded] attribute DOMString width; 38 38 39 39 [CheckSecurityForNode] readonly attribute Document contentDocument;
Note: See TracChangeset
for help on using the changeset viewer.