Closed
Bug 1350575
Opened 8 years ago
Closed 8 years ago
RegExp constructor doesn't preserve newlines in source
Categories
(DevTools :: Console, defect)
Tracking
(firefox52 unaffected, firefox53 unaffected, firefox54 unaffected)
RESOLVED
INVALID
Tracking | Status | |
---|---|---|
firefox52 | --- | unaffected |
firefox53 | --- | unaffected |
firefox54 | --- | unaffected |
People
(Reporter: 1212jtraceur, Unassigned)
References
Details
(Keywords: regression)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36
Steps to reproduce:
In the JS console on a Nightly build (55.0a1 (2017-03-25) (64-bit)), run the following:
RegExp('\n').source
Actual results:
The string source of this regex contains the literal characters \ and n (codes 92 and 110).
Expected results:
The regex source should contain only a single linefeed character.
See here for more details/context: https://github.com/slevithan/xregexp/pull/163#issuecomment-288633467
> This seems to be a quirk in Firefox (not certain it's technically a bug).
> What's happening is that when the string pattern is converted into a regex,
> Firefox is changing the string '\n' (LF, char code 10) to the regex pattern /\n/,
> which seems inappropriate to me even if it's not technically a bug (not
> sure what the spec might have to say about this edge case which only matters
> when looking at the string source of the resulting regex). The string source
> of this regex now contains the literal characters \ and n (codes 92 and 110),
> rather than LF. :-/
Regressed by 1342526
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=be76983050c7cbefea0427a625627651a039b089&tochange=d13bb1ff158ac8a7a10e6cd687f8b1b03cc888ec
Blocks: 1342526
Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
status-firefox52:
--- → unaffected
status-firefox53:
--- → unaffected
status-firefox54:
--- → unaffected
status-firefox55:
--- → affected
tracking-firefox55:
--- → ?
Component: JavaScript Engine → Developer Tools: Console
Ever confirmed: true
Flags: needinfo?(ttromey)
Keywords: regression
Product: Core → Firefox
Reporter | ||
Comment 2•8 years ago
|
||
On second thought, it seems I was mistaken on this one, after reading through https://github.com/kangax/compat-table/issues/798 and the linked resources.
Reporter | ||
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Comment 3•8 years ago
|
||
Adjusting flags based on the resolution of the bug.
status-firefox55:
affected → ---
tracking-firefox55:
? → ---
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•