Closed Bug 1022254 Opened 10 years ago Closed 10 years ago

JS Date with integer literals with leading zeroes is broken due to bug 957513

Categories

(Core :: JavaScript Engine, defect)

32 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34
Tracking Status
firefox31 --- unaffected
firefox32 --- unaffected
firefox33 - unaffected
firefox34 - unaffected

People

(Reporter: anshprat, Unassigned)

References

Details

(Keywords: regression, site-compat)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0 (Beta/Release) Build ID: 20140607030208 Steps to reproduce: Sites having date in JS are broken: in console, enter - date = new Date(2013,08,12); Actual results: The respective JS is broken X SyntaxError: numbers starting with 0 followed by a digit are octals and can't contain 8 Expected results: respective JS should be parsed and the site should work.
Summary: Date is broken due to 957513 → JS Date is broken due to 957513
Depends on: 957513
Component: Untriaged → JavaScript Engine
Keywords: site-compat
OS: Mac OS X → All
Product: Firefox → Core
Hardware: x86 → All
Blocks: 957513
No longer depends on: 957513
Keywords: regression
Sounds to me like the spec is not web-compatible here and needs to change.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I'm not sure the reported case is common. The result of new Date(2013,08,12) may not what the author expected; It's actually 2013-09-12 since the month is an integer beginning with 0 for January to 11 for December. So developers usually have to +1 in their code, then the value won't be zero-prefixed. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
Mm, the handling of +1 could be managed on server side as well I guess?
Till backed out bug 957513 from Aurora 32, but let's track this for 33. If we can't get this bug fixed soon, we may need to back bug 957513 out of 33, too.
Jason: does this Date bug suggest that we can never enable the octal syntax errors? IIUC, bz asserts in comment 1 that the ES6 spec's octal syntax error is not web-compatible, but I agree with Kohei in comment 2 that these syntax errors are reporting likely content bugs. Should we downgrade the syntax errors to console warnings for the indefinite future?
Flags: needinfo?(jorendorff)
Summary: JS Date is broken due to 957513 → JS Date is broken due to bug 957513
(In reply to Chris Peterson (:cpeterson) from comment #5) > Jason: does this Date bug suggest that we can never enable the octal syntax > errors? Yes. > IIUC, bz asserts in comment 1 that the ES6 spec's octal syntax error is not > web-compatible, but I agree with Kohei in comment 2 that these syntax errors > are reporting likely content bugs. Sure. Suppose both are true. Then we can never enable the octal syntax errors. As a wise man once told me: Don't break the web. > Should we downgrade the syntax errors to > console warnings for the indefinite future? Yep.
Flags: needinfo?(jorendorff)
This also broke the KU Leuven exam schedule in Nightly. Error happens here: |new Date(2014,00,10,08,30)|
Tracking this for now
Who's taking this?
Flags: needinfo?(jorendorff)
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
Can we downgrade the error to warning instead of removing the functionality altogether?
(In reply to Simonas Kazlauskas [:simukis] from comment #11) > Can we downgrade the error to warning instead of removing the functionality > altogether? Please ignore. I did not look at bug 957513 hard enough before writing here.
Untracking. We are already tracking this issue in bug 957513.
Bug 957513 was backed out fully and closed as WONTFIX. Closing this.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(jorendorff)
Resolution: --- → FIXED
Summary: JS Date is broken due to bug 957513 → JS Date with integer literals with leading zeroes is broken due to bug 957513
Target Milestone: --- → mozilla34
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
You need to log in before you can comment on or make changes to this bug.