Track usage of implementation-specific heuristics in Date.parse |
|||
Issue descriptionExcerpt from ECMA262 on Date.parse: [...] The function first attempts to parse the format of the String according to the rules (including extended years) called out in Date Time String Format (20.3.1.16). If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Unrecognizable Strings or dates containing illegal element values in the format String shall cause Date.parse to return NaN. There is some efforts underway to specify the implementation-specific fall back behavior: https://bugzilla.mozilla.org/show_bug.cgi?id=1274354 The reason cited is cross-browser compatibility. However, it would make sense to find out how much this implementation-specific heuristic is used in the first place.
,
Jun 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/d77963feeab432464c200fed24851600bdc4b97d commit d77963feeab432464c200fed24851600bdc4b97d Author: yangguo <yangguo@chromium.org> Date: Thu Jun 09 09:08:41 2016 Add UseCounter for Date.parse's legacy parse heuristics. R=adamk@chromium.org, jochen@chromium.org BUG=chromium:618595 Review-Url: https://codereview.chromium.org/2050733004 Cr-Commit-Position: refs/heads/master@{#36846} [modify] https://crrev.com/d77963feeab432464c200fed24851600bdc4b97d/include/v8.h [modify] https://crrev.com/d77963feeab432464c200fed24851600bdc4b97d/src/builtins.cc [modify] https://crrev.com/d77963feeab432464c200fed24851600bdc4b97d/src/dateparser-inl.h [modify] https://crrev.com/d77963feeab432464c200fed24851600bdc4b97d/src/dateparser.h
,
Jun 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64 commit 1a73d11e65f5af4fc946a00ed1a2b7022ed28c64 Author: yangguo <yangguo@chromium.org> Date: Mon Jun 13 09:21:30 2016 Add UseCounter for Date.parse's legacy parse heuristics. R=adamk@chromium.org, asvitkine@chromium.org BUG=chromium:618595 Review-Url: https://codereview.chromium.org/2055713002 Cr-Commit-Position: refs/heads/master@{#399420} [modify] https://crrev.com/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp [modify] https://crrev.com/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64/tools/metrics/histograms/histograms.xml
,
Jun 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64 commit 1a73d11e65f5af4fc946a00ed1a2b7022ed28c64 Author: yangguo <yangguo@chromium.org> Date: Mon Jun 13 09:21:30 2016 Add UseCounter for Date.parse's legacy parse heuristics. R=adamk@chromium.org, asvitkine@chromium.org BUG=chromium:618595 Review-Url: https://codereview.chromium.org/2055713002 Cr-Commit-Position: refs/heads/master@{#399420} [modify] https://crrev.com/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp [modify] https://crrev.com/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/1a73d11e65f5af4fc946a00ed1a2b7022ed28c64/tools/metrics/histograms/histograms.xml
,
Jun 22 2016
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/8b67a002231c222314170a13187e31a2b361ef91 commit 8b67a002231c222314170a13187e31a2b361ef91 Author: yangguo <yangguo@chromium.org> Date: Wed Jun 22 18:06:25 2016 Only count legacy parser usage if legacy parser had effect. We would otherwise also count if its just trimming whitespaces. R=adamk@chromium.org BUG=chromium:618595 Review-Url: https://codereview.chromium.org/2080183003 Cr-Commit-Position: refs/heads/master@{#37197} [modify] https://crrev.com/8b67a002231c222314170a13187e31a2b361ef91/src/dateparser-inl.h [modify] https://crrev.com/8b67a002231c222314170a13187e31a2b361ef91/test/cctest/test-date.cc
,
Jun 22 2016
Although users should use something like Moment.js to parse dates, we seem to be getting a steady stream of bugs on our end reporting that our Date.parse implementation does not parse certain dates that other browsers parse. Some bugs that I've looked at with date parsing: https://bugs.chromium.org/p/chromium/issues/detail?id=589858#c2 -- pushed back https://bugs.chromium.org/p/v8/issues/detail?id=4987 -- pushed back https://bugs.chromium.org/p/chromium/issues/detail?id=422858 -- fixed Overall, based on these bug reports and the bug reports that Firefox and Edge are getting, a number of users seem to have an expectation, which seems reasonable to me, that Date.parse will have the same behavior across different browsers. Although it's unfortunate that we're in a state where we are more tolerant with dates than just ISO 8601, I think this is analogous to other situations in the web platform. For example, for HTML, the emphasis of standards bodies used to be encouraging users to run HTML validators, while web browsers permitted more broad HTML syntax. Eventually, WHATWG standardized a more tolerant, but well-defined HTML parser. It's a painful process, but the definition helped iron out differences between browsers in these edge cases. Subtle, unexpected differences in behavior between browsers can also sometimes result in security bugs, especially when it comes to parsing. In this case, the existence of all these bug reports gives some circumstantial evidence that the legacy date path is used. The new UseCounter data will also give further information to see if my evaluation of that circumstantial evidence is accurate. If it does turn out that we can't just deprecate the legacy Date parser, I think the next step would be for us and other browsers to collect UseCounters on various particular cases, especially the ones which differ between browsers. For example, we permit arbitrary junk letters after parsing the date, and other browsers do not, last time I tested--should this be part of a standard? There are probably many of these cases to identify based on a cross-browser comparison.
,
Jul 12 2016
UMA reports a whopping 65% for the legacy date parser usage on dev channel.
,
Aug 8 2017
Is there more work to do here? Or do the UMA numbers from #7 mean we should close this out?
,
Aug 17 2017
It would be nice to track how much we'd have to stray out of a proposed more lenient grammar, but such a grammar has not yet been proposed unfortunately.
,
Jan 11
Setting defect without priority to Pri-2. |
|||
►
Sign in to add a comment |
|||
Comment 1 by adamk@chromium.org
, Jun 9 2016Components: Blink>JavaScript>Language