Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (295458 => 295459)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2022-06-10 18:50:09 UTC (rev 295458)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2022-06-10 19:01:43 UTC (rev 295459)
@@ -1564,6 +1564,18 @@
WebKit:
default: true
+WebAPIsInShadowRealmEnabled:
+ type: bool
+ humanReadableName: "Web APIs in ShadowRealm"
+ humanReadableDescription: "Enable Web APIs to be exposed in ShadowRealm"
+ defaultValue:
+ WebKitLegacy:
+ default: false
+ WebKit:
+ default: false
+ WebCore:
+ default: false
+
WebAnimationsCompositeOperationsEnabled:
type: bool
humanReadableName: "Web Animations composite operations"
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (295458 => 295459)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2022-06-10 18:50:09 UTC (rev 295458)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2022-06-10 19:01:43 UTC (rev 295459)
@@ -39,6 +39,25 @@
#define WEBCORE_ADDITIONAL_PRIVATE_IDENTIFIERS(macro)
#endif
+#if !defined(WEBCORE_COMMON_PRIVATE_IDENTIFIERS_FOR_SHADOWREALM_EACH_PROPERTY_NAME)
+// Dom APIs exposed to ShadowRealm are temporarily enabled via the WebAPIsInShadowRealmEnabled
+// experimental feature. When this is resolved, these can be deleted.
+#define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_FOR_SHADOWREALM_EACH_PROPERTY_NAME(macro) \
+ macro(AbortController) \
+ macro(ByteLengthQueuingStrategy) \
+ macro(CountQueuingStrategy) \
+ macro(CustomEvent) \
+ macro(ErrorEvent) \
+ macro(Event) \
+ macro(EventTarget) \
+ macro(Performance) \
+ macro(PromiseRejectionEvent) \
+ macro(TextDecoder) \
+ macro(TextEncoder) \
+ macro(URL) \
+ macro(URLSearchParams)
+#endif
+
#define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
macro(AbortSignal) \
macro(AbstractRange) \
@@ -608,6 +627,7 @@
macro(pendingAbortRequest) \
macro(writeRequests) \
WEBCORE_ADDITIONAL_PRIVATE_IDENTIFIERS(macro) \
+ WEBCORE_COMMON_PRIVATE_IDENTIFIERS_FOR_SHADOWREALM_EACH_PROPERTY_NAME(macro) \
class WebCoreBuiltinNames {
public:
Modified: trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl (295458 => 295459)
--- trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl 2022-06-10 18:50:09 UTC (rev 295458)
+++ trunk/Source/WebCore/bindings/scripts/preprocess-idls.pl 2022-06-10 19:01:43 UTC (rev 295459)
@@ -501,6 +501,15 @@
$extendedAttributes->{"Conditional"} = $existingConditional;
}
+ if ($globalContext eq "ShadowRealm" && $extendedAttributes->{"Exposed"} eq "*") {
+ my $enabledBySetting = "WebAPIsInShadowRealmEnabled";
+ my $existingEnabledBySetting = $extendedAttributes->{"EnabledBySetting"};
+ if ($existingEnabledBySetting) {
+ $enabledBySetting .= "&" . $existingEnabledBySetting;
+ }
+ $extendedAttributes->{"EnabledBySetting"} = $enabledBySetting;
+ }
+
my $code = " ";
my @extendedAttributesList;
foreach my $attributeName (sort keys %{$extendedAttributes}) {
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSShadowRealmGlobalScope.cpp (295458 => 295459)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSShadowRealmGlobalScope.cpp 2022-06-10 18:50:09 UTC (rev 295458)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSShadowRealmGlobalScope.cpp 2022-06-10 19:01:43 UTC (rev 295459)
@@ -59,22 +59,18 @@
/* Hash table */
-static const struct CompactHashIndex JSShadowRealmGlobalScopeTableIndex[5] = {
+static const struct CompactHashIndex JSShadowRealmGlobalScopeTableIndex[2] = {
{ -1, -1 },
- { -1, -1 },
- { -1, -1 },
- { 0, 4 },
- { 1, -1 },
+ { 0, -1 },
};
static const HashTableValue JSShadowRealmGlobalScopeTableValues[] =
{
- { "ExposedStar"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRealmGlobalScope_ExposedStarConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "ShadowRealmGlobalScope"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsShadowRealmGlobalScope_ShadowRealmGlobalScopeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
-static const HashTable JSShadowRealmGlobalScopeTable = { 2, 3, true, JSShadowRealmGlobalScope::info(), JSShadowRealmGlobalScopeTableValues, JSShadowRealmGlobalScopeTableIndex };
+static const HashTable JSShadowRealmGlobalScopeTable = { 1, 1, true, JSShadowRealmGlobalScope::info(), JSShadowRealmGlobalScopeTableValues, JSShadowRealmGlobalScopeTableIndex };
template<> const ClassInfo JSShadowRealmGlobalScopeDOMConstructor::s_info = { "ShadowRealmGlobalScope"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSShadowRealmGlobalScopeDOMConstructor) };
template<> JSValue JSShadowRealmGlobalScopeDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
@@ -105,6 +101,8 @@
static_assert(!std::is_base_of<ActiveDOMObject, ShadowRealmGlobalScope>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
+ if (jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->settingsValues().webAPIsInShadowRealmEnabled)
+ putDirectCustomAccessor(vm, builtinNames(vm).ExposedStarPublicName(), CustomGetterSetter::create(vm, jsShadowRealmGlobalScope_ExposedStarConstructor, nullptr), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)));
}
JSValue JSShadowRealmGlobalScope::getConstructor(VM& vm, const JSGlobalObject* globalObject)
Modified: trunk/Source/WebCore/bindings/scripts/test/ShadowRealmGlobalScopeConstructors.idl (295458 => 295459)
--- trunk/Source/WebCore/bindings/scripts/test/ShadowRealmGlobalScopeConstructors.idl 2022-06-10 18:50:09 UTC (rev 295458)
+++ trunk/Source/WebCore/bindings/scripts/test/ShadowRealmGlobalScopeConstructors.idl 2022-06-10 19:01:43 UTC (rev 295459)
@@ -1,4 +1,4 @@
partial interface ShadowRealmGlobalScope {
- attribute ExposedStarConstructor ExposedStar;
+ [EnabledBySetting=WebAPIsInShadowRealmEnabled] attribute ExposedStarConstructor ExposedStar;
attribute ShadowRealmGlobalScopeConstructor ShadowRealmGlobalScope;
};