Open Bug 2005757 Opened 11 months ago Updated 2 months ago

Page code is executed when tab with alert is closed

Categories

(Firefox :: Tabbed Browser, defect)

Firefox 146
defect

Tracking

()

People

(Reporter: david.balazic, Unassigned, NeedInfo)

References

Details

Attachments

(2 files)

Attached file testFirefoxBug.html —

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

Steps to reproduce:

  • open a few tabs
  • in one tab open the attached example HTML file (as file: URL is enough, works same over https: )
  • without clicking OK in the alert, close the tab (by clicking X or by ctrl+w)

Actual results:

the redirection code in the page is executed and a https request is sent to that server (easiest to see in the server log, as the dev tools with Network traffic is closed when the parent tab is closed)

Expected results:

Just remove the tab, without any other activity.

NOTE: probably some race condition, can not be always reproduced (especially in the attached test case, happens almost always on my project)

Blocks: 59314
Status: UNCONFIRMED → NEW
Component: Untriaged → Tabbed Browser
Ever confirmed: true

The severity field is not set for this bug.
:dwalker, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(dwalker)

The "same" thing happens when the page URL is changed:

  • open the example HTML
  • without closing the dialog, type some other URL in the URL bar, press ENTER

Expected:
the new URL is loaded

Actual:
the JavaScript executed and the URL in the script is loaded

Note: this is not 100% reproducible, it happens more often with a complex web page has the mentioned script part

Firefox version: 155.0.1

Here is the Network trace for the steps in the previous comment, from a more complex page having the same issue.

The upper half is loading the manually entered URL, the lower is the "window.location = link" JS being executed.

Interesting detail is the Initiator column for the first row. It says it is the Javacript line alert("foo") from the previous page! The value is the same for the following rows that are items on the page, but they are fetched from cache (and some aborted).

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

Attachment

General

Creator:
Created:
Updated:
Size: