Diff
Modified: trunk/Source/WebCore/ChangeLog (239482 => 239483)
--- trunk/Source/WebCore/ChangeLog 2018-12-21 01:32:14 UTC (rev 239482)
+++ trunk/Source/WebCore/ChangeLog 2018-12-21 01:33:14 UTC (rev 239483)
@@ -1,3 +1,23 @@
+2018-12-20 Justin Michaud <[email protected]>
+
+ Adding runtime-enabled attribute to Element prevents inlining property access
+ https://bugs.webkit.org/show_bug.cgi?id=192901
+
+ Add a call to flattenDictionaryObject after disabling runtime-enabled attributes.
+
+ Reviewed by Ryosuke Niwa.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
+ (WebCore::JSTestEnabledBySettingPrototype::finishCreation):
+ * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
+ (WebCore::JSTestGenerateIsReachablePrototype::finishCreation):
+ * bindings/scripts/test/JS/JSTestNode.cpp:
+ (WebCore::JSTestNodePrototype::finishCreation):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::JSTestObjPrototype::finishCreation):
+
2018-12-20 Chris Dumez <[email protected]>
Use Optional::hasValue() instead of Optional::has_value()
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (239482 => 239483)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-12-21 01:32:14 UTC (rev 239482)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2018-12-21 01:33:14 UTC (rev 239483)
@@ -4192,6 +4192,11 @@
my @runtimeEnabledProperties = @runtimeEnabledOperations;
push(@runtimeEnabledProperties, @runtimeEnabledAttributes);
+
+ if (@runtimeEnabledProperties) {
+ push(@implContent, " bool hasDisabledRuntimeProperties = false;\n");
+ }
+
foreach my $operationOrAttribute (@runtimeEnabledProperties) {
my $conditionalString = $codeGenerator->GenerateConditionalString($operationOrAttribute);
push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
@@ -4198,6 +4203,7 @@
my $runtimeEnableConditionalString = GenerateRuntimeEnableConditionalString($interface, $operationOrAttribute);
my $name = $operationOrAttribute->name;
push(@implContent, " if (!${runtimeEnableConditionalString}) {\n");
+ push(@implContent, " hasDisabledRuntimeProperties = true;\n");
push(@implContent, " auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n");
push(@implContent, " VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);\n");
push(@implContent, " JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);\n");
@@ -4205,6 +4211,11 @@
push(@implContent, "#endif\n") if $conditionalString;
}
+ if (@runtimeEnabledProperties) {
+ push(@implContent, " if (hasDisabledRuntimeProperties && structure()->isDictionary())\n");
+ push(@implContent, " flattenDictionaryObject(vm);\n");
+ }
+
foreach my $operation (@{$interface->operations}) {
next unless ($operation->extendedAttributes->{PrivateIdentifier});
AddToImplIncludes("WebCoreJSClientData.h");
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp (239482 => 239483)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp 2018-12-21 01:32:14 UTC (rev 239482)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEnabledBySetting.cpp 2018-12-21 01:33:14 UTC (rev 239483)
@@ -129,8 +129,10 @@
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestEnabledBySetting::info(), JSTestEnabledBySettingPrototypeTableValues, *this);
+ bool hasDisabledRuntimeProperties = false;
#if ENABLE(TEST_FEATURE)
if (!downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().testSettingEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledBySettingOperation"), strlen("enabledBySettingOperation"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -138,11 +140,14 @@
#endif
#if ENABLE(TEST_FEATURE)
if (!downcast<Document>(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext())->settings().testSettingEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledBySettingAttribute"), strlen("enabledBySettingAttribute"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
#endif
+ if (hasDisabledRuntimeProperties && structure()->isDictionary())
+ flattenDictionaryObject(vm);
}
const ClassInfo JSTestEnabledBySetting::s_info = { "TestEnabledBySetting", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestEnabledBySetting) };
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp (239482 => 239483)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp 2018-12-21 01:32:14 UTC (rev 239482)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp 2018-12-21 01:33:14 UTC (rev 239483)
@@ -101,11 +101,15 @@
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestGenerateIsReachable::info(), JSTestGenerateIsReachablePrototypeTableValues, *this);
+ bool hasDisabledRuntimeProperties = false;
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("aSecretAttribute"), strlen("aSecretAttribute"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
+ if (hasDisabledRuntimeProperties && structure()->isDictionary())
+ flattenDictionaryObject(vm);
}
const ClassInfo JSTestGenerateIsReachable::s_info = { "TestGenerateIsReachable", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestGenerateIsReachable) };
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (239482 => 239483)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2018-12-21 01:32:14 UTC (rev 239482)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2018-12-21 01:33:14 UTC (rev 239483)
@@ -147,12 +147,15 @@
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestNode::info(), JSTestNodePrototypeTableValues, *this);
+ bool hasDisabledRuntimeProperties = false;
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("calculateSecretResult"), strlen("calculateSecretResult"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("getSecretBoolean"), strlen("getSecretBoolean"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -159,6 +162,7 @@
}
#if ENABLE(TEST_FEATURE)
if (!(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("testFeatureGetSecretBoolean"), strlen("testFeatureGetSecretBoolean"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -165,25 +169,31 @@
}
#endif
if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("entries"), strlen("entries"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("keys"), strlen("keys"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("values"), strlen("values"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("forEach"), strlen("forEach"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
+ if (hasDisabledRuntimeProperties && structure()->isDictionary())
+ flattenDictionaryObject(vm);
putDirect(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (239482 => 239483)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2018-12-21 01:32:14 UTC (rev 239482)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2018-12-21 01:33:14 UTC (rev 239483)
@@ -2324,8 +2324,10 @@
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSTestObj::info(), JSTestObjPrototypeTableValues, *this);
+ bool hasDisabledRuntimeProperties = false;
#if ENABLE(TEST_FEATURE)
if (!RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeOperation"), strlen("enabledAtRuntimeOperation"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -2332,21 +2334,25 @@
}
#endif
if (!(worldForDOMObject(*this).someWorld() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledInSpecificWorldWhenRuntimeFeatureEnabled"), strlen("enabledInSpecificWorldWhenRuntimeFeatureEnabled"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!worldForDOMObject(*this).someWorld()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("worldSpecificMethod"), strlen("worldSpecificMethod"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("calculateSecretResult"), strlen("calculateSecretResult"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("getSecretBoolean"), strlen("getSecretBoolean"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -2353,6 +2359,7 @@
}
#if ENABLE(TEST_FEATURE)
if (!(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext() && RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled())) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("testFeatureGetSecretBoolean"), strlen("testFeatureGetSecretBoolean"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -2359,11 +2366,13 @@
}
#endif
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isDocument()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("conditionallyExposedToWindowFunction"), strlen("conditionallyExposedToWindowFunction"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isWorkerGlobalScope()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("conditionallyExposedToWorkerFunction"), strlen("conditionallyExposedToWorkerFunction"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -2370,6 +2379,7 @@
}
#if ENABLE(TEST_FEATURE)
if (!(RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled() && RuntimeEnabledFeatures::sharedFeatures().testFeature1Enabled())) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("enabledAtRuntimeAttribute"), strlen("enabledAtRuntimeAttribute"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
@@ -2376,15 +2386,19 @@
}
#endif
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isDocument()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("conditionallyExposedToWindowAttribute"), strlen("conditionallyExposedToWindowAttribute"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
if (!jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isWorkerGlobalScope()) {
+ hasDisabledRuntimeProperties = true;
auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("conditionallyExposedToWorkerAttribute"), strlen("conditionallyExposedToWorkerAttribute"));
VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName);
}
+ if (hasDisabledRuntimeProperties && structure()->isDictionary())
+ flattenDictionaryObject(vm);
putDirect(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
putDirect(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
putDirect(vm, vm.propertyNames->iteratorSymbol, globalObject()->arrayPrototype()->getDirect(vm, vm.propertyNames->builtinNames().valuesPrivateName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));