Changeset 10680 in webkit


Ignore:
Timestamp:
Sep 30, 2005 10:55:29 AM (19 years ago)
Author:
thatcher
Message:

Merges fixes from TOT to Safari-2-0-branch

2005-09-29 Geoffrey Garen <ggaren@apple.com>

  • Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed: Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com

Reviewed by mjs.

  • kjs/date_object.cpp: (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified, just rely on the fallback logic, which will do it for you. Also, return invalidDate if the date includes trailing garbage. (Somewhat accidentally, the timezone logic used to catch trailing garbage.)
Location:
branches/Safari-2-0-branch/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Safari-2-0-branch/JavaScriptCore/ChangeLog

    r10656 r10680  
     12005-09-30  Timothy Hatcher  <timothy@apple.com>
     2
     3            Merges fixes from TOT to Safari-2-0-branch
     4
     5    2005-09-29  Geoffrey Garen  <ggaren@apple.com>
     6
     7                - Second cut at fixing <rdar://problem/4275206> Denver Regression: Seed:
     8                Past Editions of Opinions display "NAN/Undefined" for www.washingtonpost.com
     9
     10        Reviewed by mjs.
     11
     12        * kjs/date_object.cpp:
     13        (KJS::KRFCDate_parseDate): Intead of creating a timezone when one isn't specified,
     14        just rely on the fallback logic, which will do it for you. Also, return invalidDate
     15        if the date includes trailing garbage. (Somewhat accidentally, the timezone logic
     16        used to catch trailing garbage.)
     17
    118=== JavaScriptCore-417 ===
    219
  • branches/Safari-2-0-branch/JavaScriptCore/kjs/date_object.cpp

    r10656 r10680  
    10371037     //
    10381038     double result = -1;
    1039      long offset = 0;
     1039     int offset = 0;
    10401040     bool have_tz = false;
    10411041     char *newPosStr;
     
    12481248     }
    12491249
     1250     // Don't fail if the time zone is missing.
     1251     // Some websites omit the time zone (4275206).
    12501252     if (*dateString) {
    12511253       if (strncasecmp(dateString, "GMT", 3) == 0 ||
     
    12861288           if (0 == strncasecmp(dateString, known_zones[i].tzName, strlen(known_zones[i].tzName))) {
    12871289             offset = known_zones[i].tzOffset;
     1290             dateString += strlen(known_zones[i].tzName);
    12881291             have_tz = true;
    12891292             break;
    12901293           }
    12911294         }
    1292          // If the time zone is missing or malformed, substitute the local time zone.
    1293          // Some websites (4275206) omit the time zone.
    1294          if (!have_tz) {
    1295            time_t now;
    1296            struct tm t;
    1297            
    1298            time(&now);
    1299            if (now == -1)
    1300              return invalidDate;
    1301            
    1302            localtime_r(&now, &t);
    1303            offset = -timeZoneOffset(&t);
    1304            
    1305            have_tz = true;
    1306          }
    13071295       }
    13081296     }
     
    13151303       if (errno)
    13161304         return invalidDate;
     1305       dateString = newPosStr;
    13171306     }
     1307     
     1308     while (isspace(*dateString))
     1309       dateString++;
     1310     
     1311     // Trailing garbage
     1312     if (*dateString != '\0')
     1313       return invalidDate;
    13181314
    13191315     // Y2K: Solve 2 digit years
     
    13241320         year += 1900;  // Y2K
    13251321
     1322     // fall back to midnight, local timezone
    13261323     if (!have_tz) {
    1327        // fall back to midnight, local timezone
    13281324       struct tm t;
    13291325       memset(&t, 0, sizeof(tm));
     
    13421338     }
    13431339     
    1344      result = ymdhms_to_seconds(year, month+1, day, hour, minute, second) - (offset * 60);
     1340     result = ymdhms_to_seconds(year, month + 1, day, hour, minute, second) - (offset * 60);
    13451341     return result;
    13461342}
Note: See TracChangeset for help on using the changeset viewer.