Bug 12070

Summary: REGRESSION: KJS::getUTCOffset() caches UTC offset but ignores time zone changes
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: JavaScriptCoreAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: kmccullough
Priority: P1 Keywords: Regression
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch v1 kmccullough: review+

David Kilzer (:ddkilzer)
Reported 2007-01-02 07:08:28 PST
The KJS::getUTCOffset() method in JavaScriptCore/kjs/DateMath.cpp caches the UTC offset, but it never checks to see if the time zone has changed after caching the value (e.g., if a user opened the Date & Time system preference pane and changed their Mac's time zone). This doesn't seem to cause any issues (e.g., when running the test for Bug 12057), but I'd like to do further testing. This bug is a reminder to do that.
Attachments
Patch v1 (1.70 KB, patch)
2007-01-03 22:01 PST, David Kilzer (:ddkilzer)
kmccullough: review+
David Kilzer (:ddkilzer)
Comment 1 2007-01-02 20:14:52 PST
Caching the UTC offset does create problems when changing the time zone through the Date & Time system preferences pane. It may be as simple as reporting the wrong time zone (reporting a daylight saving time zone when it's not daylight saving time) to reporting the wrong time zone offset (e.g., +1800 instead of -0600). Steps to reproduce: 1. Quit WebKit. 2. Set time zone to "London - England" (GMT +0000) in Date & Time pane. 3. Open WebKit. 4. Open this URL: javascript:alert(new Date()) 5. Set time zone to "Chicago - U.S.A." (CST -0600) in Date & Time pane. 6. Open this URL again: javascript:alert(new Date()) Expected results: Time zone should be reported as -0600 (CST) with the correct date and time. Actual results: Time zone is reported as +1800 (CDT) (or similar).
David Kilzer (:ddkilzer)
Comment 2 2007-01-02 20:22:19 PST
(In reply to comment #1) > Caching the UTC offset does create problems when changing the time zone through > the Date & Time system preferences pane. It may be as simple as reporting the > wrong time zone (reporting a daylight saving time zone when it's not daylight > saving time) to reporting the wrong time zone offset (e.g., +1800 instead of > -0600). To be more specific, it may be as simple as the wrong time zone being reported (but the correct time), to reporting the wrong time zone offset, the wrong time zone (in DST when it shouldn't be) and a date in the future!
David Kilzer (:ddkilzer)
Comment 3 2007-01-02 20:27:10 PST
Confirmed that this is a regression from shipping Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037). Tested on locally-built debug build of WebKit r18541. There are basically two solutions: 1. Don't cache the UTC offset. 2. Cache the UTC offset and check for time zone changes to determine if it needs to be recalculated.
David Kilzer (:ddkilzer)
Comment 4 2007-01-03 22:01:52 PST
Created attachment 12205 [details] Patch v1 If the user changes time zones without restarting a WebKit application like Safari, the cached UTC offset will cause JavaScript to report the wrong time zone and/or the wrong time. The simple solution is to stop caching the UTC offset and calculate it every time. That's what this patch does. Note that no performance testing has been done.
David Kilzer (:ddkilzer)
Comment 5 2007-01-04 21:57:26 PST
Committed by Kevin McCullough in r18584.
David Kilzer (:ddkilzer)
Comment 6 2007-06-24 12:04:45 PDT
Mass removal of NeedsRadar keyword from my bugs that have already been RESOLVED.
Note You need to log in before you can comment on or make changes to this bug.