WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 31416
Fail early in parseDateFromNullTerminatedCharacters
https://bugs.webkit.org/show_bug.cgi?id=31416
Summary
Fail early in parseDateFromNullTerminatedCharacters
Steve VanDeBogart
Reported
2009-11-12 10:03:46 PST
When parseDateFromNullTerminatedCharacters() is unable to parse the passed string, it still calculates the timezone and DST offset to apply to the result. This causes an unnecessary IPC in chromium. The attached patch changes the code to only calculate the offsets if parsing was successful.
Attachments
Only calculate time offsets for valid dates.
(1.27 KB, patch)
2009-11-12 10:05 PST
,
Steve VanDeBogart
levin
: review-
Details
Formatted Diff
Diff
Other case and early exit
(1.60 KB, patch)
2009-11-12 11:06 PST
,
Steve VanDeBogart
vandebo
: review-
Details
Formatted Diff
Diff
Fix spacing
(1.61 KB, patch)
2009-11-12 11:12 PST
,
Steve VanDeBogart
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Steve VanDeBogart
Comment 1
2009-11-12 10:05:20 PST
Created
attachment 43071
[details]
Only calculate time offsets for valid dates.
David Levin
Comment 2
2009-11-12 10:34:09 PST
Comment on
attachment 43071
[details]
Only calculate time offsets for valid dates. Thanks for fixing this.
> Index: JavaScriptCore/ChangeLog > +2009-11-11 Steve VanDeBogart <
vandebo@chromium.org
> > + > + Reviewed by NOBODY (OOPS!). > + > + Calculate the time offset only if we were able to parse > + the date string. This saves an IPC in Chromium for > + invalid date strings.
Please add a bug link.
> Index: JavaScriptCore/wtf/DateMath.cpp > @@ -825,7 +825,7 @@ double parseDateFromNullTerminatedCharac > int offset; > double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset); > // fall back to local timezone
Just do if (isnan(ms)) return NaN;
> - if (!haveTZ) { > + if (!haveTZ && ms != NaN) {
Also there is another instance to fix in "double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateString)"
Steve VanDeBogart
Comment 3
2009-11-12 11:06:17 PST
Created
attachment 43079
[details]
Other case and early exit
Steve VanDeBogart
Comment 4
2009-11-12 11:11:19 PST
Comment on
attachment 43079
[details]
Other case and early exit spacing
Steve VanDeBogart
Comment 5
2009-11-12 11:12:06 PST
Created
attachment 43081
[details]
Fix spacing
Adam Barth
Comment 6
2009-11-12 20:49:50 PST
Comment on
attachment 43081
[details]
Fix spacing Thanks!
WebKit Commit Bot
Comment 7
2009-11-12 21:08:07 PST
Comment on
attachment 43081
[details]
Fix spacing Clearing flags on attachment: 43081 Committed
r50927
: <
http://trac.webkit.org/changeset/50927
>
WebKit Commit Bot
Comment 8
2009-11-12 21:08:12 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug