Open Bug 1397255 Opened 8 years ago Updated 3 years ago

unload event didn't fire when close browser

Categories

(Core :: DOM: Events, defect, P3)

55 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: siarhei_simanovich, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Steps to reproduce: I load an web app that open second browser window to show useful data. On web app there is unload event listener that closes additional window. Actual results: When I close exact tab, unload event fires and close additional. When I close browser completely, unload event didn't fired and on next browser start it load original web app and additional browser window. Additional browser window is trying to close self (cause missing data), but can't with following error: "Scripts may not close windows that were not opened by script." Expected results: When I close browser, on web app unload event should fire and on next start I shouldn't see additional window.
Component: Untriaged → DOM: Events
Product: Firefox → Core
Hi Ben, please take a look at this. Thank you.
Flags: needinfo?(btian)
siarhei, some questions as following: (In reply to siarhei_simanovich from comment #0) > I load an web app that open second browser window to show useful data. > On web app there is unload event listener that closes additional window. Can you attach link to the web app for reproducing? > When I close browser completely, unload event didn't fired and on next How do you "close browse completely"? Did you close via cmd+Q? > Additional browser window is trying to close self (cause missing data), but > can't with following error: "Scripts may not close windows that were not > opened by script." Does additional browser window try to close itself _at the beginning of browser restart_? Does the missing data result from not being closed by unload event listener?
Flags: needinfo?(btian) → needinfo?(siarhei_simanovich)
(In reply to Ben Tian [:btian] from comment #2) > siarhei, some questions as following: > > (In reply to siarhei_simanovich from comment #0) > > I load an web app that open second browser window to show useful data. > > On web app there is unload event listener that closes additional window. > > Can you attach link to the web app for reproducing? Unfortunately no, you can simple use window.open() to reproduce case. > > > When I close browser completely, unload event didn't fired and on next > > How do you "close browse completely"? Did you close via cmd+Q? Yes > > > Additional browser window is trying to close self (cause missing data), but > > can't with following error: "Scripts may not close windows that were not > > opened by script." > > Does additional browser window try to close itself _at the beginning of > browser restart_? Does the missing data result from not being closed by > unload event listener? Additional data was grabbed from reference window.opener, since after restart this prop is not available, additional window perform window.close() and got error above.
Flags: needinfo?(siarhei_simanovich)
Priority: -- → P3
JSEventHandler does call the 'unload' event handler [1] during browser termination. Keep checking why browser termination hinders the event handler's execution. [1] http://searchfox.org/mozilla-central/rev/1c13d5cf85f904afb8976c02a80daa252b893fca/dom/events/JSEventHandler.cpp#215
Any updates for this issue?
Flags: needinfo?(btian)
Flags: needinfo?(ben.tian)

Hi! Any updates about this issue?

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.