Closed
Bug 257751
Opened 20 years ago
Closed 19 years ago
"trailing \ in regular expression" JavaScript error is missing line number
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: bugzilla, Unassigned)
References
Details
Attachments
(2 files)
336 bytes,
text/html; charset=utf-8
|
Details | |
1.83 KB,
patch
|
brendan
:
review+
brendan
:
approval1.8b2+
|
Details | Diff | Splinter Review |
I just got this JS error: Error: trailing \ in regular expression but I'm missing a linenumber and filename
Reporter | ||
Comment 1•20 years ago
|
||
this time I think it's in the JS engine: http://lxr.mozilla.org/mozilla/source/js/src/js.msg#138 http://lxr.mozilla.org/mozilla/source/js/src/jsregexp.c#1002
Component: DOM: Level 0 → JavaScript Engine
Updated•20 years ago
|
Assignee: general → general
QA Contact: ian → pschwartau
Comment 2•20 years ago
|
||
Please attach a testcase. The lxr links you show do not indicate a lack of line number or filename -- on the contrary, passing state->tokenStream should help js_ReportCompileErrorNumber cite the filename and line number. If that token stream pointer is null, however, then you won't get a file or line. So, what is the testcase? Is it a regexp literal, or a new RegExp("...\") call? /be
Comment 3•20 years ago
|
||
Just the RegExp() call is affected, literals work.
Comment 4•19 years ago
|
||
js/tests/js1_5/Exceptions/regress-257751.js checked in.
Comment 5•19 years ago
|
||
*** Bug 290983 has been marked as a duplicate of this bug. ***
Comment 6•19 years ago
|
||
This extra code is invoked only when the token stream or code generator are missing/not specified. This happens (per the comments in the function) when called from new RegExp(). The extra code uses the context, which is always bassed in (AFAIK), to determin the location of the error. This fixes the testcase both in this bug and the duplicate so they show the filename and line number (but no source line).
Comment 7•19 years ago
|
||
Comment on attachment 181163 [details] [diff] [review] Add code to get a location from the stack frames Great, thanks for the patch! r/a=me for 1.8b2. /be
Attachment #181163 -
Flags: review+
Attachment #181163 -
Flags: approval1.8b2+
Comment 8•19 years ago
|
||
Fixed. /be
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Updated•19 years ago
|
Flags: testcase+
You need to log in
before you can comment on or make changes to this bug.
Description
•