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)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: bugzilla, Unassigned)

References

Details

Attachments

(2 files)

I just got this JS error:

Error: trailing \ in regular expression

but I'm missing a linenumber and filename
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
Assignee: general → general
QA Contact: ian → pschwartau
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
Just the RegExp() call is affected, literals work.
js/tests/js1_5/Exceptions/regress-257751.js checked in.
*** Bug 290983 has been marked as a duplicate of this bug. ***
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 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+
Fixed.

/be
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Flags: testcase+
verified fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: