Changeset 202752 in webkit


Ignore:
Timestamp:
Jul 1, 2016 1:49:31 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-07-01
Reviewed by Mark Lam.

Source/JavaScriptCore:

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.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202750 r202752  
     12016-07-01  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] Date.toGMTString should be the Date.toUTCString function
     4        https://bugs.webkit.org/show_bug.cgi?id=159318
     5
     6        Reviewed by Mark Lam.
     7
     8        * js/date-prototype-expected.txt: Added.
     9        * js/date-prototype.html: Added.
     10        * js/script-tests/date-prototype.js: Added.
     11
    1122016-07-01  Frederic Wang  <fwang@igalia.com>
    213
  • trunk/LayoutTests/js/kde/inbuilt_function_tostring-expected.txt

    r12913 r202752  
    9898PASS StripSpaces(Date.prototype.getFullYear.toString()) is "functiongetFullYear(){[nativecode]}"
    9999PASS StripSpaces(Date.prototype.getUTCFullYear.toString()) is "functiongetUTCFullYear(){[nativecode]}"
    100 PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoGMTString(){[nativecode]}"
     100PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoUTCString(){[nativecode]}"
    101101PASS StripSpaces(Date.prototype.getMonth.toString()) is "functiongetMonth(){[nativecode]}"
    102102PASS StripSpaces(Date.prototype.getUTCMonth.toString()) is "functiongetUTCMonth(){[nativecode]}"
     
    131131PASS StripSpaces(Date.prototype.setYear.toString()) is "functionsetYear(){[nativecode]}"
    132132PASS StripSpaces(Date.prototype.getYear.toString()) is "functiongetYear(){[nativecode]}"
    133 PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoGMTString(){[nativecode]}"
     133PASS StripSpaces(Date.prototype.toGMTString.toString()) is "functiontoUTCString(){[nativecode]}"
    134134PASS StripSpaces(RegExp.prototype.exec.toString()) is "functionexec(){[nativecode]}"
    135135PASS StripSpaces(RegExp.prototype.test.toString()) is "functiontest(){[nativecode]}"
  • trunk/LayoutTests/js/kde/script-tests/inbuilt_function_tostring.js

    r98407 r202752  
    130130shouldBe("StripSpaces(Date.prototype.getFullYear.toString())","\"functiongetFullYear(){[nativecode]}\"");
    131131shouldBe("StripSpaces(Date.prototype.getUTCFullYear.toString())","\"functiongetUTCFullYear(){[nativecode]}\"");
    132 shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoGMTString(){[nativecode]}\"");
     132shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoUTCString(){[nativecode]}\"");
    133133shouldBe("StripSpaces(Date.prototype.getMonth.toString())","\"functiongetMonth(){[nativecode]}\"");
    134134shouldBe("StripSpaces(Date.prototype.getUTCMonth.toString())","\"functiongetUTCMonth(){[nativecode]}\"");
     
    163163shouldBe("StripSpaces(Date.prototype.setYear.toString())","\"functionsetYear(){[nativecode]}\"");
    164164shouldBe("StripSpaces(Date.prototype.getYear.toString())","\"functiongetYear(){[nativecode]}\"");
    165 shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoGMTString(){[nativecode]}\"");
     165shouldBe("StripSpaces(Date.prototype.toGMTString.toString())","\"functiontoUTCString(){[nativecode]}\"");
    166166
    167167shouldBe("StripSpaces(RegExp.prototype.exec.toString())","\"functionexec(){[nativecode]}\"");
  • trunk/Source/JavaScriptCore/ChangeLog

    r202737 r202752  
     12016-07-01  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        [JSC] Date.toGMTString should be the Date.toUTCString function
     4        https://bugs.webkit.org/show_bug.cgi?id=159318
     5
     6        Reviewed by Mark Lam.
     7
     8        See https://tc39.github.io/ecma262/#sec-date.prototype.togmtstring
     9
     10        * runtime/DatePrototype.cpp:
     11        (JSC::DatePrototype::finishCreation):
     12        (JSC::dateProtoFuncToGMTString): Deleted.
     13
    1142016-07-01  Mark Lam  <mark.lam@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp

    r202683 r202752  
    108108EncodedJSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState*);
    109109EncodedJSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState*);
    110 EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState*);
    111110EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState*);
    112111EncodedJSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState*);
     
    434433  toString              dateProtoFuncToString                DontEnum|Function       0
    435434  toISOString           dateProtoFuncToISOString             DontEnum|Function       0
    436   toUTCString           dateProtoFuncToUTCString             DontEnum|Function       0
    437435  toDateString          dateProtoFuncToDateString            DontEnum|Function       0
    438436  toTimeString          dateProtoFuncToTimeString            DontEnum|Function       0
     
    444442  getFullYear           dateProtoFuncGetFullYear             DontEnum|Function       0
    445443  getUTCFullYear        dateProtoFuncGetUTCFullYear          DontEnum|Function       0
    446   toGMTString           dateProtoFuncToGMTString             DontEnum|Function       0
    447444  getMonth              dateProtoFuncGetMonth                DontEnum|Function       0
    448445  getUTCMonth           dateProtoFuncGetUTCMonth             DontEnum|Function       0
     
    493490    ASSERT(inherits(info()));
    494491
     492    Identifier toUTCStringName = Identifier::fromString(&vm, ASCIILiteral("toUTCString"));
     493    JSFunction* toUTCStringFunction = JSFunction::create(vm, globalObject, 0, toUTCStringName.string(), dateProtoFuncToUTCString);
     494    putDirectWithoutTransition(vm, toUTCStringName, toUTCStringFunction, DontEnum);
     495    putDirectWithoutTransition(vm, Identifier::fromString(&vm, ASCIILiteral("toGMTString")), toUTCStringFunction, DontEnum);
     496
    495497#if ENABLE(INTL)
    496498    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("toLocaleString", datePrototypeToLocaleStringCodeGenerator, DontEnum);
     
    651653        return JSValue::encode(jsNaN());
    652654    return JSValue::encode(jsNumber(gregorianDateTime->year()));
    653 }
    654 
    655 EncodedJSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec)
    656 {
    657     const bool asUTCVariant = true;
    658     return formateDateInstance(exec, DateTimeFormatDateAndTime, asUTCVariant);
    659655}
    660656
Note: See TracChangeset for help on using the changeset viewer.