WebKit Bugzilla
Attachment 350161 Details for
Bug 189729
: JS bindings generator should support EnabledAtRuntime for static methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189729-20180919165926.patch (text/plain), 25.63 KB, created by
Justin Michaud
on 2018-09-19 16:59:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Justin Michaud
Created:
2018-09-19 16:59:27 PDT
Size:
25.63 KB
patch
obsolete
>Subversion Revision: 236208 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9fbcc30191f3788c5f302c500d6633c9ce768cd6..d2fcebba7002ac7228612a759f7545c967bf54c5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2018-09-19 Justin Michaud <justin_michaud@apple.com> >+ >+ JS bindings generator should support EnabledAtRuntime for static methods >+ https://bugs.webkit.org/show_bug.cgi?id=189729 >+ >+ Add support for EnabledAtRuntime to static methods in the JS bindings >+ code generator. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (GenerateRuntimeEnableConditionalStringForExposed): >+ (GenerateRuntimeEnableConditionalString): >+ (GetRuntimeEnabledStaticProperties): >+ (GenerateConstructorHelperMethods): >+ * bindings/scripts/test/JS/JSTestGlobalObject.cpp: >+ (WebCore::JSTestGlobalObjectConstructor::initializeProperties): >+ (WebCore::JSTestGlobalObject::finishCreation): >+ (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody): >+ (WebCore::jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic): >+ * bindings/scripts/test/JS/JSTestObj.cpp: >+ (WebCore::JSTestObjConstructor::initializeProperties): >+ (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStaticGetter): >+ (WebCore::jsTestObjConstructorEnabledAtRuntimeAttributeStatic): >+ (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStaticSetter): >+ (WebCore::setJSTestObjConstructorEnabledAtRuntimeAttributeStatic): >+ (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody): >+ (WebCore::jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic): >+ * bindings/scripts/test/TestGlobalObject.idl: >+ * bindings/scripts/test/TestObj.idl: >+ > 2018-09-19 Youenn Fablet <youenn@apple.com> > > Implement sender/receiver getStats >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index 7f4ac10c9e8af8bdc6dbc865cc7bbfe4a642f3dc..7b205f2d2926fc0f6e4c7f541531c125afcf5b09 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -3641,7 +3641,7 @@ sub ToMethodName > > sub GenerateRuntimeEnableConditionalStringForExposed > { >- my ($interface, $context, $conjuncts) = @_; >+ my ($interface, $context, $conjuncts, $globalObjectIsParam) = @_; > > assert("Must specify value for Exposed.") if $context->extendedAttributes->{Exposed} eq "VALUE_IS_MISSING"; > >@@ -3655,10 +3655,12 @@ sub GenerateRuntimeEnableConditionalStringForExposed > $exposed = @$exposed[0]; > } > >+ my $globalObjectPtr = $globalObjectIsParam ? "&globalObject" : "globalObject()"; >+ > if ($exposed eq "Window") { >- push(@$conjuncts, "jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isDocument()"); >+ push(@$conjuncts, "jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext()->isDocument()"); > } elsif ($exposed eq "Worker") { >- push(@$conjuncts, "jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isWorkerGlobalScope()"); >+ push(@$conjuncts, "jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext()->isWorkerGlobalScope()"); > } else { > assert("Unrecognized value '" . Dumper($context->extendedAttributes->{Exposed}) . "' for the Exposed extended attribute on '" . ref($context) . "'."); > } >@@ -3671,15 +3673,17 @@ sub GenerateRuntimeEnableConditionalStringForExposed > # (e.g. IDLInterface, IDLAttribute, IDLOperation, IDLIterable, etc.) > sub GenerateRuntimeEnableConditionalString > { >- my ($interface, $context) = @_; >+ my ($interface, $context, $globalObjectIsParam) = @_; > > my @conjuncts; >+ my $globalObjectPtr = $globalObjectIsParam ? "&globalObject" : "globalObject()"; > > if ($context->extendedAttributes->{SecureContext}) { > AddToImplIncludes("ScriptExecutionContext.h"); > > if ($context->extendedAttributes->{ContextHasServiceWorkerScheme}) { >- push(@conjuncts, "(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext() || jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->hasServiceWorkerScheme())"); >+ push(@conjuncts, "(jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext()->isSecureContext()" >+ . "|| jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext()->hasServiceWorkerScheme())"); > } else { > push(@conjuncts, "jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()"); > } >@@ -3687,7 +3691,7 @@ sub GenerateRuntimeEnableConditionalString > if ($context->extendedAttributes->{ContextHasServiceWorkerScheme}) { > AddToImplIncludes("ScriptExecutionContext.h"); > >- push(@conjuncts, "jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->hasServiceWorkerScheme()"); >+ push(@conjuncts, "jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext()->hasServiceWorkerScheme()"); > } > } > >@@ -3713,7 +3717,7 @@ sub GenerateRuntimeEnableConditionalString > > my @flags = split(/&/, $context->extendedAttributes->{EnabledBySetting}); > foreach my $flag (@flags) { >- push(@conjuncts, "downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings()." . ToMethodName($flag) . "Enabled()"); >+ push(@conjuncts, "downcast<Document>(jsCast<JSDOMGlobalObject*>(" . $globalObjectPtr . ")->scriptExecutionContext())->settings()." . ToMethodName($flag) . "Enabled()"); > } > } > >@@ -7185,6 +7189,43 @@ sub ConstructorHasProperties > return 0; > } > >+sub GetRuntimeEnabledStaticProperties >+{ >+ my ($interface) = @_; >+ >+ my @runtimeEnabledProperties = (); >+ >+ my @attributes = @{$interface->attributes}; >+ push(@attributes, @{$interface->mapLike->attributes}) if $interface->mapLike; >+ >+ foreach my $attribute (@attributes) { >+ next if AttributeShouldBeOnInstance($interface, $attribute) != 0; >+ next if not $attribute->isStatic; >+ >+ if (NeedsRuntimeCheck($interface, $attribute)) { >+ push(@runtimeEnabledProperties, $attribute); >+ } >+ } >+ >+ my @operations = @{$interface->operations}; >+ push(@operations, @{$interface->iterable->operations}) if IsKeyValueIterableInterface($interface); >+ push(@operations, @{$interface->mapLike->operations}) if $interface->mapLike; >+ push(@operations, @{$interface->serializable->operations}) if $interface->serializable; >+ foreach my $operation (@operations) { >+ next if ($operation->extendedAttributes->{PrivateIdentifier} and not $operation->extendedAttributes->{PublicIdentifier}); >+ next if $operation->{overloadIndex} && $operation->{overloadIndex} > 1; >+ next if OperationShouldBeOnInstance($interface, $operation) != 0; >+ next if $operation->name eq "[Symbol.Iterator]"; >+ next if not $operation->isStatic; >+ >+ if (NeedsRuntimeCheck($interface, $operation)) { >+ push(@runtimeEnabledProperties, $operation); >+ } >+ } >+ >+ return @runtimeEnabledProperties; >+} >+ > sub GenerateConstructorHelperMethods > { > my ($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor) = @_; >@@ -7244,6 +7285,21 @@ sub GenerateConstructorHelperMethods > } > push(@$outputArray, " reifyStaticProperties(vm, ${classForThis}, ${className}ConstructorTableValues, *this);\n") if ConstructorHasProperties($interface); > >+ my @runtimeEnabledProperties = GetRuntimeEnabledStaticProperties($interface); >+ >+ foreach my $operationOrAttribute (@runtimeEnabledProperties) { >+ my $conditionalString = $codeGenerator->GenerateConditionalString($operationOrAttribute); >+ push(@$outputArray, "#if ${conditionalString}\n") if $conditionalString; >+ my $runtimeEnableConditionalString = GenerateRuntimeEnableConditionalString($interface, $operationOrAttribute, "true"); >+ my $name = $operationOrAttribute->name; >+ push(@$outputArray, " if (!${runtimeEnableConditionalString}) {\n"); >+ push(@$outputArray, " auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n"); >+ push(@$outputArray, " VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);\n"); >+ push(@$outputArray, " JSObject::deleteProperty(this, globalObject.globalExec(), propertyName);\n"); >+ push(@$outputArray, " }\n"); >+ push(@$outputArray, "#endif\n") if $conditionalString; >+ } >+ > push(@$outputArray, "}\n\n"); > > if (IsJSBuiltinConstructor($interface)) { >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp >index bda32c37b044bfbd7346b7270a6cab4488c84ea5..71b8bddf68daecc73e221ce83d66073c738b4ec8 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp >@@ -56,6 +56,9 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionRegularOpera > #if ENABLE(TEST_FEATURE) > JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation(JSC::ExecState*); > #endif >+#if ENABLE(TEST_FEATURE) >+JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic(JSC::ExecState*); >+#endif > JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld(JSC::ExecState*); > JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled(JSC::ExecState*); > JSC::EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldWhenRuntimeFeaturesEnabled(JSC::ExecState*); >@@ -122,6 +125,17 @@ static const HashTableValue JSTestGlobalObjectTableValues[] = > }; > > static const HashTable JSTestGlobalObjectTable = { 4, 15, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex }; >+/* Hash table for constructor */ >+ >+static const HashTableValue JSTestGlobalObjectConstructorTableValues[] = >+{ >+#if ENABLE(TEST_FEATURE) >+ { "enabledAtRuntimeOperationStatic", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic), (intptr_t) (1) } }, >+#else >+ { 0, 0, NoIntrinsic, { 0, 0 } }, >+#endif >+}; >+ > template<> JSValue JSTestGlobalObjectConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) > { > UNUSED_PARAM(vm); >@@ -133,6 +147,7 @@ template<> void JSTestGlobalObjectConstructor::initializeProperties(VM& vm, JSDO > putDirect(vm, vm.propertyNames->prototype, globalObject.getPrototypeDirect(vm), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); > putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TestGlobalObject"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); > putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); >+ reifyStaticProperties(vm, JSTestGlobalObject::info(), JSTestGlobalObjectConstructorTableValues, *this); > } > > template<> const ClassInfo JSTestGlobalObjectConstructor::s_info = { "TestGlobalObject", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestGlobalObjectConstructor) }; >@@ -176,6 +191,10 @@ void JSTestGlobalObject::finishCreation(VM& vm) > #if ENABLE(TEST_FEATURE) > if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) > putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledAtRuntimeOperationPublicName(), 1, jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation, NoIntrinsic, attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::Function))); >+#endif >+#if ENABLE(TEST_FEATURE) >+ if (RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) >+ putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledAtRuntimeOperationStaticPublicName(), 1, jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic, NoIntrinsic, attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::Function))); > #endif > if (worldForDOMObject(*this).specificWorld()) > putDirectNativeFunction(vm, this, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().enabledInSpecificWorldPublicName(), 1, jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld, NoIntrinsic, attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::Function))); >@@ -456,6 +475,26 @@ EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeO > > #endif > >+#if ENABLE(TEST_FEATURE) >+static inline JSC::EncodedJSValue jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(state); >+ UNUSED_PARAM(throwScope); >+ if (UNLIKELY(state->argumentCount() < 1)) >+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); >+ auto testParam = convert<IDLLong>(*state, state->uncheckedArgument(0)); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ TestGlobalObject::enabledAtRuntimeOperationStatic(WTFMove(testParam)); >+ return JSValue::encode(jsUndefined()); >+} >+ >+EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStatic(ExecState* state) >+{ >+ return IDLOperation<JSTestGlobalObject>::callStatic<jsTestGlobalObjectConstructorFunctionEnabledAtRuntimeOperationStaticBody>(*state, "enabledAtRuntimeOperationStatic"); >+} >+ >+#endif >+ > static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldBody(JSC::ExecState* state, typename IDLOperation<JSTestGlobalObject>::ClassParameter castedThis, JSC::ThrowScope& throwScope) > { > UNUSED_PARAM(state); >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >index e4d988597acf92d4fd555ad2fbdf87e04a66d58f..0ca5dbde0c9734e3981ec11c1e75e7889abb7bbf 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >@@ -1419,6 +1419,9 @@ template<> TestObj::ConditionalDictionaryC convertDictionary<TestObj::Conditiona > #if ENABLE(TEST_FEATURE) > JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledAtRuntimeOperation(JSC::ExecState*); > #endif >+#if ENABLE(TEST_FEATURE) >+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic(JSC::ExecState*); >+#endif > JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabled(JSC::ExecState*); > JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWorldSpecificMethod(JSC::ExecState*); > JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCalculateSecretResult(JSC::ExecState*); >@@ -1685,6 +1688,10 @@ bool setJSTestObjReflectedCustomURLAttr(JSC::ExecState*, JSC::EncodedJSValue, JS > JSC::EncodedJSValue jsTestObjEnabledAtRuntimeAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > bool setJSTestObjEnabledAtRuntimeAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); > #endif >+#if ENABLE(TEST_FEATURE) >+JSC::EncodedJSValue jsTestObjConstructorEnabledAtRuntimeAttributeStatic(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >+bool setJSTestObjConstructorEnabledAtRuntimeAttributeStatic(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); >+#endif > JSC::EncodedJSValue jsTestObjTypedArrayAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > bool setJSTestObjTypedArrayAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); > JSC::EncodedJSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >@@ -1879,6 +1886,16 @@ static const HashTableValue JSTestObjConstructorTableValues[] = > { "staticReadOnlyLongAttr", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticReadOnlyLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, > { "staticStringAttr", static_cast<unsigned>(0), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticStringAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConstructorStaticStringAttr) } }, > { "TestSubObj", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorTestSubObj), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, >+#if ENABLE(TEST_FEATURE) >+ { "enabledAtRuntimeAttributeStatic", static_cast<unsigned>(0), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorEnabledAtRuntimeAttributeStatic), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConstructorEnabledAtRuntimeAttributeStatic) } }, >+#else >+ { 0, 0, NoIntrinsic, { 0, 0 } }, >+#endif >+#if ENABLE(TEST_FEATURE) >+ { "enabledAtRuntimeOperationStatic", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic), (intptr_t) (1) } }, >+#else >+ { 0, 0, NoIntrinsic, { 0, 0 } }, >+#endif > { "nullableStringStaticMethod", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjConstructorFunctionNullableStringStaticMethod), (intptr_t) (0) } }, > { "staticMethodWithCallbackAndOptionalArg", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg), (intptr_t) (0) } }, > { "staticMethodWithCallbackArg", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjConstructorFunctionStaticMethodWithCallbackArg), (intptr_t) (1) } }, >@@ -1945,6 +1962,20 @@ template<> void JSTestObjConstructor::initializeProperties(VM& vm, JSDOMGlobalOb > putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TestObject"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); > putDirect(vm, vm.propertyNames->length, jsNumber(2), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); > reifyStaticProperties(vm, JSTestObj::info(), JSTestObjConstructorTableValues, *this); >+#if ENABLE(TEST_FEATURE) >+ if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) { >+ auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeAttributeStatic"), strlen("enabledAtRuntimeAttributeStatic")); >+ VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); >+ JSObject::deleteProperty(this, globalObject.globalExec(), propertyName); >+ } >+#endif >+#if ENABLE(TEST_FEATURE) >+ if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) { >+ auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeOperationStatic"), strlen("enabledAtRuntimeOperationStatic")); >+ VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); >+ JSObject::deleteProperty(this, globalObject.globalExec(), propertyName); >+ } >+#endif > } > > template<> const ClassInfo JSTestObjConstructor::s_info = { "TestObject", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestObjConstructor) }; >@@ -3946,6 +3977,41 @@ bool setJSTestObjEnabledAtRuntimeAttribute(ExecState* state, EncodedJSValue this > > #endif > >+#if ENABLE(TEST_FEATURE) >+static inline JSValue jsTestObjConstructorEnabledAtRuntimeAttributeStaticGetter(ExecState& state, ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(throwScope); >+ UNUSED_PARAM(state); >+ JSValue result = toJS<IDLDOMString>(state, throwScope, TestObj::enabledAtRuntimeAttributeStatic()); >+ return result; >+} >+ >+EncodedJSValue jsTestObjConstructorEnabledAtRuntimeAttributeStatic(ExecState* state, EncodedJSValue thisValue, PropertyName) >+{ >+ return IDLAttribute<JSTestObj>::getStatic<jsTestObjConstructorEnabledAtRuntimeAttributeStaticGetter>(*state, thisValue, "enabledAtRuntimeAttributeStatic"); >+} >+ >+#endif >+ >+#if ENABLE(TEST_FEATURE) >+static inline bool setJSTestObjConstructorEnabledAtRuntimeAttributeStaticSetter(ExecState& state, JSValue value, ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(throwScope); >+ auto nativeValue = convert<IDLDOMString>(state, value); >+ RETURN_IF_EXCEPTION(throwScope, false); >+ AttributeSetter::call(state, throwScope, [&] { >+ return TestObj::setEnabledAtRuntimeAttributeStatic(WTFMove(nativeValue)); >+ }); >+ return true; >+} >+ >+bool setJSTestObjConstructorEnabledAtRuntimeAttributeStatic(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) >+{ >+ return IDLAttribute<JSTestObj>::setStatic<setJSTestObjConstructorEnabledAtRuntimeAttributeStaticSetter>(*state, thisValue, encodedValue, "enabledAtRuntimeAttributeStatic"); >+} >+ >+#endif >+ > static inline JSValue jsTestObjTypedArrayAttrGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) > { > UNUSED_PARAM(throwScope); >@@ -5263,6 +5329,26 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledAtRuntimeOperation > > #endif > >+#if ENABLE(TEST_FEATURE) >+static inline JSC::EncodedJSValue jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(state); >+ UNUSED_PARAM(throwScope); >+ if (UNLIKELY(state->argumentCount() < 1)) >+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); >+ auto testParam = convert<IDLLong>(*state, state->uncheckedArgument(0)); >+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); >+ TestObj::enabledAtRuntimeOperationStatic(WTFMove(testParam)); >+ return JSValue::encode(jsUndefined()); >+} >+ >+EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionEnabledAtRuntimeOperationStatic(ExecState* state) >+{ >+ return IDLOperation<JSTestObj>::callStatic<jsTestObjConstructorFunctionEnabledAtRuntimeOperationStaticBody>(*state, "enabledAtRuntimeOperationStatic"); >+} >+ >+#endif >+ > static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionEnabledInSpecificWorldWhenRuntimeFeatureEnabledBody(JSC::ExecState* state, typename IDLOperation<JSTestObj>::ClassParameter castedThis, JSC::ThrowScope& throwScope) > { > UNUSED_PARAM(state); >diff --git a/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl b/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl >index 5100e8a2b8e8160f3f4f4f222a8cb08f78700686..fd4fb38e77ae279bca2ac830a53178661c9cae22 100644 >--- a/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl >+++ b/Source/WebCore/bindings/scripts/test/TestGlobalObject.idl >@@ -34,6 +34,7 @@ > void regularOperation(DOMString testParam); > [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(DOMString testParam); > [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam); >+ [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] static void enabledAtRuntimeOperationStatic(long testParam); > > [EnabledForWorld=specificWorld] void enabledInSpecificWorld(long testParam); > >diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl >index 71ddfc489ed2d5da256fb5c430b932ebdc4f870b..be090a438f34dcd3663e87ffb06767627a52f11d 100644 >--- a/Source/WebCore/bindings/scripts/test/TestObj.idl >+++ b/Source/WebCore/bindings/scripts/test/TestObj.idl >@@ -110,6 +110,8 @@ enum TestConfidence { "high", "kinda-low" }; > [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature&TestFeature1] attribute DOMString enabledAtRuntimeAttribute; > [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(DOMString testParam); > [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] void enabledAtRuntimeOperation(long testParam); >+ [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] static void enabledAtRuntimeOperationStatic(long testParam); >+ [Conditional=TEST_FEATURE, EnabledAtRuntime=TestFeature] static attribute DOMString enabledAtRuntimeAttributeStatic; > > [EnabledForWorld=someWorld, EnabledAtRuntime=TestFeature] void enabledInSpecificWorldWhenRuntimeFeatureEnabled(long testParam); > [EnabledForWorld=someWorld] void worldSpecificMethod(long testParam); >@@ -273,7 +275,7 @@ enum TestConfidence { "high", "kinda-low" }; > > [CachedAttribute] readonly attribute any cachedAttribute1; > [CachedAttribute] readonly attribute any cachedAttribute2; >- >+ > attribute any anyAttribute; > attribute object objectAttribute; > >@@ -397,7 +399,7 @@ enum TestConfidence { "high", "kinda-low" }; > > readonly attribute Promise<void> testReadOnlyVoidPromiseAttribute; > readonly attribute Promise<TestNode> testReadOnlyPromiseAttribute; >- >+ > // Promise function > Promise<void> testPromiseFunction(); > Promise<void> testPromiseFunctionWithFloatArgument(float a); >@@ -431,7 +433,7 @@ enum TestConfidence { "high", "kinda-low" }; > serializer = {create, readOnlyStringAttr, enumAttr, longAttr}; > > void bufferSourceParameter(BufferSource data); >- >+ > legacycaller void legacyCallerNamed(long param); > legacycaller long (DOMString param); > legacycaller void ();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189729
:
350088
|
350129
|
350161
|
350219