Closed Bug 1764955 Opened 3 years ago Closed 3 years ago

RegExp.test console evaluation preview mutating RegExp.lastIndex

Categories

(DevTools :: Console, defect)

Firefox 99
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1609429

People

(Reporter: luke.49, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0

Steps to reproduce:

Typed into console:
const re = new RegExp('a', 'g');
const str = "cake";
re.test(str);

Actual results:

The evaluation preview displayed true, then executing it returned false (since the preview moved the lastIndex pointer past the first match).

Expected results:

Either no preview should be given, or a preview which does not mutate the RegExp until it is actually evaluated.

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.