Diff
Modified: trunk/Source/WebCore/ChangeLog (276873 => 276874)
--- trunk/Source/WebCore/ChangeLog 2021-05-01 13:27:35 UTC (rev 276873)
+++ trunk/Source/WebCore/ChangeLog 2021-05-01 17:15:01 UTC (rev 276874)
@@ -1,3 +1,28 @@
+2021-05-01 Sam Weinig <wei...@apple.com>
+
+ Generated JS bindings for JSValue -> IDL dictionary don't take into account runtime settings
+ https://bugs.webkit.org/show_bug.cgi?id=225271
+
+ Reviewed by Alexey Shvayka.
+
+ While we did account for Settings/RuntimeEnabledFeatures/etc when converting from a
+ dictionary to a JSValue, we forgot to add code to skip trying to read the properties
+ in on ingestion.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateDictionaryImplementationContent):
+ Match convertDictionaryToJS and add guard + indent if the property has a runtime flag.
+
+ * bindings/scripts/test/JS/JSTestDerivedDictionary.cpp:
+ (WebCore::convertDictionary<TestDerivedDictionary>):
+ * bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp:
+ (WebCore::convertDictionary<TestDerivedDictionary2::Dictionary>):
+ * bindings/scripts/test/JS/JSTestInheritedDictionary.cpp:
+ (WebCore::convertDictionary<TestInheritedDictionary>):
+ * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
+ (WebCore::convertDictionary<DictionaryImplName>):
+ Update test results.
+
2021-05-01 Zalan Bujtas <za...@apple.com>
[RenderTreeBuilder] Reset the "children inline" state when merging anonymous table boxes
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (276873 => 276874)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2021-05-01 13:27:35 UTC (rev 276873)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2021-05-01 17:15:01 UTC (rev 276874)
@@ -2620,40 +2620,52 @@
$result .= "#if ${conditionalString}\n";
}
+ my $needsRuntimeCheck = NeedsRuntimeCheck($dictionary, $member);
+ my $indent = "";
+ if ($needsRuntimeCheck) {
+ my $runtimeEnableConditionalString = GenerateRuntimeEnableConditionalString($dictionary, $member, "&lexicalGlobalObject");
+ $result .= " if (${runtimeEnableConditionalString}) {\n";
+ $indent = " ";
+ }
+
# 4.1. Let key be the identifier of member.
my $key = $member->name;
my $implementedAsKey = $member->extendedAttributes->{ImplementedAs} || $key;
# 4.2. Let value be an ECMAScript value, depending on Type(V):
- $result .= " JSValue ${key}Value;\n";
- $result .= " if (isNullOrUndefined)\n";
- $result .= " ${key}Value = jsUndefined();\n";
- $result .= " else {\n";
- $result .= " ${key}Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, \"${key}\"));\n";
- $result .= " RETURN_IF_EXCEPTION(throwScope, { });\n";
- $result .= " }\n";
+ $result .= "${indent} JSValue ${key}Value;\n";
+ $result .= "${indent} if (isNullOrUndefined)\n";
+ $result .= "${indent} ${key}Value = jsUndefined();\n";
+ $result .= "${indent} else {\n";
+ $result .= "${indent} ${key}Value = object->get(&lexicalGlobalObject, Identifier::fromString(vm, \"${key}\"));\n";
+ $result .= "${indent} RETURN_IF_EXCEPTION(throwScope, { });\n";
+ $result .= "${indent} }\n";
my $IDLType = GetIDLType($typeScope, $type);
# 4.3. If value is not undefined, then:
- $result .= " if (!${key}Value.isUndefined()) {\n";
+ $result .= "${indent} if (!${key}Value.isUndefined()) {\n";
my $nativeValue = JSValueToNative($typeScope, $member, "${key}Value", $member->extendedAttributes->{Conditional}, "&lexicalGlobalObject", "lexicalGlobalObject", "", "*jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)");
- $result .= " result.$implementedAsKey = $nativeValue;\n";
- $result .= " RETURN_IF_EXCEPTION(throwScope, { });\n";
+ $result .= "${indent} result.$implementedAsKey = $nativeValue;\n";
+ $result .= "${indent} RETURN_IF_EXCEPTION(throwScope, { });\n";
# Value is undefined.
# 4.4. Otherwise, if value is undefined but the dictionary member has a default value, then:
if (!$member->isRequired && defined $member->default) {
- $result .= " } else\n";
- $result .= " result.$implementedAsKey = " . GenerateDefaultValue($typeScope, $member, $member->type, $member->default) . ";\n";
+ $result .= "${indent} } else\n";
+ $result .= "${indent} result.$implementedAsKey = " . GenerateDefaultValue($typeScope, $member, $member->type, $member->default) . ";\n";
} elsif ($member->isRequired) {
# 4.5. Otherwise, if value is undefined and the dictionary member is a required dictionary member, then throw a TypeError.
- $result .= " } else {\n";
- $result .= " throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, \"". $member->name ."\", \"$name\", \"". GetTypeNameForDisplayInException($type) ."\");\n";
- $result .= " return { };\n";
- $result .= " }\n";
+ $result .= "${indent} } else {\n";
+ $result .= "${indent} throwRequiredMemberTypeError(lexicalGlobalObject, throwScope, \"". $member->name ."\", \"$name\", \"". GetTypeNameForDisplayInException($type) ."\");\n";
+ $result .= "${indent} return { };\n";
+ $result .= "${indent} }\n";
} else {
+ $result .= "${indent} }\n";
+ }
+
+ if ($needsRuntimeCheck) {
$result .= " }\n";
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary.cpp (276873 => 276874)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary.cpp 2021-05-01 13:27:35 UTC (rev 276873)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary.cpp 2021-05-01 17:15:01 UTC (rev 276874)
@@ -128,17 +128,19 @@
result.partialStringMember = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberValue);
RETURN_IF_EXCEPTION(throwScope, { });
}
- JSValue partialStringMemberWithEnabledBySettingValue;
- if (isNullOrUndefined)
- partialStringMemberWithEnabledBySettingValue = jsUndefined();
- else {
- partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
- RETURN_IF_EXCEPTION(throwScope, { });
+ if (jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)->scriptExecutionContext()->settingsValues().testSettingEnabled) {
+ JSValue partialStringMemberWithEnabledBySettingValue;
+ if (isNullOrUndefined)
+ partialStringMemberWithEnabledBySettingValue = jsUndefined();
+ else {
+ partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
+ if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
+ result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
}
- if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
- result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
- RETURN_IF_EXCEPTION(throwScope, { });
- }
JSValue partialUnsignedLongMemberWithImplementedAsValue;
if (isNullOrUndefined)
partialUnsignedLongMemberWithImplementedAsValue = jsUndefined();
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp (276873 => 276874)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp 2021-05-01 13:27:35 UTC (rev 276873)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp 2021-05-01 17:15:01 UTC (rev 276874)
@@ -211,17 +211,19 @@
result.partialStringMember = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberValue);
RETURN_IF_EXCEPTION(throwScope, { });
}
- JSValue partialStringMemberWithEnabledBySettingValue;
- if (isNullOrUndefined)
- partialStringMemberWithEnabledBySettingValue = jsUndefined();
- else {
- partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
- RETURN_IF_EXCEPTION(throwScope, { });
+ if (jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)->scriptExecutionContext()->settingsValues().testSettingEnabled) {
+ JSValue partialStringMemberWithEnabledBySettingValue;
+ if (isNullOrUndefined)
+ partialStringMemberWithEnabledBySettingValue = jsUndefined();
+ else {
+ partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
+ if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
+ result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
}
- if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
- result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
- RETURN_IF_EXCEPTION(throwScope, { });
- }
JSValue partialUnsignedLongMemberWithImplementedAsValue;
if (isNullOrUndefined)
partialUnsignedLongMemberWithImplementedAsValue = jsUndefined();
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary.cpp (276873 => 276874)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary.cpp 2021-05-01 13:27:35 UTC (rev 276873)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInheritedDictionary.cpp 2021-05-01 17:15:01 UTC (rev 276874)
@@ -128,17 +128,19 @@
result.partialStringMember = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberValue);
RETURN_IF_EXCEPTION(throwScope, { });
}
- JSValue partialStringMemberWithEnabledBySettingValue;
- if (isNullOrUndefined)
- partialStringMemberWithEnabledBySettingValue = jsUndefined();
- else {
- partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
- RETURN_IF_EXCEPTION(throwScope, { });
+ if (jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)->scriptExecutionContext()->settingsValues().testSettingEnabled) {
+ JSValue partialStringMemberWithEnabledBySettingValue;
+ if (isNullOrUndefined)
+ partialStringMemberWithEnabledBySettingValue = jsUndefined();
+ else {
+ partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
+ if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
+ result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
}
- if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
- result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
- RETURN_IF_EXCEPTION(throwScope, { });
- }
JSValue partialUnsignedLongMemberWithImplementedAsValue;
if (isNullOrUndefined)
partialUnsignedLongMemberWithImplementedAsValue = jsUndefined();
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp (276873 => 276874)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp 2021-05-01 13:27:35 UTC (rev 276873)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp 2021-05-01 17:15:01 UTC (rev 276874)
@@ -183,17 +183,19 @@
}
#endif
#if ENABLE(Conditional13) || ENABLE(Conditional14)
- JSValue partialStringMemberWithEnabledBySettingValue;
- if (isNullOrUndefined)
- partialStringMemberWithEnabledBySettingValue = jsUndefined();
- else {
- partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
- RETURN_IF_EXCEPTION(throwScope, { });
+ if (jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject)->scriptExecutionContext()->settingsValues().testSettingEnabled) {
+ JSValue partialStringMemberWithEnabledBySettingValue;
+ if (isNullOrUndefined)
+ partialStringMemberWithEnabledBySettingValue = jsUndefined();
+ else {
+ partialStringMemberWithEnabledBySettingValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "partialStringMemberWithEnabledBySetting"));
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
+ if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
+ result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
+ RETURN_IF_EXCEPTION(throwScope, { });
+ }
}
- if (!partialStringMemberWithEnabledBySettingValue.isUndefined()) {
- result.partialStringMemberWithEnabledBySetting = convert<IDLDOMString>(lexicalGlobalObject, partialStringMemberWithEnabledBySettingValue);
- RETURN_IF_EXCEPTION(throwScope, { });
- }
#endif
#if ENABLE(Conditional13) || ENABLE(Conditional14)
JSValue partialUnsignedLongMemberWithImplementedAsValue;