Changeset 234636 in webkit


Ignore:
Timestamp:
Aug 6, 2018 5:13:16 PM (6 years ago)
Author:
rniwa@webkit.org
Message:

Add CEReactions=NotNeeded for reactions only needed for customized builtins
https://bugs.webkit.org/show_bug.cgi?id=187851

Reviewed by Chris Dumez.

Source/WebCore:

Because WebKit doesn't and will not support customized builtin elements, there are many DOM APIs marked with
[CEReactions] which don't actually need CustomElementReactionStack.

To clarify and document this difference, this patch introduces WebKit extention: [CEReactions=NotNeeded].
When this IDL attribute is specified, we generate CustomElementReactionDisallowedScope in the bindings code
to assert that there are no custom elements reactions being enqueued within the DOM API.

We suppress this assertion in CustomElementReactionStack since a DOM API with [CEReactions=NotNeeded] can
synchronously fire an event and otherwise execute arbirary scripts, which in turn could invoke a DOM API
with [CEReactions].

This patch deployes this change to HTMLIFrameElement since "src" IDL attribute triggers this second scenario.

Test: fast/custom-elements/custom-element-reaction-within-disallowed-scope.html

  • bindings/scripts/CodeGeneratorJS.pm:

(GeneratePut):
(GeneratePutByIndex):
(GenerateDefineOwnProperty):
(GenerateDeletePropertyCommon):
(GenerateAttributeSetterBodyDefinition):
(GenerateCustomElementReactionsStackIfNeeded): Added. Generate CustomElementReactionStack for [CEReactions]
and CustomElementReactionDisallowedScope for [CEReactions=NotNeeded].

  • bindings/scripts/test/JS/JSTestCEReactions.cpp:
  • bindings/scripts/test/TestCEReactions.idl: Added test cases for [CEReactions=NotNeeded].
  • bindings/scripts/test/TestCEReactionsStringifier.idl: Ditto.
  • dom/CustomElementReactionQueue.cpp:

(WebCore::CustomElementReactionQueue::enqueueElementUpgrade): Added an assertion to catch cases where
a DOM API with [CEReactions=NotNeeded] enqueues a custom element reaction; i.e. cases where [CEReactions]
should have been used.
(WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Ditto.
(WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Ditto.
(WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Ditto.
(WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Ditto.
(WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto.
(WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Ditto.

  • dom/CustomElementReactionQueue.h:

(WebCore::CustomElementReactionDisallowedScope): Added. Enables the assertion in enqueue* functions above.
(WebCore::CustomElementReactionDisallowedScope::CustomElementReactionDisallowedScope): Added.
(WebCore::CustomElementReactionDisallowedScope::~CustomElementReactionDisallowedScope): Added.
(WebCore::CustomElementReactionDisallowedScope::isReactionAllowed): Added.
(WebCore::CustomElementReactionDisallowedScope::AllowedScope): Added.
(WebCore::CustomElementReactionDisallowedScope::AllowedScope::AllowedScope): Added.
(WebCore::CustomElementReactionDisallowedScope::AllowedScope::~AllowedScope): Added.
(WebCore::CustomElementReactionStack): Suppress the assertion. See above for why this is needed.

  • html/HTMLIFrameElement.idl:

LayoutTests:

Added a regression test for enqueuing a custom element reaction in a DOM API marked as [CEReaction]
inside another DOM API with [CEReaction=NotNeeded]. WebKit should not hit a debug assertion added
by this patch.

  • fast/custom-elements/custom-element-reaction-within-disallowed-scope-expected.txt: Added.
  • fast/custom-elements/custom-element-reaction-within-disallowed-scope.html: Added.
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r234635 r234636  
     12018-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
    1152018-08-06  Matt Baker  <mattbaker@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r234633 r234636  
     12018-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
    1552018-08-06  Simon Fraser  <simon.fraser@apple.com>
    256
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r234539 r234636  
    931931    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(cell);\n");
    932932    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");
    937941    }
    938942   
     
    10031007    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(cell);\n");
    10041008    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");
    10091017    }
    10101018   
     
    10991107    push(@$outputArray, "    auto* thisObject = jsCast<${className}*>(object);\n");
    11001108    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");
    11051117    }
    11061118   
     
    12241236    push(@$outputArray, "    if (isVisibleNamedProperty<${overrideBuiltin}>(*state, thisObject, propertyName)) {\n");
    12251237
    1226     if ($operation->extendedAttributes->{CEReactions}) {
    1227         push(@$outputArray, "        CustomElementReactionStack customElementReactionStack(*state);\n");
    1228         AddToImplIncludes("CustomElementReactionQueue.h", $conditional);
    1229     }
     1238    GenerateCustomElementReactionsStackIfNeeded($outputArray, $operation, "*state");
    12301239
    12311240    # 2.1. If O does not implement an interface with a named property deleter, then return false.
     
    48434852    push(@$outputArray, "{\n");
    48444853    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
    48514857    if ($interface->extendedAttributes->{CheckSecurity} && !$attribute->extendedAttributes->{DoNotCheckSecurity} && !$attribute->extendedAttributes->{DoNotCheckSecurityOnSetter}) {
    48524858        AddToImplIncludes("JSDOMBindingSecurity.h", $conditional);
     
    50695075
    50705076    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");
    50755078
    50765079        if ($interface->extendedAttributes->{CheckSecurity} and !$operation->extendedAttributes->{DoNotCheckSecurity}) {
     
    74117414}
    74127415
     7416sub 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
    741374331;
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactions.cpp

    r234539 r234636  
    4646
    4747JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactions(JSC::ExecState*);
     48JSC::EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeeded(JSC::ExecState*);
    4849
    4950// Attributes
     
    5758JSC::EncodedJSValue jsTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
    5859bool setJSTestCEReactionsStringifierAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
     60JSC::EncodedJSValue jsTestCEReactionsAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
     61bool setJSTestCEReactionsAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
     62JSC::EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
     63bool setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
     64JSC::EncodedJSValue jsTestCEReactionsStringifierAttributeNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
     65bool setJSTestCEReactionsStringifierAttributeNotNeeded(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
    5966
    6067class JSTestCEReactionsPrototype : public JSC::JSNonFinalObject {
     
    108115    { "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) } },
    109116    { "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) } },
    110120    { "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) } },
    111122};
    112123
     
    287298}
    288299
     300static 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
     309EncodedJSValue jsTestCEReactionsAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, PropertyName)
     310{
     311    return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsAttributeWithCEReactionsNotNeededGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "attributeWithCEReactionsNotNeeded");
     312}
     313
     314static 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
     327bool setJSTestCEReactionsAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
     328{
     329    return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsAttributeWithCEReactionsNotNeededSetter>(*state, thisValue, encodedValue, "attributeWithCEReactionsNotNeeded");
     330}
     331
     332static 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
     341EncodedJSValue jsTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, PropertyName)
     342{
     343    return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsReflectAttributeWithCEReactionsNotNeededGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "reflectAttributeWithCEReactionsNotNeeded");
     344}
     345
     346static 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
     359bool setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeeded(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
     360{
     361    return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsReflectAttributeWithCEReactionsNotNeededSetter>(*state, thisValue, encodedValue, "reflectAttributeWithCEReactionsNotNeeded");
     362}
     363
     364static 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
     373EncodedJSValue jsTestCEReactionsStringifierAttributeNotNeeded(ExecState* state, EncodedJSValue thisValue, PropertyName)
     374{
     375    return IDLAttribute<JSTestCEReactions>::get<jsTestCEReactionsStringifierAttributeNotNeededGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "stringifierAttributeNotNeeded");
     376}
     377
     378static 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
     395bool setJSTestCEReactionsStringifierAttributeNotNeeded(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
     396{
     397    return IDLAttribute<JSTestCEReactions>::set<setJSTestCEReactionsStringifierAttributeNotNeededSetter>(*state, thisValue, encodedValue, "stringifierAttributeNotNeeded");
     398}
     399
    289400static inline JSC::EncodedJSValue jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactions>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
    290401{
     
    300411{
    301412    return IDLOperation<JSTestCEReactions>::call<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody>(*state, "methodWithCEReactions");
     413}
     414
     415static 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
     425EncodedJSValue JSC_HOST_CALL jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeeded(ExecState* state)
     426{
     427    return IDLOperation<JSTestCEReactions>::call<jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsNotNeededBody>(*state, "methodWithCEReactionsNotNeeded");
    302428}
    303429
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp

    r234539 r234636  
    4949JSC::EncodedJSValue jsTestCEReactionsStringifierValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
    5050bool setJSTestCEReactionsStringifierValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
     51JSC::EncodedJSValue jsTestCEReactionsStringifierValueWithoutReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
     52bool setJSTestCEReactionsStringifierValueWithoutReactions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
    5153
    5254class JSTestCEReactionsStringifierPrototype : public JSC::JSNonFinalObject {
     
    98100    { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCEReactionsStringifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCEReactionsStringifierConstructor) } },
    99101    { "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) } },
    100103    { "toString", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestCEReactionsStringifierPrototypeFunctionToString), (intptr_t) (0) } },
    101104};
     
    209212}
    210213
     214static 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
     223EncodedJSValue jsTestCEReactionsStringifierValueWithoutReactions(ExecState* state, EncodedJSValue thisValue, PropertyName)
     224{
     225    return IDLAttribute<JSTestCEReactionsStringifier>::get<jsTestCEReactionsStringifierValueWithoutReactionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "valueWithoutReactions");
     226}
     227
     228static 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
     241bool setJSTestCEReactionsStringifierValueWithoutReactions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
     242{
     243    return IDLAttribute<JSTestCEReactionsStringifier>::set<setJSTestCEReactionsStringifierValueWithoutReactionsSetter>(*state, thisValue, encodedValue, "valueWithoutReactions");
     244}
     245
    211246static inline JSC::EncodedJSValue jsTestCEReactionsStringifierPrototypeFunctionToStringBody(JSC::ExecState* state, typename IDLOperation<JSTestCEReactionsStringifier>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
    212247{
  • trunk/Source/WebCore/bindings/scripts/test/TestCEReactions.idl

    r207170 r234636  
    3333
    3434    [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;
    3541};
    3642
  • trunk/Source/WebCore/bindings/scripts/test/TestCEReactionsStringifier.idl

    r207170 r234636  
    2929interface TestCEReactionsStringifier {
    3030    [CEReactions] stringifier attribute DOMString value;
     31    [CEReactions=NotNeeded] stringifier attribute DOMString valueWithoutReactions;
    3132};
  • trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp

    r234577 r234636  
    120120void CustomElementReactionQueue::enqueueElementUpgrade(Element& element, bool alreadyScheduledToUpgrade)
    121121{
     122    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    122123    auto& queue = ensureCurrentQueue(element);
    123124    if (alreadyScheduledToUpgrade) {
     
    130131void CustomElementReactionQueue::enqueueElementUpgradeIfDefined(Element& element)
    131132{
     133    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    132134    ASSERT(element.isCustomElementUpgradeCandidate());
    133135    auto* window = element.document().domWindow();
     
    148150void CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(Element& element)
    149151{
     152    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    150153    ASSERT(element.isDefinedCustomElement());
    151154    ASSERT(element.document().refCount() > 0);
     
    157160void CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(Element& element)
    158161{
     162    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    159163    ASSERT(element.isDefinedCustomElement());
    160164    if (element.document().refCount() <= 0)
     
    167171void CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded(Element& element, Document& oldDocument, Document& newDocument)
    168172{
     173    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    169174    ASSERT(element.isDefinedCustomElement());
    170175    ASSERT(element.document().refCount() > 0);
     
    176181void CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(Element& element, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
    177182{
     183    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    178184    ASSERT(element.isDefinedCustomElement());
    179185    ASSERT(element.document().refCount() > 0);
     
    185191void CustomElementReactionQueue::enqueuePostUpgradeReactions(Element& element)
    186192{
     193    ASSERT(CustomElementReactionDisallowedScope::isReactionAllowed());
    187194    ASSERT(element.isCustomElementUpgradeCandidate());
    188195    if (!element.hasAttributes() && !element.isConnected())
     
    281288}
    282289
     290#if !ASSERT_DISABLED
     291unsigned CustomElementReactionDisallowedScope::s_customElementReactionDisallowedCount = 0;
     292#endif
     293
    283294CustomElementReactionStack* CustomElementReactionStack::s_currentProcessingStack = nullptr;
    284295
  • trunk/Source/WebCore/dom/CustomElementReactionQueue.h

    r234577 r234636  
    8585};
    8686
    87 class CustomElementReactionStack {
     87class CustomElementReactionDisallowedScope {
     88public:
     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
     127private:
     128#if !ASSERT_DISABLED
     129    WEBCORE_EXPORT static unsigned s_customElementReactionDisallowedCount;
     130
     131    friend class AllowedScope;
     132#endif
     133};
     134
     135class CustomElementReactionStack : public CustomElementReactionDisallowedScope::AllowedScope {
    88136public:
    89137    ALWAYS_INLINE CustomElementReactionStack(JSC::ExecState* state)
  • trunk/Source/WebCore/html/HTMLIFrameElement.idl

    r231114 r234636  
    2020
    2121interface 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;
    2929
    3030    [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;
    3333
    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;
    3838
    3939    [CheckSecurityForNode] readonly attribute Document contentDocument;
Note: See TracChangeset for help on using the changeset viewer.