Diff
Modified: trunk/Source/WebCore/ChangeLog (200293 => 200294)
--- trunk/Source/WebCore/ChangeLog 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/ChangeLog 2016-04-30 20:26:35 UTC (rev 200294)
@@ -1,5 +1,91 @@
2016-04-30 Darin Adler <[email protected]>
+ Stop using old-style string-based enums in Internals.idl
+ https://bugs.webkit.org/show_bug.cgi?id=157235
+
+ Reviewed by Chris Dumez.
+
+ * bindings/scripts/CodeGenerator.pm: Removed the six enumeration names
+ that are used in Internals.idl.
+ (GenerateCompileTimeCheckForEnumsIfNeeded): Unrelated cleanup. Tighten
+ code and use static_assert instead of COMPILE_ASSERT.
+ (IsStringType): Marked this function as deprecated. Calling a function
+ just to check if something is specifically "DOMString" isn't a good pattern.
+ Lots of call sites were checking "DOMString" directly and there is no
+ reason to mix the two different idioms.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GetEnumerationImplementationContent): Use GenerateConditionalString.
+ (GenerateImplementation): Use static_assert instead of COMPILE_ASSERT.
+ (GenerateCallbackHeader): Tighten code. Remove peculiar code that was
+ trying to emit COMPILE_ASSERT(false); not an important case to detect, and
+ if we did want to detect it, then having the code generator report an error
+ is better than COMPILE_ASSERT when compiling the output.
+ (NativeToJSValue): Stop using IsStringType.
+
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ (GetClassName): Stop using IsStringType.
+ (GetPropertyAttributes): Ditto.
+ (ConversionNeeded): Ditto.
+ (GetObjCTypeGetter): Ditto.
+ (AddIncludesForType): Ditto.
+ (GenerateImplementation): Removed unused @needsAssert. It was a write-only
+ variable.
+
+ * bindings/scripts/IDLParser.pm:
+ (parseEnum): Put the extended attributes into the enumeration object.
+
+ * bindings/scripts/test/TestObj.idl: Added test cases for the Conditional
+ extended attribute, used with enumerations.
+
+ * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+ * bindings/scripts/test/JS/JSTestCallback.cpp:
+ * bindings/scripts/test/JS/JSTestCallback.h:
+ * bindings/scripts/test/JS/JSTestCallbackFunction.h:
+ * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
+ * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
+ * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
+ * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
+ * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+ * bindings/scripts/test/JS/JSTestException.cpp:
+ * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
+ * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+ * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+ * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+ * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
+ * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ * bindings/scripts/test/JS/JSattribute.cpp:
+ * bindings/scripts/test/JS/JSreadonly.cpp:
+ Regenerated.
+
+ * testing/Internals.cpp:
+ (WebCore::toResourceRequestCachePolicy): Take enum instead of string.
+ (WebCore::Internals::setOverrideCachePolicy): Ditto.
+ (WebCore::toResourceLoadPriority): Ditto.
+ (WebCore::Internals::setOverrideResourceLoadPriority): Ditto.
+ (WebCore::toAutoFillButtonType): Ditto.
+ (WebCore::Internals::setShowAutoFillButton): Ditto.
+ (WebCore::interruptingCategoryFromString): Deleted.
+ (WebCore::Internals::sendMediaSessionStartOfInterruptionNotification): Ditto.
+ (WebCore::Internals::sendMediaSessionEndOfInterruptionNotification): Ditto.
+ (WebCore::Internals::sendMediaControlEvent): Ditto.
+ (WebCore::Internals::installMockPageOverlay): Ditto.
+
+ * testing/Internals.h: Added enum class and use those instead of strings for
+ enumerations defined in the IDL.
+
+ * testing/Internals.idl: Renamed enumerations that conflict with ones that already
+ exist in WebCore; added Internals prefix. Made MediaSessionInterruptingCategory and
+ MediaControlEvent conditional to match the functions they are used on. Added some
+ FIXMEs about peculiarities of some of the enumerations.
+
+2016-04-30 Darin Adler <[email protected]>
+
Fixed expected results from bindings tests.
* bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-04-30 20:26:35 UTC (rev 200294)
@@ -63,8 +63,6 @@
my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1 );
-my %stringTypeHash = ( "DOMString" => 1 );
-
# WebCore types used directly in IDL files.
my %webCoreTypeHash = (
"Dictionary" => 1,
@@ -120,11 +118,6 @@
# enumeration to using an actual enum class in the C++. Once that is done, we should
# remove this hash and the function that calls it.
my %stringBasedEnumerationHash = (
- "AutoFillButtonType" => 1,
- "CachePolicy" => 1,
- "MediaControlEvent" => 1,
- "MediaSessionInterruptingCategory" => 1,
- "PageOverlayType" => 1,
"RTCBundlePolicyEnum" => 1,
"RTCIceTransportPolicyEnum" => 1,
"ReferrerPolicy" => 1,
@@ -134,7 +127,6 @@
"RequestMode" => 1,
"RequestRedirect" => 1,
"RequestType" => 1,
- "ResourceLoadPriority" => 1,
"TextTrackKind" => 1,
"TextTrackMode" => 1,
"XMLHttpRequestResponseType" => 1,
@@ -374,13 +366,14 @@
return 0;
}
+# Deprecated: Just check for "DOMString" instead.
+# Currently used outside WebKit in an internal Apple project; can be removed soon.
sub IsStringType
{
my $object = shift;
my $type = shift;
- return 1 if $stringTypeHash{$type};
- return 0;
+ return $type eq "DOMString";
}
sub IsStringBasedEnumType
@@ -854,34 +847,20 @@
sub GenerateCompileTimeCheckForEnumsIfNeeded
{
my ($generator, $interface) = @_;
- my $interfaceName = $interface->name;
- my @checks = ();
- # If necessary, check that all constants are available as enums with the same value.
- if (!$interface->extendedAttributes->{"DoNotCheckConstants"} && @{$interface->constants}) {
- push(@checks, "\n");
- foreach my $constant (@{$interface->constants}) {
- my $reflect = $constant->extendedAttributes->{"Reflect"};
- my $name = $reflect ? $reflect : $constant->name;
- my $value = $constant->value;
- my $conditional = $constant->extendedAttributes->{"Conditional"};
- if ($conditional) {
- my $conditionalString = $generator->GenerateConditionalStringFromAttributeValue($conditional);
- push(@checks, "#if ${conditionalString}\n");
- }
+ return () if $interface->extendedAttributes->{"DoNotCheckConstants"} || !@{$interface->constants};
- if ($constant->extendedAttributes->{"ImplementedBy"}) {
- push(@checks, "COMPILE_ASSERT($value == " . $constant->extendedAttributes->{"ImplementedBy"} . "::$name, ${interfaceName}Enum${name}IsWrongUseDoNotCheckConstants);\n");
- } else {
- push(@checks, "COMPILE_ASSERT($value == ${interfaceName}::$name, ${interfaceName}Enum${name}IsWrongUseDoNotCheckConstants);\n");
- }
-
- if ($conditional) {
- push(@checks, "#endif\n");
- }
- }
- push(@checks, "\n");
+ my @checks = ();
+ foreach my $constant (@{$interface->constants}) {
+ my $className = $constant->extendedAttributes->{"ImplementedBy"} || $interface->name;
+ my $name = $constant->extendedAttributes->{"Reflect"} || $constant->name;
+ my $value = $constant->value;
+ my $conditional = $constant->extendedAttributes->{"Conditional"};
+ push(@checks, "#if " . $generator->GenerateConditionalStringFromAttributeValue($conditional) . "\n") if $conditional;
+ push(@checks, "static_assert(${className}::$name == $value, \"$name in $className does not match value from IDL\");\n");
+ push(@checks, "#endif\n") if $conditional;
}
+ push(@checks, "\n");
return @checks;
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-30 20:26:35 UTC (rev 200294)
@@ -859,6 +859,9 @@
# FIXME: A little ugly to have this be a side effect instead of a return value.
AddToImplIncludes("<runtime/JSString.h>");
+ my $conditionalString = $codeGenerator->GenerateConditionalString($enumeration);
+ $result .= "#if ${conditionalString}\n\n" if $conditionalString;
+
# Declare these instead of using "static" because these may be unused and we don't
# want to get warnings about them.
$result .= "JSString* jsStringWithCache(ExecState*, $className);\n";
@@ -909,6 +912,8 @@
$result .= "}\n\n";
$result .= "const char expectedEnumerationValues${className}[] = \"\\\"" . join ("\\\", \\\"", @{$enumeration->values}) . "\\\"\";\n\n";
+
+ $result .= "#endif\n\n" if $conditionalString;
}
return $result;
}
@@ -1236,7 +1241,6 @@
my $inAppleCopyright = 0;
push(@headerContent, "\n // Custom functions\n");
foreach my $function (@{$interface->functions}) {
- # PLATFORM_IOS
my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
if ($needsAppleCopyright) {
if (!$inAppleCopyright) {
@@ -1247,7 +1251,6 @@
push(@headerContent, $endAppleCopyright);
$inAppleCopyright = 0;
}
- # end PLATFORM_IOS
next unless HasCustomMethod($function->signature->extendedAttributes);
next if $function->{overloads} && $function->{overloadIndex} != 1;
my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
@@ -1552,7 +1555,7 @@
# are accepted for compatibility. Otherwise, no restrictions are made to
# match the non-overloaded behavior.
# FIXME: Implement WebIDL overload resolution algorithm.
- if ($codeGenerator->IsStringType($type) || $codeGenerator->IsEnumType($type)) {
+ if ($type eq "DOMString" || $codeGenerator->IsEnumType($type)) {
if ($parameter->extendedAttributes->{"StrictTypeChecking"}) {
push(@andExpression, "(${value}.isUndefinedOrNull() || ${value}.isString() || ${value}.isObject())");
$usedArguments{$parameterIndex} = 1;
@@ -3326,7 +3329,7 @@
#if COMPILER(CLANG)
// If this fails $implType does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic($implType), ${implType}_is_not_polymorphic);
+ static_assert(__is_polymorphic($implType), "${implType} is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
@@ -3342,7 +3345,7 @@
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
// attribute to $interfaceName.
- COMPILE_ASSERT(!__is_polymorphic($implType), ${implType}_is_polymorphic_but_idl_claims_not_to_be);
+ static_assert(!__is_polymorphic($implType), "${implType} is polymorphic but the IDL claims it is not");
#endif
END
push(@implContent, <<END) if $interface->extendedAttributes->{"ReportExtraMemoryCost"};
@@ -3893,20 +3896,11 @@
if ($numFunctions > 0) {
push(@headerContent, "\n // Functions\n");
foreach my $function (@{$interface->functions}) {
- my @params = @{$function->parameters};
- if (!$function->signature->extendedAttributes->{"Custom"} && GetNativeType($function->signature->type) ne "bool") {
- push(@headerContent, " COMPILE_ASSERT(false)");
+ my @arguments = ();
+ foreach my $parameter (@{$function->parameters}) {
+ push(@arguments, GetNativeTypeForCallbacks($parameter->type) . " " . $parameter->name);
}
-
- push(@headerContent, " virtual " . GetNativeTypeForCallbacks($function->signature->type) . " " . $function->signature->name . "(");
-
- my @args = ();
- foreach my $param (@params) {
- push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
- }
- push(@headerContent, join(", ", @args));
-
- push(@headerContent, ");\n");
+ push(@headerContent, " virtual " . GetNativeTypeForCallbacks($function->signature->type) . " " . $function->signature->name . "(" . join(", ", @arguments) . ");\n");
}
}
@@ -4529,7 +4523,7 @@
return "jsStringWithCache(state, $value)";
}
- if ($codeGenerator->IsStringType($type)) {
+ if ($type eq "DOMString") {
AddToImplIncludes("URL.h", $conditional);
return "jsStringOrNull(state, $value)" if $signature->isNullable;
AddToImplIncludes("<runtime/JSString.h>", $conditional);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm 2016-04-30 20:26:35 UTC (rev 200294)
@@ -393,7 +393,7 @@
my $name = shift;
# special cases
- return "NSString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue";
+ return "NSString" if $name eq "DOMString" or $name eq "SerializedScriptValue";
return "CGColorRef" if $name eq "Color" and $shouldUseCGColor;
return "NS$name" if IsNativeObjCType($name);
return "BOOL" if $name eq "boolean";
@@ -597,9 +597,9 @@
push(@attributes, "readonly") if $readOnly;
# FIXME: <rdar://problem/5049934> Consider using 'nonatomic' on the DOM @property declarations.
- if ($codeGenerator->IsStringType($type) || IsNativeObjCType($type)) {
+ if ($type eq "DOMString" || IsNativeObjCType($type)) {
push(@attributes, "copy");
- } elsif (!$codeGenerator->IsStringType($type) && !$codeGenerator->IsPrimitiveType($type) && $type ne "DOMTimeStamp") {
+ } elsif ($type ne "DOMString" && !$codeGenerator->IsPrimitiveType($type) && $type ne "DOMTimeStamp") {
push(@attributes, "strong");
}
@@ -611,7 +611,7 @@
{
my $type = shift;
- return !$codeGenerator->IsNonPointerType($type) && !$codeGenerator->IsStringType($type) && !IsNativeObjCType($type);
+ return !$codeGenerator->IsNonPointerType($type) && $type ne "DOMString" && !IsNativeObjCType($type);
}
sub GetObjCTypeGetter
@@ -619,7 +619,7 @@
my $argName = shift;
my $type = shift;
- return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type) or IsNativeObjCType($type);
+ return $argName if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMString" or IsNativeObjCType($type);
return $argName . "Node" if $type eq "EventTarget";
return "WTF::getPtr(nativeEventListener)" if $type eq "EventListener";
return "WTF::getPtr(nativeNodeFilter)" if $type eq "NodeFilter";
@@ -675,7 +675,7 @@
return;
}
- if ($codeGenerator->IsStringType($type)) {
+ if ($type eq "DOMString") {
$implIncludes{"URL.h"} = 1;
return;
}
@@ -1409,7 +1409,7 @@
push(@implContent, "{\n");
push(@implContent, " $jsContextSetter\n");
- unless ($codeGenerator->IsPrimitiveType($idlType) or $codeGenerator->IsStringType($idlType)) {
+ unless ($codeGenerator->IsPrimitiveType($idlType) or $idlType eq "DOMString") {
push(@implContent, " ASSERT($argName);\n\n");
}
@@ -1455,7 +1455,6 @@
my $raisesExceptions = $function->signature->extendedAttributes->{"RaisesException"};
my @parameterNames = ();
- my @needsAssert = ();
my %needsCustom = ();
my $parameterIndex = 0;
@@ -1492,10 +1491,6 @@
$needsCustom{"EventTarget"} = $paramName if $idlType eq "EventTarget";
$needsCustom{"NodeToReturn"} = $paramName if $param->extendedAttributes->{"CustomReturn"};
- unless ($codeGenerator->IsPrimitiveType($idlType) or $codeGenerator->IsStringType($idlType)) {
- push(@needsAssert, " ASSERT($paramName);\n");
- }
-
if ($parameterIndex >= 1) {
$functionSig .= " " . $param->name;
}
Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm 2016-04-30 20:26:35 UTC (rev 200294)
@@ -107,6 +107,7 @@
struct( domEnum => {
name => '$', # Enumeration identifier
values => '@', # Enumeration values (list of unique strings)
+ extendedAttributes => '$',
});
struct( Token => {
@@ -777,7 +778,7 @@
sub parseEnum
{
my $self = shift;
- my $extendedAttributeList = shift; # ignored: Extended attributes are not applicable to enumerations
+ my $extendedAttributeList = shift;
my $next = $self->nextToken();
if ($next->value() eq "enum") {
@@ -790,6 +791,7 @@
push(@{$enum->values}, @{$self->parseEnumValueList()});
$self->assertTokenValue($self->getToken(), "}", __LINE__);
$self->assertTokenValue($self->getToken(), ";", __LINE__);
+ $enum->extendedAttributes($extendedAttributeList);
return $enum;
}
$self->assertUnexpectedToken($next->value(), __LINE__);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -275,7 +275,7 @@
#if COMPILER(CLANG)
// If this fails TestActiveDOMObject does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestActiveDOMObject), TestActiveDOMObject_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestActiveDOMObject), "TestActiveDOMObject is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -71,10 +71,9 @@
{ "CONSTANT2", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
};
+static_assert(TestCallback::CONSTANT1 == 1, "CONSTANT1 in TestCallback does not match value from IDL");
+static_assert(TestCallback::CONSTANT2 == 2, "CONSTANT2 in TestCallback does not match value from IDL");
-COMPILE_ASSERT(1 == TestCallback::CONSTANT1, TestCallbackEnumCONSTANT1IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(2 == TestCallback::CONSTANT2, TestCallbackEnumCONSTANT2IsWrongUseDoNotCheckConstants);
-
template<> JSValue JSTestCallbackConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h 2016-04-30 20:26:35 UTC (rev 200294)
@@ -46,7 +46,7 @@
virtual bool callbackWithNoParam();
virtual bool callbackWithArrayParam(RefPtr<Float32Array> arrayParam);
virtual bool callbackWithSerializedScriptValueParam(PassRefPtr<SerializedScriptValue> srzParam, const String& strArg);
- COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(const String& strArg);
+ virtual int callbackWithNonBoolReturnType(const String& strArg);
virtual int customCallback(Class5* class5Param, Class6* class6Param);
virtual bool callbackWithStringList(PassRefPtr<DOMStringList> listParam);
virtual bool callbackWithBoolean(bool boolParam);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2016-04-30 20:26:35 UTC (rev 200294)
@@ -45,7 +45,7 @@
virtual bool callbackWithNoParam();
virtual bool callbackWithArrayParam(RefPtr<Float32Array> arrayParam);
virtual bool callbackWithSerializedScriptValueParam(PassRefPtr<SerializedScriptValue> srzParam, const String& strArg);
- COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(const String& strArg);
+ virtual int callbackWithNonBoolReturnType(const String& strArg);
virtual int customCallback(Class5* class5Param, Class6* class6Param);
virtual bool callbackWithStringList(PassRefPtr<DOMStringList> listParam);
virtual bool callbackWithBoolean(bool boolParam);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -199,7 +199,7 @@
#if COMPILER(CLANG)
// If this fails TestClassWithJSBuiltinConstructor does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestClassWithJSBuiltinConstructor), TestClassWithJSBuiltinConstructor_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestClassWithJSBuiltinConstructor), "TestClassWithJSBuiltinConstructor is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -189,7 +189,7 @@
#if COMPILER(CLANG)
// If this fails TestCustomConstructorWithNoInterfaceObject does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestCustomConstructorWithNoInterfaceObject), TestCustomConstructorWithNoInterfaceObject_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestCustomConstructorWithNoInterfaceObject), "TestCustomConstructorWithNoInterfaceObject is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -246,7 +246,7 @@
#if COMPILER(CLANG)
// If this fails TestCustomNamedGetter does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestCustomNamedGetter), TestCustomNamedGetter_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestCustomNamedGetter), "TestCustomNamedGetter is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -294,7 +294,7 @@
#if COMPILER(CLANG)
// If this fails TestEventConstructor does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestEventConstructor), TestEventConstructor_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestEventConstructor), "TestEventConstructor is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -252,7 +252,7 @@
#if COMPILER(CLANG)
// If this fails TestEventTarget does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestEventTarget), TestEventTarget_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestEventTarget), "TestEventTarget is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -227,7 +227,7 @@
#if COMPILER(CLANG)
// If this fails TestException does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestException), TestException_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestException), "TestException is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -186,7 +186,7 @@
#if COMPILER(CLANG)
// If this fails TestGenerateIsReachable does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestGenerateIsReachable), TestGenerateIsReachable_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestGenerateIsReachable), "TestGenerateIsReachable is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -367,7 +367,7 @@
#if COMPILER(CLANG)
// If this fails TestGlobalObject does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestGlobalObject), TestGlobalObject_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestGlobalObject), "TestGlobalObject is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -208,18 +208,17 @@
#endif
};
-
#if ENABLE(Condition22) || ENABLE(Condition23)
-COMPILE_ASSERT(1 == TestInterface::IMPLEMENTSCONSTANT1, TestInterfaceEnumIMPLEMENTSCONSTANT1IsWrongUseDoNotCheckConstants);
+static_assert(TestInterface::IMPLEMENTSCONSTANT1 == 1, "IMPLEMENTSCONSTANT1 in TestInterface does not match value from IDL");
#endif
#if ENABLE(Condition22) || ENABLE(Condition23)
-COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
+static_assert(TestInterface::CONST_IMPL == 2, "CONST_IMPL in TestInterface does not match value from IDL");
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
-COMPILE_ASSERT(1 == TestSupplemental::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants);
+static_assert(TestSupplemental::SUPPLEMENTALCONSTANT1 == 1, "SUPPLEMENTALCONSTANT1 in TestSupplemental does not match value from IDL");
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
-COMPILE_ASSERT(2 == TestSupplemental::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
+static_assert(TestSupplemental::CONST_IMPL == 2, "CONST_IMPL in TestSupplemental does not match value from IDL");
#endif
template<> EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::construct(ExecState* state)
@@ -935,7 +934,7 @@
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
// attribute to TestInterface.
- COMPILE_ASSERT(!__is_polymorphic(TestInterface), TestInterface_is_polymorphic_but_idl_claims_not_to_be);
+ static_assert(!__is_polymorphic(TestInterface), "TestInterface is polymorphic but the IDL claims it is not");
#endif
return createNewWrapper<JSTestInterface>(globalObject, impl);
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -211,7 +211,7 @@
#if COMPILER(CLANG)
// If this fails TestMediaQueryListListener does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestMediaQueryListListener), TestMediaQueryListListener_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestMediaQueryListListener), "TestMediaQueryListListener is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -234,7 +234,7 @@
#if COMPILER(CLANG)
// If this fails TestNamedConstructor does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestNamedConstructor), TestNamedConstructor_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestNamedConstructor), "TestNamedConstructor is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -495,7 +495,7 @@
#if COMPILER(CLANG)
// If this fails TestNondeterministic does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestNondeterministic), TestNondeterministic_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestNondeterministic), "TestNondeterministic is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -169,6 +169,102 @@
const char expectedEnumerationValuesOptional[] = "\"\", \"OptionalValue1\", \"OptionalValue2\", \"OptionalValue3\"";
+#if ENABLE(Condition1)
+
+JSString* jsStringWithCache(ExecState*, TestEnumA);
+Optional<TestEnumA> parseTestEnumA(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestEnumA[];
+
+JSString* jsStringWithCache(ExecState* state, TestEnumA enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral("A"),
+ };
+ static_assert(static_cast<size_t>(TestEnumA::A) == 0, "TestEnumA::A is not 0 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<TestEnumA> {
+ static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumA value) { return jsStringWithCache(state, value); }
+};
+
+Optional<TestEnumA> parseTestEnumA(ExecState& state, JSValue value)
+{
+ auto stringValue = value.toWTFString(&state);
+ if (stringValue == "A")
+ return TestEnumA::A;
+ return Nullopt;
+}
+
+const char expectedEnumerationValuesTestEnumA[] = "\"A\"";
+
+#endif
+
+#if ENABLE(Condition1) && ENABLE(Condition2)
+
+JSString* jsStringWithCache(ExecState*, TestEnumB);
+Optional<TestEnumB> parseTestEnumB(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestEnumB[];
+
+JSString* jsStringWithCache(ExecState* state, TestEnumB enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral("B"),
+ };
+ static_assert(static_cast<size_t>(TestEnumB::B) == 0, "TestEnumB::B is not 0 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<TestEnumB> {
+ static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumB value) { return jsStringWithCache(state, value); }
+};
+
+Optional<TestEnumB> parseTestEnumB(ExecState& state, JSValue value)
+{
+ auto stringValue = value.toWTFString(&state);
+ if (stringValue == "B")
+ return TestEnumB::B;
+ return Nullopt;
+}
+
+const char expectedEnumerationValuesTestEnumB[] = "\"B\"";
+
+#endif
+
+#if ENABLE(Condition1) || ENABLE(Condition2)
+
+JSString* jsStringWithCache(ExecState*, TestEnumC);
+Optional<TestEnumC> parseTestEnumC(ExecState&, JSValue);
+extern const char expectedEnumerationValuesTestEnumC[];
+
+JSString* jsStringWithCache(ExecState* state, TestEnumC enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral("C"),
+ };
+ static_assert(static_cast<size_t>(TestEnumC::C) == 0, "TestEnumC::C is not 0 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<TestEnumC> {
+ static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, TestEnumC value) { return jsStringWithCache(state, value); }
+};
+
+Optional<TestEnumC> parseTestEnumC(ExecState& state, JSValue value)
+{
+ auto stringValue = value.toWTFString(&state);
+ if (stringValue == "C")
+ return TestEnumC::C;
+ return Nullopt;
+}
+
+const char expectedEnumerationValuesTestEnumC[] = "\"C\"";
+
+#endif
+
// Functions
#if ENABLE(TEST_FEATURE)
@@ -585,22 +681,21 @@
{ "testStaticPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException), (intptr_t) (0) } },
};
-
#if ENABLE(Condition1)
-COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants);
+static_assert(TestObj::CONDITIONAL_CONST == 0, "CONDITIONAL_CONST in TestObj does not match value from IDL");
#endif
-COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
-COMPILE_ASSERT(0 == TestObj::readonly, TestObjEnumreadonlyIsWrongUseDoNotCheckConstants);
+static_assert(TestObj::CONST_VALUE_0 == 0, "CONST_VALUE_0 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_1 == 1, "CONST_VALUE_1 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_2 == 2, "CONST_VALUE_2 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_4 == 4, "CONST_VALUE_4 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_8 == 8, "CONST_VALUE_8 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_9 == -1, "CONST_VALUE_9 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_11 == 0xffffffff, "CONST_VALUE_11 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_12 == 0x01, "CONST_VALUE_12 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_13 == 0X20, "CONST_VALUE_13 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_VALUE_14 == 0x1abc, "CONST_VALUE_14 in TestObj does not match value from IDL");
+static_assert(TestObj::CONST_IMPL == 15, "CONST_IMPL in TestObj does not match value from IDL");
+static_assert(TestObj::readonly == 0, "readonly in TestObj does not match value from IDL");
template<> EncodedJSValue JSC_HOST_CALL JSTestObjConstructor::construct(ExecState* state)
{
@@ -5810,7 +5905,7 @@
#if COMPILER(CLANG)
// If this fails TestObj does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestObj), TestObj_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestObj), "TestObj is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -270,7 +270,7 @@
#if COMPILER(CLANG)
// If this fails TestOverloadedConstructors does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestOverloadedConstructors), TestOverloadedConstructors_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestOverloadedConstructors), "TestOverloadedConstructors is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -253,7 +253,7 @@
#if COMPILER(CLANG)
// If this fails TestOverrideBuiltins does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestOverrideBuiltins), TestOverrideBuiltins_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestOverrideBuiltins), "TestOverrideBuiltins is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -329,7 +329,7 @@
#if COMPILER(CLANG)
// If this fails TestSerializedScriptValueInterface does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestSerializedScriptValueInterface), TestSerializedScriptValueInterface_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestSerializedScriptValueInterface), "TestSerializedScriptValueInterface is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -682,7 +682,7 @@
#if COMPILER(CLANG)
// If this fails TestTypedefs does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
+ static_assert(__is_polymorphic(TestTypedefs), "TestTypedefs is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -227,7 +227,7 @@
#if COMPILER(CLANG)
// If this fails attribute does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(attribute), attribute_is_not_polymorphic);
+ static_assert(__is_polymorphic(attribute), "attribute is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -172,7 +172,7 @@
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
// attribute to readonly.
- COMPILE_ASSERT(!__is_polymorphic(readonly), readonly_is_polymorphic_but_idl_claims_not_to_be);
+ static_assert(!__is_polymorphic(readonly), "readonly is polymorphic but the IDL claims it is not");
#endif
return createNewWrapper<JSreadonly>(globalObject, impl);
}
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200293 => 200294)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-04-30 20:26:35 UTC (rev 200294)
@@ -35,6 +35,10 @@
// Leading underscore on an enum should be removed.
enum _optional { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" };
+[Conditional=Condition1] enum TestEnumA { "A" };
+[Conditional=Condition1&Condition2] enum TestEnumB { "B" };
+[Conditional=Condition1|Condition2] enum TestEnumC { "C" };
+
[
Constructor(TestCallback testCallback, TestCallbackFunction testCallbackFunction),
InterfaceName=TestObject
Modified: trunk/Source/WebCore/testing/Internals.cpp (200293 => 200294)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-04-30 20:26:35 UTC (rev 200294)
@@ -563,23 +563,25 @@
return link.sheet() && link.sheet()->contents().isLoadingSubresources();
}
-static ResourceRequestCachePolicy stringToResourceRequestCachePolicy(const String& policy)
+static ResourceRequestCachePolicy toResourceRequestCachePolicy(InternalsCachePolicy policy)
{
- if (policy == "UseProtocolCachePolicy")
+ switch (policy) {
+ case InternalsCachePolicy::UseProtocolCachePolicy:
return UseProtocolCachePolicy;
- if (policy == "ReloadIgnoringCacheData")
+ case InternalsCachePolicy::ReloadIgnoringCacheData:
return ReloadIgnoringCacheData;
- if (policy == "ReturnCacheDataElseLoad")
+ case InternalsCachePolicy::ReturnCacheDataElseLoad:
return ReturnCacheDataElseLoad;
- if (policy == "ReturnCacheDataDontLoad")
+ case InternalsCachePolicy::ReturnCacheDataDontLoad:
return ReturnCacheDataDontLoad;
+ }
ASSERT_NOT_REACHED();
return UseProtocolCachePolicy;
}
-void Internals::setOverrideCachePolicy(const String& policy)
+void Internals::setOverrideCachePolicy(InternalsCachePolicy policy)
{
- frame()->loader().setOverrideCachePolicyForTesting(stringToResourceRequestCachePolicy(policy));
+ frame()->loader().setOverrideCachePolicyForTesting(toResourceRequestCachePolicy(policy));
}
void Internals::setCanShowModalDialogOverride(bool allow, ExceptionCode& ec)
@@ -592,25 +594,27 @@
contextDocument()->domWindow()->setCanShowModalDialogOverride(allow);
}
-static ResourceLoadPriority stringToResourceLoadPriority(const String& policy)
+static ResourceLoadPriority toResourceLoadPriority(InternalsResourceLoadPriority priority)
{
- if (policy == "ResourceLoadPriorityVeryLow")
+ switch (priority) {
+ case InternalsResourceLoadPriority::ResourceLoadPriorityVeryLow:
return ResourceLoadPriority::VeryLow;
- if (policy == "ResourceLoadPriorityLow")
+ case InternalsResourceLoadPriority::ResourceLoadPriorityLow:
return ResourceLoadPriority::Low;
- if (policy == "ResourceLoadPriorityMedium")
+ case InternalsResourceLoadPriority::ResourceLoadPriorityMedium:
return ResourceLoadPriority::Medium;
- if (policy == "ResourceLoadPriorityHigh")
+ case InternalsResourceLoadPriority::ResourceLoadPriorityHigh:
return ResourceLoadPriority::High;
- if (policy == "ResourceLoadPriorityVeryHigh")
+ case InternalsResourceLoadPriority::ResourceLoadPriorityVeryHigh:
return ResourceLoadPriority::VeryHigh;
+ }
ASSERT_NOT_REACHED();
return ResourceLoadPriority::Low;
}
-void Internals::setOverrideResourceLoadPriority(const String& priority)
+void Internals::setOverrideResourceLoadPriority(InternalsResourceLoadPriority priority)
{
- frame()->loader().setOverrideResourceLoadPriorityForTesting(stringToResourceLoadPriority(priority));
+ frame()->loader().setOverrideResourceLoadPriorityForTesting(toResourceLoadPriority(priority));
}
void Internals::setStrictRawResourceValidationPolicyDisabled(bool disabled)
@@ -1214,24 +1218,25 @@
element.setAutoFilled(enabled);
}
-static AutoFillButtonType stringToAutoFillButtonType(const String& autoFillButtonType)
+static AutoFillButtonType toAutoFillButtonType(InternalsAutoFillButtonType type)
{
- if (autoFillButtonType == "AutoFillButtonTypeNone")
+ switch (type) {
+ case InternalsAutoFillButtonType::AutoFillButtonTypeNone:
return AutoFillButtonType::None;
- if (autoFillButtonType == "AutoFillButtonTypeCredentials")
+ case InternalsAutoFillButtonType::AutoFillButtonTypeCredentials:
return AutoFillButtonType::Credentials;
- if (autoFillButtonType == "AutoFillButtonTypeContacts")
+ case InternalsAutoFillButtonType::AutoFillButtonTypeContacts:
return AutoFillButtonType::Contacts;
+ }
ASSERT_NOT_REACHED();
return AutoFillButtonType::None;
}
-void Internals::setShowAutoFillButton(HTMLInputElement& element, const String& autoFillButtonType)
+void Internals::setShowAutoFillButton(HTMLInputElement& element, InternalsAutoFillButtonType type)
{
- element.setShowAutoFillButton(stringToAutoFillButtonType(autoFillButtonType));
+ element.setShowAutoFillButton(toAutoFillButtonType(type));
}
-
void Internals::scrollElementToRect(Element& element, int x, int y, int w, int h, ExceptionCode& ec)
{
FrameView* frameView = element.document().view();
@@ -2909,28 +2914,16 @@
#if ENABLE(MEDIA_SESSION)
-static MediaSessionInterruptingCategory interruptingCategoryFromString(const String& interruptingCategoryString)
+void Internals::sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory category)
{
- if (interruptingCategoryString == "content")
- return MediaSessionInterruptingCategory::Content;
- if (interruptingCategoryString == "transient")
- return MediaSessionInterruptingCategory::Transient;
- if (interruptingCategoryString == "transient-solo")
- return MediaSessionInterruptingCategory::TransientSolo;
- ASSERT_NOT_REACHED();
- return MediaSessionInterruptingCategory::Content;
+ MediaSessionManager::singleton().didReceiveStartOfInterruptionNotification(category);
}
-void Internals::sendMediaSessionStartOfInterruptionNotification(const String& interruptingCategoryString)
+void Internals::sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory category)
{
- MediaSessionManager::singleton().didReceiveStartOfInterruptionNotification(interruptingCategoryFromString(interruptingCategoryString));
+ MediaSessionManager::singleton().didReceiveEndOfInterruptionNotification(category);
}
-void Internals::sendMediaSessionEndOfInterruptionNotification(const String& interruptingCategoryString)
-{
- MediaSessionManager::singleton().didReceiveEndOfInterruptionNotification(interruptingCategoryFromString(interruptingCategoryString));
-}
-
String Internals::mediaSessionCurrentState(MediaSession* session) const
{
switch (session->currentState()) {
@@ -2949,16 +2942,20 @@
return element->playerVolume();
}
-void Internals::sendMediaControlEvent(const String& event)
+void Internals::sendMediaControlEvent(MediaControlEvent event)
{
- if (event == "play-pause")
+ // FIXME: No good reason to use a single function with an argument instead of three functions.
+ switch (event) {
+ case MediControlEvent::PlayPause:
MediaSessionManager::singleton().togglePlayback();
- else if (event == "next-track")
+ break;
+ case MediControlEvent::NextTrack:
MediaSessionManager::singleton().skipToNextTrack();
- else if (event == "previous-track")
+ break;
+ case MediControlEvent::PreviousTrack:
MediaSessionManager::singleton().skipToPreviousTrack();
- else
- ASSERT_NOT_REACHED();
+ break;
+ }
}
#endif // ENABLE(MEDIA_SESSION)
@@ -3034,7 +3031,7 @@
#endif
-RefPtr<MockPageOverlay> Internals::installMockPageOverlay(const String& overlayType, ExceptionCode& ec)
+RefPtr<MockPageOverlay> Internals::installMockPageOverlay(PageOverlayType type, ExceptionCode& ec)
{
Document* document = contextDocument();
if (!document || !document->frame()) {
@@ -3042,7 +3039,7 @@
return nullptr;
}
- return MockPageOverlayClient::singleton().installOverlay(document->frame()->mainFrame(), overlayType == "view" ? PageOverlay::OverlayType::View : PageOverlay::OverlayType::Document);
+ return MockPageOverlayClient::singleton().installOverlay(document->frame()->mainFrame(), type == PageOverlayType::View ? PageOverlay::OverlayType::View : PageOverlay::OverlayType::Document);
}
String Internals::pageOverlayLayerTreeAsText(ExceptionCode& ec) const
Modified: trunk/Source/WebCore/testing/Internals.h (200293 => 200294)
--- trunk/Source/WebCore/testing/Internals.h 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/testing/Internals.h 2016-04-30 20:26:35 UTC (rev 200294)
@@ -28,6 +28,7 @@
#include "CSSComputedStyleDeclaration.h"
#include "ContextDestructionObserver.h"
+#include "MediaSessionInterruptionProvider.h"
#include "PageConsoleClient.h"
#include <runtime/Float32Array.h>
@@ -36,8 +37,6 @@
class AudioContext;
class ClientRect;
class ClientRectList;
-class DOMPath;
-class DOMStringList;
class DOMURL;
class DOMWindow;
class Document;
@@ -56,12 +55,10 @@
class MemoryInfo;
class MockContentFilterSettings;
class MockPageOverlay;
-class Node;
class NodeList;
class Page;
class Range;
class RenderedDocumentMarker;
-class ScriptExecutionContext;
class SerializedScriptValue;
class SourceBuffer;
class TimeRanges;
@@ -70,6 +67,12 @@
typedef int ExceptionCode;
+enum class InternalsAutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials };
+enum class InternalsCachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad };
+enum class InternalsResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh };
+enum class MediaControlEvent { PlayPause, NextTrack, PreviousTrack };
+enum class PageOverlayType { View, Document };
+
class Internals final : public RefCounted<Internals>, private ContextDestructionObserver {
public:
static Ref<Internals> create(Document&);
@@ -88,11 +91,11 @@
bool isPreloaded(const String& url);
bool isLoadingFromMemoryCache(const String& url);
String xhrResponseSource(XMLHttpRequest&);
- bool isSharingStyleSheetContents(HTMLLinkElement& a, HTMLLinkElement& b);
+ bool isSharingStyleSheetContents(HTMLLinkElement&, HTMLLinkElement&);
bool isStyleSheetLoadingSubresources(HTMLLinkElement&);
- void setOverrideCachePolicy(const String&);
+ void setOverrideCachePolicy(InternalsCachePolicy);
void setCanShowModalDialogOverride(bool allow, ExceptionCode&);
- void setOverrideResourceLoadPriority(const String&);
+ void setOverrideResourceLoadPriority(InternalsResourceLoadPriority);
void setStrictRawResourceValidationPolicyDisabled(bool);
void clearMemoryCache();
@@ -169,7 +172,7 @@
bool elementShouldAutoComplete(HTMLInputElement&);
void setEditingValue(HTMLInputElement&, const String&);
void setAutofilled(HTMLInputElement&, bool enabled);
- void setShowAutoFillButton(HTMLInputElement&, const String& autoFillButtonType);
+ void setShowAutoFillButton(HTMLInputElement&, InternalsAutoFillButtonType);
void scrollElementToRect(Element&, int x, int y, int w, int h, ExceptionCode&);
String autofillFieldName(Element&, ExceptionCode&);
@@ -410,11 +413,11 @@
#endif
#if ENABLE(MEDIA_SESSION)
- void sendMediaSessionStartOfInterruptionNotification(const String&);
- void sendMediaSessionEndOfInterruptionNotification(const String&);
+ void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory);
+ void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory);
String mediaSessionCurrentState(MediaSession&) const;
double mediaElementPlayerVolume(HTMLMediaElement&) const;
- void sendMediaControlEvent(const String&);
+ void sendMediaControlEvent(MediaControlEvent);
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
@@ -429,7 +432,7 @@
void simulateSystemSleep() const;
void simulateSystemWake() const;
- RefPtr<MockPageOverlay> installMockPageOverlay(const String& overlayType, ExceptionCode&);
+ RefPtr<MockPageOverlay> installMockPageOverlay(PageOverlayType, ExceptionCode&);
String pageOverlayLayerTreeAsText(ExceptionCode&) const;
void setPageMuted(bool);
Modified: trunk/Source/WebCore/testing/Internals.idl (200293 => 200294)
--- trunk/Source/WebCore/testing/Internals.idl 2016-04-30 20:05:13 UTC (rev 200293)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-04-30 20:26:35 UTC (rev 200294)
@@ -30,14 +30,15 @@
};
// These map to ResourceRequestCachePolicy.
-enum CachePolicy {
+enum InternalsCachePolicy {
"UseProtocolCachePolicy",
"ReloadIgnoringCacheData",
"ReturnCacheDataElseLoad",
"ReturnCacheDataDontLoad"
};
-enum ResourceLoadPriority {
+// FIXME: Strings in an enum should not have the name of the enum as a prefix.
+enum InternalsResourceLoadPriority {
"ResourceLoadPriorityVeryLow",
"ResourceLoadPriorityLow",
"ResourceLoadPriorityMedium",
@@ -45,19 +46,20 @@
"ResourceLoadPriorityVeryHigh"
};
-enum MediaSessionInterruptingCategory {
+[Conditional=MEDIA_SESSION] enum MediaSessionInterruptingCategory {
"content",
"transient",
"transient-solo"
};
-enum MediaControlEvent {
+[Conditional=MEDIA_SESSION] enum MediaControlEvent {
"play-pause",
"next-track",
"previous-track"
};
-enum AutoFillButtonType {
+// FIXME: Strings in an enum should not have the name of the enum as a prefix.
+enum InternalsAutoFillButtonType {
"AutoFillButtonTypeNone",
"AutoFillButtonTypeContacts",
"AutoFillButtonTypeCredentials"
@@ -84,8 +86,8 @@
void clearMemoryCache();
void pruneMemoryCacheToSize(long size);
long memoryCacheSize();
- void setOverrideCachePolicy(CachePolicy policy);
- void setOverrideResourceLoadPriority(ResourceLoadPriority priority);
+ void setOverrideCachePolicy(InternalsCachePolicy policy);
+ void setOverrideResourceLoadPriority(InternalsResourceLoadPriority priority);
void setStrictRawResourceValidationPolicyDisabled(boolean disabled);
void clearPageCache();
@@ -157,7 +159,7 @@
boolean elementShouldAutoComplete(HTMLInputElement inputElement);
void setEditingValue(HTMLInputElement inputElement, DOMString value);
void setAutofilled(HTMLInputElement inputElement, boolean enabled);
- void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
+ void setShowAutoFillButton(HTMLInputElement inputElement, InternalsAutoFillButtonType autoFillButtonType);
[RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
[RaisesException] DOMString autofillFieldName(Element formControlElement);