Implement console error on old, non-standard flag argument in String.prototype.{search,match,replace}
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: swleefers, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0
Steps to reproduce:
I have executed the following Javascript code in the browser console (or in a Greasemonkey script, with the same result):
'beet beet'.match('beet', 'g');
Actual results:
The result is an array with a single match 'beet'; the non-standard flag 'g' (for a global search) is ignored (as expected).
No error or warning is shown in either of the consoles (web console / browser console).
The old code, with the old flag, which used to work, now fails silently.
Because an array with the first match is returned, the code may think that the global search found a single match and continue without suspicion, while in fact the global flag was ignored and only the first match 'beet' is in the array.
Expected results:
It is expected that the old, non-standard flag shouldn't work, as it was deprecated and removed a while ago according to this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1108382
But I should like to see an error in the web and browser consoles when the old flag is being ignored. That way, it is much easier to find the error in old code—or even to find out that there is any kind of error at all. Silent failure seems inappropriate.
Comment 1•7 years ago
|
||
We had been showing warning for 10 cycles, including one ESR (45), IMO that was enough.
- The warning was added in bug 1142351 (Firefox 39)
- The support was dropped on non-release channel in bug 1245801 (Firefox 47), still warned
- The support and warning were dropped entirely in bug 1108382 (Firefox 49)
Description
•