Changeset 10680 in webkit
- Timestamp:
- Sep 30, 2005 10:55:29 AM (19 years ago)
- Location:
- branches/Safari-2-0-branch/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Safari-2-0-branch/JavaScriptCore/ChangeLog
r10656 r10680 1 2005-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 1 18 === JavaScriptCore-417 === 2 19 -
branches/Safari-2-0-branch/JavaScriptCore/kjs/date_object.cpp
r10656 r10680 1037 1037 // 1038 1038 double result = -1; 1039 longoffset = 0;1039 int offset = 0; 1040 1040 bool have_tz = false; 1041 1041 char *newPosStr; … … 1248 1248 } 1249 1249 1250 // Don't fail if the time zone is missing. 1251 // Some websites omit the time zone (4275206). 1250 1252 if (*dateString) { 1251 1253 if (strncasecmp(dateString, "GMT", 3) == 0 || … … 1286 1288 if (0 == strncasecmp(dateString, known_zones[i].tzName, strlen(known_zones[i].tzName))) { 1287 1289 offset = known_zones[i].tzOffset; 1290 dateString += strlen(known_zones[i].tzName); 1288 1291 have_tz = true; 1289 1292 break; 1290 1293 } 1291 1294 } 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 }1307 1295 } 1308 1296 } … … 1315 1303 if (errno) 1316 1304 return invalidDate; 1305 dateString = newPosStr; 1317 1306 } 1307 1308 while (isspace(*dateString)) 1309 dateString++; 1310 1311 // Trailing garbage 1312 if (*dateString != '\0') 1313 return invalidDate; 1318 1314 1319 1315 // Y2K: Solve 2 digit years … … 1324 1320 year += 1900; // Y2K 1325 1321 1322 // fall back to midnight, local timezone 1326 1323 if (!have_tz) { 1327 // fall back to midnight, local timezone1328 1324 struct tm t; 1329 1325 memset(&t, 0, sizeof(tm)); … … 1342 1338 } 1343 1339 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); 1345 1341 return result; 1346 1342 }
Note: See TracChangeset
for help on using the changeset viewer.