Closed Bug 276289 Opened 20 years ago Closed 19 years ago

Better error for extremely long array initialiser

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: firefox_bugzilla, Assigned: brendan)

References

()

Details

(Keywords: js1.5)

Attachments

(2 files)

When loading a page with a JS-array on one line containing about 10MB of data, I
get an error that the array is not "closed" there is a missing "]".

This is not the case, as the screenshot of the error indicates. It seems that
the buffer reading lines from the document is simply not big enough, thus the
array seems unfinished.

I have "shortened" the array in an other file, and then no error occurs.
OS: Linux → All
Product: Firefox → Core
Hardware: PC → All
Component: JavaScript Console → JavaScript Engine
Assignee: bugs → general
QA Contact: firefox.js-console → pschwartau
Attached file testcase
Well, at least using eval() the limit is a lot lower than 10 MB, the script
fails at 196613 characters (6 more than IE6 ;-)).

Warning: the testcase sometimes crashes Firefox/20041229 Win32 for me if the
JavaScript Console is open while it's running. Sorry, no talkback ID, the
talkback agent still can't be installed with this build.
Doh, there is a 64K limit in place here and each of the elements in my testcase
takes 3 characters, that's why I get 196613 (3*65536+5) as the limit. 
Confirming with current trunk.
Status: UNCONFIRMED → NEW
Ever confirmed: true
IE fails with out of memory on Erik's test case. Brendan, what say you? Thumbs
down-> wontfix?
QA Contact: pschwartau → moz
I'd like to diagnose this first.

Crazy amounts of data are flowing as/in JS, these days ("Ajax", donchaknow).  If
we can fix this easily, and you have a lot of RAM, why not?

/be
Assignee: general → brendan
This is because of the 16 bit immediate literal index limit, which I've lifted
with the checkin for bug 155081 to a 24 bit (effectively, 23 bits because of
source note representation) limit.  That ought to be enough!

This bug should be morphed, no matter the limit, to ask for a clear diagnostic
that says what the problem is, instead of making a bogus syntax error out of an
array literal too long to fit in the engine's current bytecode representation.

/be
Status: NEW → ASSIGNED
Keywords: js1.5
Priority: -- → P2
Summary: JS-error on long lines (10MB of data in an array) → Better error for extremely long array initialiser
Target Milestone: --- → mozilla1.8beta2
Version: 1.0 Branch → Trunk
Fixed; it was obvious and safe for 1.8b2.

/be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: