Open Bug 1887568 Opened 9 months ago Updated 6 months ago

Function in SVG global evaluated despite having side effects

Categories

(DevTools :: Console, defect, P3)

Firefox 124
defect

Tracking

(Not tracked)

People

(Reporter: gyorokpeter1, Unassigned)

Details

Attachments

(1 file)

1.14 KB, application/x-zip-compressed
Details

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

Steps to reproduce:

Extract the attached .zip file and open test.html via a HTTP server (it doesn't work if opened via file://). Open the console with F12, make sure that "Instant Evaluation" is enabled, and start typing:
panelJs.a
Then type an opening parenthesis, delete it and type again.

Actual results:

The result preview appears and shows a different number each time, since the function changes a global variable every time it is called.

Expected results:

The function should not be called during preview because it has a side effect.

Reporter, can you please attach the mentioned .zip file. Thank you.

Flags: needinfo?(gyorokpeter1)
Attached file html.zip
Flags: needinfo?(gyorokpeter1)

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

simpler str:

  1. Go to https://ffx-devtools-svg-script-instant-evaluation.glitch.me/
  2. Open the console
  3. Type panelJs.a()

expected result: no instant evaluation
actual result: instant evaluation is displayed, modifying the v variable's value

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Function evaluated despite having side effects → Function in SVG global evaluated despite having side effects
Severity: -- → S3
Priority: -- → P3

I was able to reproduce the issue on Win11 x64 using Firefox build 128.0a1 and steps from comment#4.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: