Closed
Bug 229006
Opened 21 years ago
Closed 21 years ago
JS parser has problems parsing i++ when line number greater than 2^16
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.7alpha
People
(Reporter: dbaron, Assigned: brendan)
Details
Attachments
(4 files)
64.09 KB,
text/html; charset=UTF-8
|
Details | |
8.44 KB,
patch
|
Details | Diff | Splinter Review | |
9.12 KB,
patch
|
shaver
:
review+
|
Details | Diff | Splinter Review |
66.37 KB,
text/plain
|
Details |
The JS parser has problems parsing i++ in a for loop, and perhaps other things,
when the line number is greater than 2^16. (Asa ran into this on bugzilla
mass-change forms -- the "Check All" and "Uncheck All" bugs are document.written.)
Steps to reproduce:
load attached testcase
Actual results:
JS error on console:
Error: missing ) after for-loop control
Source File: file:///home/dbaron/webtest/docwrite2.html
Line: 65540, Column: 20
Source Code:
for (var i=0; i<2; i++) {
Expected results:
no error
Reporter | ||
Comment 1•21 years ago
|
||
Reporter | ||
Comment 2•21 years ago
|
||
This fixes the problem, but brendan isn't crazy about it. :-)
Assignee | ||
Comment 3•21 years ago
|
||
I'll try for a better patch, but no promises -- dbaron's may land (perhaps with
some macro magic to consolidate the awful truth).
/be
Assignee: general → brendan
Priority: -- → P3
Target Milestone: --- → mozilla1.7alpha
Assignee | ||
Comment 4•21 years ago
|
||
I'm inclined to check this in and move on. Fancier fix ideas I'll record here
but not bother with:
1. Store line number delta relative to first line of script, not file or url
relative (absolute) line number, in JSTokenPtr.lineno (rename it to linedelta
or some such name).
2. Use a uint32 for JSTokenPtr and split its bits dynamically, according to
how many lines are in the script (or file/url, if 1 isn't done). We'd need to
know how many lines total up front, or else keep revising the number of bits as
we go (somehow). Note that with eval, it's easy to get a script contained on
one very long line, so the JSTokenPtr.index field might easily need more bits
than 16.
If anyone has a brainstorm, speak up.
/be
Assignee | ||
Updated•21 years ago
|
Attachment #138324 -
Flags: review?(shaver)
Comment 5•21 years ago
|
||
Comment on attachment 138324 [details] [diff] [review]
hack dressed up via a macro
DO NOT LOOK INTO MACRO WITH REMAINING EYE.
r=shaver.
Attachment #138324 -
Flags: review?(shaver) → review+
Assignee | ||
Comment 6•21 years ago
|
||
Fixed.
/be
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 7•20 years ago
|
||
Thanks to dbaron.
Comment 8•20 years ago
|
||
js1_5/Regress/regress-229006.js checked in.
Updated•20 years ago
|
Flags: testcase+
You need to log in
before you can comment on or make changes to this bug.
Description
•