Title: [202752] trunk
Revision
202752
Author
[email protected]
Date
2016-07-01 13:49:31 -0700 (Fri, 01 Jul 2016)

Log Message

[JSC] Date.toGMTString should be the Date.toUTCString function
https://bugs.webkit.org/show_bug.cgi?id=159318

Patch by Benjamin Poulain <[email protected]> on 2016-07-01
Reviewed by Mark Lam.

Source/_javascript_Core:

See https://tc39.github.io/ecma262/#sec-date.prototype.togmtstring

* runtime/DatePrototype.cpp:
(JSC::DatePrototype::finishCreation):
(JSC::dateProtoFuncToGMTString): Deleted.

LayoutTests:

* js/date-prototype-expected.txt: Added.
* js/date-prototype.html: Added.
* js/script-tests/date-prototype.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202751 => 202752)


--- trunk/LayoutTests/ChangeLog	2016-07-01 20:46:14 UTC (rev 202751)
+++ trunk/LayoutTests/ChangeLog	2016-07-01 20:49:31 UTC (rev 202752)
@@ -1,3 +1,14 @@
+2016-07-01  Benjamin Poulain  <[email protected]>
+
+        [JSC] Date.toGMTString should be the Date.toUTCString function
+        https://bugs.webkit.org/show_bug.cgi?id=159318
+
+        Reviewed by Mark Lam.
+
+        * js/date-prototype-expected.txt: Added.
+        * js/date-prototype.html: Added.
+        * js/script-tests/date-prototype.js: Added.
+
 2016-07-01  Frederic Wang  <[email protected]>
 
         Rebaseline some MathML tests.

Added: trunk/LayoutTests/js/date-prototype-expected.txt (0 => 202752)


--- trunk/LayoutTests/js/date-prototype-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/date-prototype-expected.txt	2016-07-01 20:49:31 UTC (rev 202752)
@@ -0,0 +1,16 @@
+Check the Date's prototype properties.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Date.prototype.toGMTString is Date.prototype.toUTCString
+PASS Date.prototype.toUTCString.name is "toUTCString"
+PASS Date.prototype.toUTCString.length is 0
+PASS typeof Date.prototype.toUTCString is "function"
+PASS Object.getOwnPropertyDescriptor(Date.prototype, "toUTCString").configurable is true
+PASS Object.getOwnPropertyDescriptor(Date.prototype, "toUTCString").enumerable is false
+PASS Object.getOwnPropertyDescriptor(Date.prototype, "toUTCString").writable is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/date-prototype.html (0 => 202752)


--- trunk/LayoutTests/js/date-prototype.html	                        (rev 0)
+++ trunk/LayoutTests/js/date-prototype.html	2016-07-01 20:49:31 UTC (rev 202752)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/js/kde/inbuilt_function_tostring-expected.txt (202751 => 202752)


--- trunk/LayoutTests/js/kde/inbuilt_function_tostring-expected.txt	2016-07-01 20:46:14 UTC (rev 202751)
+++ trunk/LayoutTests/js/kde/inbuilt_function_tostring-expected.txt	2016-07-01 20:49:31 UTC (rev 202752)
@@ -97,7 +97,7 @@
 PASS StripSpaces(Date.prototype.getTime.toString()) is "functiongetTime(){[nativecode]}"
 PASS StripSpaces(Date.prototype.getFullYear.toString()) is "functiongetFullYear(){[nativecode]}"
 PASS StripSpaces(Date.prototype.getUTCFullYear.toString()) is "functiongetUTCFullYear(){[nativecode]}"
-PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoGMTString(){[nativecode]}"
+PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoUTCString(){[nativecode]}"
 PASS StripSpaces(Date.prototype.getMonth.toString()) is "functiongetMonth(){[nativecode]}"
 PASS StripSpaces(Date.prototype.getUTCMonth.toString()) is "functiongetUTCMonth(){[nativecode]}"
 PASS StripSpaces(Date.prototype.getDate.toString()) is "functiongetDate(){[nativecode]}"
@@ -130,7 +130,7 @@
 PASS StripSpaces(Date.prototype.setUTCFullYear.toString()) is "functionsetUTCFullYear(){[nativecode]}"
 PASS StripSpaces(Date.prototype.setYear.toString()) is "functionsetYear(){[nativecode]}"
 PASS StripSpaces(Date.prototype.getYear.toString()) is "functiongetYear(){[nativecode]}"
-PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoGMTString(){[nativecode]}"
+PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoUTCString(){[nativecode]}"
 PASS StripSpaces(RegExp.prototype.exec.toString()) is "functionexec(){[nativecode]}"
 PASS StripSpaces(RegExp.prototype.test.toString()) is "functiontest(){[nativecode]}"
 PASS StripSpaces(RegExp.prototype.toString.toString()) is "functiontoString(){[nativecode]}"

Modified: trunk/LayoutTests/js/kde/script-tests/inbuilt_function_tostring.js (202751 => 202752)


--- trunk/LayoutTests/js/kde/script-tests/inbuilt_function_tostring.js	2016-07-01 20:46:14 UTC (rev 202751)
+++ trunk/LayoutTests/js/kde/script-tests/inbuilt_function_tostring.js	2016-07-01 20:49:31 UTC (rev 202752)
@@ -129,7 +129,7 @@
 shouldBe("StripSpaces(Date.prototype.getTime.toString())","\"functiongetTime(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.getFullYear.toString())","\"functiongetFullYear(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.getUTCFullYear.toString())","\"functiongetUTCFullYear(){[nativecode]}\"");
-shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoGMTString(){[nativecode]}\"");
+shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoUTCString(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.getMonth.toString())","\"functiongetMonth(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.getUTCMonth.toString())","\"functiongetUTCMonth(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.getDate.toString())","\"functiongetDate(){[nativecode]}\"");
@@ -162,7 +162,7 @@
 shouldBe("StripSpaces(Date.prototype.setUTCFullYear.toString())","\"functionsetUTCFullYear(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.setYear.toString())","\"functionsetYear(){[nativecode]}\"");
 shouldBe("StripSpaces(Date.prototype.getYear.toString())","\"functiongetYear(){[nativecode]}\"");
-shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoGMTString(){[nativecode]}\"");
+shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoUTCString(){[nativecode]}\"");
 
 shouldBe("StripSpaces(RegExp.prototype.exec.toString())","\"functionexec(){[nativecode]}\"");
 shouldBe("StripSpaces(RegExp.prototype.test.toString())","\"functiontest(){[nativecode]}\"");

Added: trunk/LayoutTests/js/script-tests/date-prototype.js (0 => 202752)


--- trunk/LayoutTests/js/script-tests/date-prototype.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/date-prototype.js	2016-07-01 20:49:31 UTC (rev 202752)
@@ -0,0 +1,12 @@
+description("Check the Date's prototype properties.");
+
+// toGMTString.
+shouldBe('Date.prototype.toGMTString', 'Date.prototype.toUTCString');
+
+// toUTCString.
+shouldBeEqualToString('Date.prototype.toUTCString.name', 'toUTCString');
+shouldBe('Date.prototype.toUTCString.length', '0');
+shouldBeEqualToString('typeof Date.prototype.toUTCString', 'function');
+shouldBeTrue('Object.getOwnPropertyDescriptor(Date.prototype, "toUTCString").configurable');
+shouldBeFalse('Object.getOwnPropertyDescriptor(Date.prototype, "toUTCString").enumerable');
+shouldBeTrue('Object.getOwnPropertyDescriptor(Date.prototype, "toUTCString").writable');

Modified: trunk/Source/_javascript_Core/ChangeLog (202751 => 202752)


--- trunk/Source/_javascript_Core/ChangeLog	2016-07-01 20:46:14 UTC (rev 202751)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-07-01 20:49:31 UTC (rev 202752)
@@ -1,3 +1,16 @@
+2016-07-01  Benjamin Poulain  <[email protected]>
+
+        [JSC] Date.toGMTString should be the Date.toUTCString function
+        https://bugs.webkit.org/show_bug.cgi?id=159318
+
+        Reviewed by Mark Lam.
+
+        See https://tc39.github.io/ecma262/#sec-date.prototype.togmtstring
+
+        * runtime/DatePrototype.cpp:
+        (JSC::DatePrototype::finishCreation):
+        (JSC::dateProtoFuncToGMTString): Deleted.
+
 2016-07-01  Mark Lam  <[email protected]>
 
         Update JSC_functionOverrides to handle the new SourceCode strings that have params.

Modified: trunk/Source/_javascript_Core/runtime/DatePrototype.cpp (202751 => 202752)


--- trunk/Source/_javascript_Core/runtime/DatePrototype.cpp	2016-07-01 20:46:14 UTC (rev 202751)
+++ trunk/Source/_javascript_Core/runtime/DatePrototype.cpp	2016-07-01 20:49:31 UTC (rev 202752)
@@ -107,7 +107,6 @@
 EncodedJSValue JSC_HOST_CALL dateProtoFuncSetUTCSeconds(ExecState*);
 EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
 EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
-EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
 EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
 EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
 EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState*);
@@ -433,7 +432,6 @@
 @begin dateTable
   toString              dateProtoFuncToString                DontEnum|Function       0
   toISOString           dateProtoFuncToISOString             DontEnum|Function       0
-  toUTCString           dateProtoFuncToUTCString             DontEnum|Function       0
   toDateString          dateProtoFuncToDateString            DontEnum|Function       0
   toTimeString          dateProtoFuncToTimeString            DontEnum|Function       0
   toLocaleString        dateProtoFuncToLocaleString          DontEnum|Function       0
@@ -443,7 +441,6 @@
   getTime               dateProtoFuncGetTime                 DontEnum|Function       0
   getFullYear           dateProtoFuncGetFullYear             DontEnum|Function       0
   getUTCFullYear        dateProtoFuncGetUTCFullYear          DontEnum|Function       0
-  toGMTString           dateProtoFuncToGMTString             DontEnum|Function       0
   getMonth              dateProtoFuncGetMonth                DontEnum|Function       0
   getUTCMonth           dateProtoFuncGetUTCMonth             DontEnum|Function       0
   getDate               dateProtoFuncGetDate                 DontEnum|Function       0
@@ -492,6 +489,11 @@
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
 
+    Identifier toUTCStringName = Identifier::fromString(&vm, ASCIILiteral("toUTCString"));
+    JSFunction* toUTCStringFunction = JSFunction::create(vm, globalObject, 0, toUTCStringName.string(), dateProtoFuncToUTCString);
+    putDirectWithoutTransition(vm, toUTCStringName, toUTCStringFunction, DontEnum);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, ASCIILiteral("toGMTString")), toUTCStringFunction, DontEnum);
+
 #if ENABLE(INTL)
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("toLocaleString", datePrototypeToLocaleStringCodeGenerator, DontEnum);
     JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("toLocaleDateString", datePrototypeToLocaleDateStringCodeGenerator, DontEnum);
@@ -652,12 +654,6 @@
     return JSValue::encode(jsNumber(gregorianDateTime->year()));
 }
 
-EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
-{
-    const bool asUTCVariant = true;
-    return formateDateInstance(exec, DateTimeFormatDateAndTime, asUTCVariant);
-}
-
 EncodedJSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec)
 {
     JSValue thisValue = exec->thisValue();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to