Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (200287 => 200288)
--- trunk/Source/_javascript_Core/ChangeLog 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-04-30 05:09:10 UTC (rev 200288)
@@ -1,3 +1,13 @@
+2016-04-28 Darin Adler <[email protected]>
+
+ First step in using "enum class" instead of "String" for enumerations in DOM
+ https://bugs.webkit.org/show_bug.cgi?id=157163
+
+ Reviewed by Chris Dumez.
+
+ * runtime/JSString.h:
+ (JSC::jsStringWithCache): Deleted unneeded overload for AtomicString.
+
2016-04-29 Benjamin Poulain <[email protected]>
[JSC][ARMv7S] Arithmetic module results change when tiering up to DFG
Modified: trunk/Source/_javascript_Core/runtime/JSString.h (200287 => 200288)
--- trunk/Source/_javascript_Core/runtime/JSString.h 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/_javascript_Core/runtime/JSString.h 2016-04-30 05:09:10 UTC (rev 200288)
@@ -653,11 +653,6 @@
return jsStringWithCacheSlowCase(vm, *stringImpl);
}
-ALWAYS_INLINE JSString* jsStringWithCache(ExecState* exec, const AtomicString& s)
-{
- return jsStringWithCache(exec, s.string());
-}
-
ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
if (propertyName == exec->propertyNames().length) {
Modified: trunk/Source/WebCore/ChangeLog (200287 => 200288)
--- trunk/Source/WebCore/ChangeLog 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/ChangeLog 2016-04-30 05:09:10 UTC (rev 200288)
@@ -1,3 +1,70 @@
+2016-04-28 Darin Adler <[email protected]>
+
+ First step in using "enum class" instead of "String" for enumerations in DOM
+ https://bugs.webkit.org/show_bug.cgi?id=157163
+
+ Reviewed by Chris Dumez.
+
+ This patch adds the basic support for using "enum class" to implement enumerations
+ in the C++ DOM. This is enough so we can use it for one case, but not enough for
+ others. For example, it correctly generates code to get an attribute, but likely
+ does not correctly generate code to set an attribute or call a function with an
+ argument type that is the new style of enum.
+
+ * bindings/scripts/CodeGenerator.pm: Cleaned up the formatting of the hashes
+ at the start of this file. Added a new one named stringBasedEnumerationHash
+ and a comment explaining that we need to eventually make it empty.
+ (ProcessDocument): Pass the enumerations into the GenerateInterface function.
+ (IsStringBasedEnumType): Added. Returns 1 for the old-style string-based enumerations,
+ as opposed to enumerations we use "enum class" for.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateInterface): Take the enumerations argument and pass it along to the
+ functions that generate headers and implementation files.
+ (EnumerationClassName): Added. Maps from an enumeration type name as seen
+ in the IDL file to the enumeration class name used in the C++ DOM implementation.
+ (EnumerationValueName): Added. Maps from an anumeration string value as seen
+ in the IDL file to an enumeration value name used in the C++ DOM implementatino.
+ (EnumerationImplementationContent): Added. Generates a string with all the content
+ needed in the implementation file to define the helper functions for enumerations.
+ (GenerateHeader): Tweak.
+ (GenerateImplementation): Added call to EnumerationImplementationContent.
+ (GenerateParametersCheck): Use toWTFString instead of toString/value, which is a
+ longer way of writing out the same thing.
+ (GenerateCallbackHeader): Tweak.
+ (GenerateCallbackImplementation): Added call to EnumerationImplementationContent.
+ (GetNativeType): Continue to return String for string-based enum types, but for
+ other enum types, return the result of EnumerationClassName instead.
+ (JSValueToNative): Use toWTFString instead of toString/value (see above), convert
+ to a string only for string-based enum types, and add a preliminary, probably not
+ yet working, version of the code for non-string-based enum types. Will finish this
+ in the next patch when we are trying to use one of the new enumerations for a setter
+ or a function argument.
+ (NativeToJSValue): Call the stringValue function to convert an enumeration value
+ into a string when it's not a string-based enumeration.
+
+ * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+ * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
+ * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+ * bindings/scripts/test/JS/JSTestNode.cpp:
+ * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/JS/JSTestObj.h:
+ * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+ * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ Regenerated.
+
+ * css/FontFace.cpp:
+ (WebCore::FontFace::status): Updated to return enum values rather than strings.
+
+ * css/FontFace.h: Removed unneeded forward declaration of Deprecated::ScriptValue.
+ Added enum class for FontFaceLoadStatus, with names that match the names from the
+ enumeration in the IDL, but with our standard enum capitalization style. Changed
+ the return value of the status function to FontFaceLoadStatus.
+
2016-04-29 Chris Dumez <[email protected]>
Get rid of unnecessary null check in wrap(JSDOMGlobalObject*, DOMClass*)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-04-30 05:09:10 UTC (rev 200288)
@@ -44,33 +44,55 @@
my $verbose = 0;
-my %numericTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1,
- "unsigned int" => 1, "unsigned short" => 1,
- "unsigned long" => 1, "unsigned long long" => 1,
- "float" => 1, "double" => 1,
- "unrestricted float" => 1, "unrestricted double" => 1,
- "byte" => 1, "octet" => 1);
+my %numericTypeHash = (
+ "byte" => 1,
+ "double" => 1,
+ "float" => 1,
+ "int" => 1,
+ "long long" => 1,
+ "long" => 1,
+ "octet" => 1,
+ "short" => 1,
+ "unrestricted double" => 1,
+ "unrestricted float" => 1,
+ "unsigned int" => 1,
+ "unsigned long long" => 1,
+ "unsigned long" => 1,
+ "unsigned short" => 1,
+);
-my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1);
+my %primitiveTypeHash = ( "boolean" => 1, "void" => 1, "Date" => 1 );
-my %stringTypeHash = ("DOMString" => 1);
+my %stringTypeHash = ( "DOMString" => 1 );
# WebCore types used directly in IDL files.
my %webCoreTypeHash = (
+ "Dictionary" => 1,
"SerializedScriptValue" => 1,
- "Dictionary" => 1
);
my %enumTypeHash = ();
-my %nonPointerTypeHash = ("DOMTimeStamp" => 1);
+my %nonPointerTypeHash = ( "DOMTimeStamp" => 1 );
-my %svgAttributesInHTMLHash = ("class" => 1, "id" => 1, "onabort" => 1, "onclick" => 1,
- "onerror" => 1, "onload" => 1, "onmousedown" => 1,
- "onmouseenter" => 1, "onmouseleave" => 1,
- "onmousemove" => 1, "onmouseout" => 1, "onmouseover" => 1,
- "onmouseup" => 1, "onresize" => 1, "onscroll" => 1,
- "onunload" => 1);
+my %svgAttributesInHTMLHash = (
+ "class" => 1,
+ "id" => 1,
+ "onabort" => 1,
+ "onclick" => 1,
+ "onerror" => 1,
+ "onload" => 1,
+ "onmousedown" => 1,
+ "onmouseenter" => 1,
+ "onmouseleave" => 1,
+ "onmousemove" => 1,
+ "onmouseout" => 1,
+ "onmouseover" => 1,
+ "onmouseup" => 1,
+ "onresize" => 1,
+ "onscroll" => 1,
+ "onunload" => 1,
+);
my %svgTypeNeedingTearOff = (
"SVGAngle" => "SVGPropertyTearOff<SVGAngle>",
@@ -94,6 +116,48 @@
"SVGMatrix" => 1
);
+# FIXME: Remove each enum from this hash as we convert it from the string-based
+# 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 = (
+ "AppendMode" => 1,
+ "AudioContextState" => 1,
+ "AutoFillButtonType" => 1,
+ "CachePolicy" => 1,
+ "CanvasWindingRule" => 1,
+ "DeviceType" => 1,
+ "EndOfStreamError" => 1,
+ "FontFaceSetLoadStatus" => 1,
+ "IDBCursorDirection" => 1,
+ "IDBRequestReadyState" => 1,
+ "IDBTransactionMode" => 1,
+ "ImageSmoothingQuality" => 1,
+ "KeyType" => 1,
+ "KeyUsage" => 1,
+ "MediaControlEvent" => 1,
+ "MediaDeviceKind" => 1,
+ "MediaSessionInterruptingCategory" => 1,
+ "MediaSessionKind" => 1,
+ "MediaStreamTrackState" => 1,
+ "OverSampleType" => 1,
+ "PageOverlayType" => 1,
+ "RTCBundlePolicyEnum" => 1,
+ "RTCIceTransportPolicyEnum" => 1,
+ "ReferrerPolicy" => 1,
+ "RequestCache" => 1,
+ "RequestCredentials" => 1,
+ "RequestDestination" => 1,
+ "RequestMode" => 1,
+ "RequestRedirect" => 1,
+ "RequestType" => 1,
+ "ResourceLoadPriority" => 1,
+ "ResponseType" => 1,
+ "TextTrackKind" => 1,
+ "TextTrackMode" => 1,
+ "VideoPresentationMode" => 1,
+ "XMLHttpRequestResponseType" => 1,
+);
+
# Cache of IDL file pathnames.
my $idlFiles;
my $cachedInterfaces = {};
@@ -141,7 +205,9 @@
my $interfaces = $useDocument->interfaces;
foreach my $interface (@$interfaces) {
print "Generating $useGenerator bindings code for IDL interface \"" . $interface->name . "\"...\n" if $verbose;
- $codeGenerator->GenerateInterface($interface, $defines);
+ # FIXME: Repeating each enumeration for every interface would not work if we actually were using
+ # multiple interfaces per file, but we aren't, so this is fine for now.
+ $codeGenerator->GenerateInterface($interface, $defines, $useDocument->enumerations);
$codeGenerator->WriteData($interface, $useOutputDir, $useOutputHeadersDir);
}
}
@@ -335,6 +401,16 @@
return 0;
}
+sub IsStringBasedEnumType
+{
+ my $object = shift;
+ my $type = shift;
+
+ return 0 if !$object->IsEnumType($type);
+ return 1 if exists $stringBasedEnumerationHash{$type};
+ return 0;
+}
+
sub IsEnumType
{
my $object = shift;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-30 05:09:10 UTC (rev 200288)
@@ -123,16 +123,17 @@
my $object = shift;
my $interface = shift;
my $defines = shift;
+ my $enumerations = shift;
$codeGenerator->LinkOverloadedFunctions($interface);
# Start actual generation
if ($interface->isCallback) {
$object->GenerateCallbackHeader($interface);
- $object->GenerateCallbackImplementation($interface);
+ $object->GenerateCallbackImplementation($interface, $enumerations);
} else {
$object->GenerateHeader($interface);
- $object->GenerateImplementation($interface);
+ $object->GenerateImplementation($interface, $enumerations);
}
}
@@ -830,10 +831,73 @@
return $name;
}
+sub GetEnumerationClassName {
+ my ($name) = @_;
+ return $codeGenerator->WK_ucfirst($name);
+};
+
+sub GetEnumerationValueName {
+ my ($name) = @_;
+ return "EmptyString" if $name eq "";
+ return $codeGenerator->WK_ucfirst($name);
+};
+
+sub GetEnumerationImplementationContent
+{
+ my ($enumerations) = @_;
+
+ my $result = "";
+ foreach my $enumeration (@$enumerations) {
+ my $name = $enumeration->name;
+ next if $codeGenerator->IsStringBasedEnumType($name);
+
+ my $className = GetEnumerationClassName($name);
+
+ # Declare these instead of using "static" because these functions may be unused
+ # and we don't want to get warnings about unused static functions.
+ $result .= "const String& stringValue($className);\n";
+ $result .= "Optional<$className> enumerationValue$className(const String&);\n\n";
+
+ $result .= "const String& stringValue($className enumerationValue)\n";
+ $result .= "{\n";
+ # FIXME: Might be nice to make this global be "const", but NeverDestroyed does not currently support that.
+ # FIXME: Might be nice to make the entire array be NeverDestroyed instead of each value, but not sure the syntax for that.
+ $result .= " static NeverDestroyed<const String> values[] = {\n";
+ foreach my $value (@{$enumeration->values}) {
+ $result .= " ASCIILiteral(\"$value\"),\n";
+ }
+ $result .= " };\n";
+ my $index = 0;
+ foreach my $value (@{$enumeration->values}) {
+ my $enumerationValueName = GetEnumerationValueName($value);
+ if ($index) {
+ $result .= " static_assert(static_cast<size_t>($className::$enumerationValueName) == $index, \"$className::$enumerationValueName is not $index as expected\");\n";
+ } else {
+ # Keep the style checker happy. Not sure I still love this style guideline.
+ $result .= " static_assert(!static_cast<size_t>($className::$enumerationValueName), \"$className::$enumerationValueName is not $index as expected\");\n";
+ }
+ $index++;
+ }
+ $result .= " ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));\n";
+ $result .= " return values[static_cast<size_t>(enumerationValue)];\n";
+ $result .= "}\n\n";
+
+ $result .= "Optional<$className> enumerationValue$className(const String& stringValue)\n";
+ $result .= "{\n";
+ foreach my $value (@{$enumeration->values}) {
+ my $enumerationValueName = GetEnumerationValueName($value);
+ $result .= " if (stringValue == \"$value\")\n";
+ $result .= " return $className::$enumerationValueName;\n";
+ }
+ $result .= " return Nullopt;\n";
+ $result .= "}\n\n";
+ }
+ return $result;
+}
+
sub GenerateHeader
{
- my $object = shift;
- my $interface = shift;
+ my ($object, $interface) = @_;
my $interfaceName = $interface->name;
my $className = "JS$interfaceName";
@@ -1796,7 +1860,7 @@
sub GenerateImplementation
{
- my ($object, $interface) = @_;
+ my ($object, $interface, $enumerations) = @_;
my $interfaceName = $interface->name;
my $className = "JS$interfaceName";
@@ -1828,6 +1892,8 @@
push(@implContent, "\nusing namespace JSC;\n\n");
push(@implContent, "namespace WebCore {\n\n");
+ push(@implContent, GetEnumerationImplementationContent($enumerations));
+
my @functions = @{$interface->functions};
push(@functions, @{$interface->iterable->functions}) if $interface->iterable;
@@ -3602,7 +3668,7 @@
push(@$outputArray, " if (${argValue}.isUndefined())\n");
push(@$outputArray, " $name = ASCIILiteral(" . $parameter->default . ");\n");
push(@$outputArray, " else {\n");
- push(@$outputArray, " $name = state->uncheckedArgument($argsIndex).toString(state)->value(state);\n");
+ push(@$outputArray, " $name = state->uncheckedArgument($argsIndex).toWTFString(state);\n");
&$exceptionCheck(" ");
&$enumValueCheck(" ");
push(@$outputArray, " }\n");
@@ -3721,8 +3787,7 @@
sub GenerateCallbackHeader
{
- my $object = shift;
- my $interface = shift;
+ my ($object, $interface) = @_;
my $interfaceName = $interface->name;
my $className = "JS$interfaceName";
@@ -3806,7 +3871,7 @@
sub GenerateCallbackImplementation
{
- my ($object, $interface) = @_;
+ my ($object, $interface, $enumerations) = @_;
my $interfaceName = $interface->name;
my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
@@ -3823,6 +3888,8 @@
push(@implContent, "\nusing namespace JSC;\n\n");
push(@implContent, "namespace WebCore {\n\n");
+ push(@implContent, GetEnumerationImplementationContent($enumerations));
+
# Constructor
push(@implContent, "${className}::${className}(JSObject* callback, JSDOMGlobalObject* globalObject)\n");
if ($interface->extendedAttributes->{"CallbackNeedsOperatorEqual"}) {
@@ -4179,7 +4246,8 @@
my $arrayOrSequenceType = $arrayType || $sequenceType;
return "Vector<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">" if $arrayOrSequenceType;
- return "String" if $codeGenerator->IsEnumType($type);
+ return "String" if $codeGenerator->IsStringBasedEnumType($type);
+ return GetEnumerationClassName($type) if $codeGenerator->IsEnumType($type);
# For all other types, the native type is a pointer with same type name as the IDL type.
return "${type}*";
@@ -4296,7 +4364,7 @@
return "valueToStringWithUndefinedOrNullCheck(state, $value)" if $signature->isNullable;
return "$value.toString(state)->toAtomicString(state)" if $signature->extendedAttributes->{"AtomicString"};
- return "$value.toString(state)->value(state)";
+ return "$value.toWTFString(state)";
}
if ($type eq "any") {
@@ -4342,8 +4410,11 @@
return "toNativeArray<" . GetNativeVectorInnerType($arrayOrSequenceType) . ">(state, $value)";
}
+ return "$value.toWTFString(state)" if $codeGenerator->IsStringBasedEnumType($type);
+
if ($codeGenerator->IsEnumType($type)) {
- return "$value.toString(state)->value(state)";
+ my $className = GetEnumerationClassName($type);
+ return "enumerationValue$className($value.toWTFString(state)).value()";
}
# Default, assume autogenerated type conversion routines
@@ -4394,6 +4465,7 @@
if ($codeGenerator->IsEnumType($type)) {
AddToImplIncludes("<runtime/JSString.h>", $conditional);
+ $value = "stringValue($value)" unless $codeGenerator->IsStringBasedEnumType($type);
return "jsStringWithCache(state, $value)";
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -222,7 +222,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String message = state->argument(0).toString(state)->value(state);
+ String message = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.postMessage(message);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -193,7 +193,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String str = state->argument(0).toString(state)->value(state);
+ String str = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.anotherFunction(str);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -214,7 +214,7 @@
return throwSetterTypeError(*state, "TestGlobalObject", "regularAttribute");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setRegularAttribute(nativeValue);
@@ -232,7 +232,7 @@
return throwSetterTypeError(*state, "TestGlobalObject", "enabledAtRuntimeAttribute");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setEnabledAtRuntimeAttribute(nativeValue);
@@ -256,7 +256,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String testParam = state->argument(0).toString(state)->value(state);
+ String testParam = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.regularOperation(testParam);
@@ -274,7 +274,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String testParam = state->argument(0).toString(state)->value(state);
+ String testParam = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.enabledAtRuntimeOperation(testParam);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -228,10 +228,10 @@
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
- String str1 = state->argument(0).toString(state)->value(state);
+ String str1 = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toString(state)->value(state);
+ String str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
ScriptExecutionContext* context = castedThis->scriptExecutionContext();
@@ -632,7 +632,7 @@
bool setJSTestInterfaceConstructorImplementsStaticAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
TestInterface::setImplementsStaticAttr(nativeValue);
@@ -651,7 +651,7 @@
return throwSetterTypeError(*state, "TestInterface", "implementsStr2");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setImplementsStr2(nativeValue);
@@ -698,7 +698,7 @@
bool setJSTestInterfaceConstructorSupplementalStaticAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
WebCore::TestSupplemental::setSupplementalStaticAttr(nativeValue);
@@ -717,7 +717,7 @@
return throwSetterTypeError(*state, "TestInterface", "supplementalStr2");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
WebCore::TestSupplemental::setSupplementalStr2(impl, nativeValue);
@@ -795,7 +795,7 @@
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
if (!context)
return JSValue::encode(jsUndefined());
- String strArg = state->argument(0).toString(state)->value(state);
+ String strArg = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(1));
@@ -863,7 +863,7 @@
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
if (!context)
return JSValue::encode(jsUndefined());
- String strArg = state->argument(0).toString(state)->value(state);
+ String strArg = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(1));
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -86,13 +86,13 @@
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
- String str1 = state->argument(0).toString(state)->value(state);
+ String str1 = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toString(state)->value(state);
+ String str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String str3 = state->argument(2).isUndefined() ? String() : state->uncheckedArgument(2).toString(state)->value(state);
+ String str3 = state->argument(2).isUndefined() ? String() : state->uncheckedArgument(2).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
RefPtr<TestNamedConstructor> object = TestNamedConstructor::createForJSConstructor(*castedThis->document(), str1, str2, str3, ec);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -165,7 +165,7 @@
return throwSetterTypeError(*state, "TestNode", "name");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setName(nativeValue);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -352,7 +352,7 @@
return throwSetterTypeError(*state, "TestNondeterministic", "nondeterministicWriteableAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setNondeterministicWriteableAttr(nativeValue);
@@ -369,7 +369,7 @@
return throwSetterTypeError(*state, "TestNondeterministic", "nondeterministicExceptionAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setNondeterministicExceptionAttr(nativeValue);
@@ -386,7 +386,7 @@
return throwSetterTypeError(*state, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setNondeterministicGetterExceptionAttr(nativeValue);
@@ -404,7 +404,7 @@
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setNondeterministicSetterExceptionAttr(nativeValue, ec);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -89,6 +89,70 @@
namespace WebCore {
+const String& stringValue(TestEnumType);
+Optional<TestEnumType> enumerationValueTestEnumType(const String&);
+
+const String& stringValue(TestEnumType enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral(""),
+ ASCIILiteral("EnumValue1"),
+ ASCIILiteral("EnumValue2"),
+ ASCIILiteral("EnumValue3"),
+ };
+ static_assert(!static_cast<size_t>(TestEnumType::EmptyString), "TestEnumType::EmptyString is not 0 as expected");
+ static_assert(static_cast<size_t>(TestEnumType::EnumValue1) == 1, "TestEnumType::EnumValue1 is not 1 as expected");
+ static_assert(static_cast<size_t>(TestEnumType::EnumValue2) == 2, "TestEnumType::EnumValue2 is not 2 as expected");
+ static_assert(static_cast<size_t>(TestEnumType::EnumValue3) == 3, "TestEnumType::EnumValue3 is not 3 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return values[static_cast<size_t>(enumerationValue)];
+}
+
+Optional<TestEnumType> enumerationValueTestEnumType(const String& stringValue)
+{
+ if (stringValue == "")
+ return TestEnumType::EmptyString;
+ if (stringValue == "EnumValue1")
+ return TestEnumType::EnumValue1;
+ if (stringValue == "EnumValue2")
+ return TestEnumType::EnumValue2;
+ if (stringValue == "EnumValue3")
+ return TestEnumType::EnumValue3;
+ return Nullopt;
+}
+
+const String& stringValue(Optional);
+Optional<Optional> enumerationValueOptional(const String&);
+
+const String& stringValue(Optional enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral(""),
+ ASCIILiteral("OptionalValue1"),
+ ASCIILiteral("OptionalValue2"),
+ ASCIILiteral("OptionalValue3"),
+ };
+ static_assert(!static_cast<size_t>(Optional::EmptyString), "Optional::EmptyString is not 0 as expected");
+ static_assert(static_cast<size_t>(Optional::OptionalValue1) == 1, "Optional::OptionalValue1 is not 1 as expected");
+ static_assert(static_cast<size_t>(Optional::OptionalValue2) == 2, "Optional::OptionalValue2 is not 2 as expected");
+ static_assert(static_cast<size_t>(Optional::OptionalValue3) == 3, "Optional::OptionalValue3 is not 3 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return values[static_cast<size_t>(enumerationValue)];
+}
+
+Optional<Optional> enumerationValueOptional(const String& stringValue)
+{
+ if (stringValue == "")
+ return Optional::EmptyString;
+ if (stringValue == "OptionalValue1")
+ return Optional::OptionalValue1;
+ if (stringValue == "OptionalValue2")
+ return Optional::OptionalValue2;
+ if (stringValue == "OptionalValue3")
+ return Optional::OptionalValue3;
+ return Nullopt;
+}
+
// Functions
#if ENABLE(TEST_FEATURE)
@@ -990,7 +1054,7 @@
return throwGetterTypeError(*state, "TestObj", "enumAttr");
}
auto& impl = castedThis->wrapped();
- JSValue result = jsStringWithCache(state, impl.enumAttr());
+ JSValue result = jsStringWithCache(state, stringValue(impl.enumAttr()));
return JSValue::encode(result);
}
@@ -2147,7 +2211,7 @@
return throwGetterTypeError(*state, "TestObj", "attributeWithReservedEnumType");
}
auto& impl = castedThis->wrapped();
- JSValue result = jsStringWithCache(state, impl.attributeWithReservedEnumType());
+ JSValue result = jsStringWithCache(state, stringValue(impl.attributeWithReservedEnumType()));
return JSValue::encode(result);
}
@@ -2205,7 +2269,7 @@
bool setJSTestObjConstructorStaticStringAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
JSValue value = JSValue::decode(encodedValue);
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
TestObj::setStaticStringAttr(nativeValue);
@@ -2235,7 +2299,7 @@
return throwSetterTypeError(*state, "TestObj", "enumAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ TestEnumType nativeValue = enumerationValueTestEnumType(value.toWTFString(state)).value();
if (UNLIKELY(state->hadException()))
return false;
if (nativeValue != "" && nativeValue != "EnumValue1" && nativeValue != "EnumValue2" && nativeValue != "EnumValue3")
@@ -2407,7 +2471,7 @@
return throwSetterTypeError(*state, "TestObj", "stringAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttr(nativeValue);
@@ -2509,7 +2573,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedStringAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectedstringattrAttr, nativeValue);
@@ -2577,7 +2641,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedURLAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::reflectedurlattrAttr, nativeValue);
@@ -2594,7 +2658,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedStringAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::customContentStringAttrAttr, nativeValue);
@@ -2645,7 +2709,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedCustomURLAttr");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttributeWithoutSynchronization(WebCore::HTMLNames::customContentURLAttrAttr, nativeValue);
@@ -2663,7 +2727,7 @@
return throwSetterTypeError(*state, "TestObj", "enabledAtRuntimeAttribute");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setEnabledAtRuntimeAttribute(nativeValue);
@@ -2770,7 +2834,7 @@
return throwSetterTypeError(*state, "TestObj", "stringAttrWithGetterException");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttrWithGetterException(nativeValue);
@@ -2788,7 +2852,7 @@
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttrWithSetterException(nativeValue, ec);
@@ -3302,7 +3366,7 @@
return throwSetterTypeError(*state, "TestObj", "attributeWithReservedEnumType");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ Optional nativeValue = enumerationValueOptional(value.toWTFString(state)).value();
if (UNLIKELY(state->hadException()))
return false;
if (nativeValue != "" && nativeValue != "OptionalValue1" && nativeValue != "OptionalValue2" && nativeValue != "OptionalValue3")
@@ -3322,7 +3386,7 @@
}
Ref<TestNode> forwardedImpl = castedThis->wrapped().putForwardsAttribute();
auto& impl = forwardedImpl.get();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setName(nativeValue);
@@ -3342,7 +3406,7 @@
if (!forwardedImpl)
return false;
auto& impl = *forwardedImpl;
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setName(nativeValue);
@@ -3375,7 +3439,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String testParam = state->argument(0).toString(state)->value(state);
+ String testParam = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.enabledAtRuntimeOperation(testParam);
@@ -3447,7 +3511,7 @@
int longArg = toInt32(state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String strArg = state->argument(1).toString(state)->value(state);
+ String strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
@@ -3484,7 +3548,7 @@
int8_t byteArg = toInt8(state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String strArg = state->argument(1).toString(state)->value(state);
+ String strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
@@ -3521,7 +3585,7 @@
uint8_t octetArg = toUInt8(state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String strArg = state->argument(1).toString(state)->value(state);
+ String strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
@@ -3558,7 +3622,7 @@
int longArg = toInt32(state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String strArg = state->argument(1).toString(state)->value(state);
+ String strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
@@ -3595,7 +3659,7 @@
int longArg = toInt32(state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String strArg = state->argument(1).toString(state)->value(state);
+ String strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(2));
@@ -3738,7 +3802,7 @@
if (state->argument(0).isUndefined())
enumArg = ASCIILiteral("EnumValue1");
else {
- enumArg = state->uncheckedArgument(0).toString(state)->value(state);
+ enumArg = state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
if (enumArg != "" && enumArg != "EnumValue1" && enumArg != "EnumValue2" && enumArg != "EnumValue3")
@@ -3759,7 +3823,7 @@
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
- String strArg = state->argument(0).toString(state)->value(state);
+ String strArg = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj* objArg = JSTestObj::toWrapped(state->argument(1));
@@ -3868,7 +3932,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String argument = state->argument(0).toString(state)->value(state);
+ String argument = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsStringWithCache(state, impl.privateMethod(argument));
@@ -4140,7 +4204,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalString");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- String str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toString(state)->value(state);
+ String str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalString(str);
@@ -4170,7 +4234,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringAndDefaultValue");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- String str = state->argument(0).isUndefined() ? ASCIILiteral("foo") : state->uncheckedArgument(0).toString(state)->value(state);
+ String str = state->argument(0).isUndefined() ? ASCIILiteral("foo") : state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalStringAndDefaultValue(str);
@@ -4200,7 +4264,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsNull");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- String str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toString(state)->value(state);
+ String str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalStringIsNull(str);
@@ -4215,7 +4279,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsUndefined");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- String str = state->argument(0).toString(state)->value(state);
+ String str = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalStringIsUndefined(str);
@@ -4245,7 +4309,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsEmptyString");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- String str = state->argument(0).isUndefined() ? emptyString() : state->uncheckedArgument(0).toString(state)->value(state);
+ String str = state->argument(0).isUndefined() ? emptyString() : state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalStringIsEmptyString(str);
@@ -4668,7 +4732,7 @@
TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String strArg = state->argument(1).toString(state)->value(state);
+ String strArg = state->argument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(objArg, strArg);
@@ -4705,7 +4769,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String strArg = state->argument(0).toString(state)->value(state);
+ String strArg = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(strArg);
@@ -4843,7 +4907,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String strArg = state->argument(0).toString(state)->value(state);
+ String strArg = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(strArg);
@@ -4997,7 +5061,7 @@
{
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String type = state->argument(0).toString(state)->value(state);
+ String type = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj::overloadedMethod1(type);
@@ -5225,7 +5289,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String value = state->argument(0).toString(state)->value(state);
+ String value = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.convert3(value);
@@ -5296,7 +5360,7 @@
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
- String str = state->argument(0).toString(state)->value(state);
+ String str = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
float a = state->argument(1).toFloat(state);
@@ -5375,7 +5439,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String head = state->argument(0).toString(state)->value(state);
+ String head = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
Vector<String> tail = toNativeArguments<String>(state, 1);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -110,7 +110,7 @@
auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(state->callee());
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String string = state->argument(0).toString(state)->value(state);
+ String string = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(string);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -200,7 +200,7 @@
return throwThisTypeError(*state, "TestOverrideBuiltins", "namedItem");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestOverrideBuiltins::info());
auto& impl = castedThis->wrapped();
- String name = state->argument(0).isUndefined() ? ASCIILiteral("test") : state->uncheckedArgument(0).toString(state)->value(state);
+ String name = state->argument(0).isUndefined() ? ASCIILiteral("test") : state->uncheckedArgument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.namedItem(name)));
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (200287 => 200288)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -128,7 +128,7 @@
auto* castedThis = jsCast<JSTestTypedefsConstructor*>(state->callee());
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- String hello = state->argument(0).toString(state)->value(state);
+ String hello = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isObject()))
@@ -423,7 +423,7 @@
return throwSetterTypeError(*state, "TestTypedefs", "stringAttrWithGetterException");
}
auto& impl = castedThis->wrapped();
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttrWithGetterException(nativeValue);
@@ -441,7 +441,7 @@
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
- String nativeValue = value.toString(state)->value(state);
+ String nativeValue = value.toWTFString(state);
if (UNLIKELY(state->hadException()))
return false;
impl.setStringAttrWithSetterException(nativeValue, ec);
@@ -489,7 +489,7 @@
float blur = state->argument(2).toFloat(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- String color = state->argument(3).isUndefined() ? String() : state->uncheckedArgument(3).toString(state)->value(state);
+ String color = state->argument(3).isUndefined() ? String() : state->uncheckedArgument(3).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
Optional<float> alpha = state->argument(4).isUndefined() ? Optional<float>() : state->uncheckedArgument(4).toFloat(state);
Modified: trunk/Source/WebCore/css/FontFace.cpp (200287 => 200288)
--- trunk/Source/WebCore/css/FontFace.cpp 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/css/FontFace.cpp 2016-04-30 05:09:10 UTC (rev 200288)
@@ -317,22 +317,22 @@
return list->cssText();
}
-String FontFace::status() const
+FontFaceLoadStatus FontFace::status() const
{
switch (m_backing->status()) {
case CSSFontFace::Status::Pending:
- return String("unloaded", String::ConstructFromLiteral);
+ return FontFaceLoadStatus::Unloaded;
case CSSFontFace::Status::Loading:
- return String("loading", String::ConstructFromLiteral);
+ return FontFaceLoadStatus::Loading;
case CSSFontFace::Status::TimedOut:
- return String("error", String::ConstructFromLiteral);
+ return FontFaceLoadStatus::Error;
case CSSFontFace::Status::Success:
- return String("loaded", String::ConstructFromLiteral);
+ return FontFaceLoadStatus::Loaded;
case CSSFontFace::Status::Failure:
- return String("error", String::ConstructFromLiteral);
+ return FontFaceLoadStatus::Error;
}
ASSERT_NOT_REACHED();
- return String("error", String::ConstructFromLiteral);
+ return FontFaceLoadStatus::Error;
}
void FontFace::fontStateChanged(CSSFontFace& face, CSSFontFace::Status, CSSFontFace::Status newState)
Modified: trunk/Source/WebCore/css/FontFace.h (200287 => 200288)
--- trunk/Source/WebCore/css/FontFace.h 2016-04-30 04:51:31 UTC (rev 200287)
+++ trunk/Source/WebCore/css/FontFace.h 2016-04-30 05:09:10 UTC (rev 200288)
@@ -36,16 +36,14 @@
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>
-namespace Deprecated {
-class ScriptValue;
-}
-
namespace WebCore {
class CSSFontFace;
class CSSValue;
class Dictionary;
+enum class FontFaceLoadStatus { Unloaded, Loading, Loaded, Error };
+
class FontFace final : public RefCounted<FontFace>, public CSSFontFace::Client {
public:
static RefPtr<FontFace> create(JSC::ExecState&, ScriptExecutionContext&, const String& family, JSC::JSValue source, const Dictionary& descriptors, ExceptionCode&);
@@ -67,7 +65,7 @@
String unicodeRange() const;
String variant() const;
String featureSettings() const;
- String status() const;
+ FontFaceLoadStatus status() const;
typedef DOMPromise<FontFace&, DOMCoreException&> Promise;
Promise& promise() { return m_promise; }