Changeset 50377 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Oct 30, 2009, 7:11:21 PM (16 years ago)
Author:
[email protected]
Message:

Fixed failing layout test: restore a special case I accidentally deleted.

Patch by Geoffrey Garen <[email protected]> on 2009-10-30
Reviewed by Oliver Hunt.

  • runtime/DatePrototype.cpp:

(JSC::setNewValueFromDateArgs): In the case of applying a change to a date
that is NaN, reset the date to 0 *and* then apply the change; don't just
reset the date to 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/DatePrototype.cpp

    r50361 r50377  
    861861   
    862862    double milli = thisDateObj->internalNumber();
    863     if (numArgsToUse == 3 && isnan(milli)) {
    864         JSValue result = jsNumber(exec, 0);
    865         thisDateObj->setInternalValue(result);
    866         return result;
     863    double ms = 0;
     864
     865    GregorianDateTime gregorianDateTime;
     866    if (numArgsToUse == 3 && isnan(milli))
     867        WTF::msToGregorianDateTime(0, true, gregorianDateTime);
     868    else {
     869        ms = milli - floor(milli / msPerSecond) * msPerSecond;
     870        const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec, inputIsUTC);
     871        if (!other)
     872            return jsNaN(exec);
     873        gregorianDateTime.copyFrom(*other);
    867874    }
    868 
    869     const GregorianDateTime* other = thisDateObj->gregorianDateTime(exec, inputIsUTC);
    870     if (!other)
    871         return jsNaN(exec);
    872 
    873     GregorianDateTime gregorianDateTime;
    874     gregorianDateTime.copyFrom(*other);
    875    
    876     double ms = milli - floor(milli / msPerSecond) * msPerSecond;
     875   
    877876    if (!fillStructuresUsingDateArgs(exec, args, numArgsToUse, &ms, &gregorianDateTime)) {
    878877        JSValue result = jsNaN(exec);
Note: See TracChangeset for help on using the changeset viewer.