Closed Bug 4167 Opened 25 years ago Closed 22 years ago

window.open during unload event fails when closing last window

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P2)

x86
Windows 95
defect

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: desale, Assigned: joki)

Details

(Keywords: testcase, Whiteboard: [PDT-][TESTCASE] fix in hand, waiting on review from travis)

onUnload Event Does Not Work.

Providing information to simulate the problem.

Product: Seamonkey.[apprunner as well as viewer]
Build Date: 03/22/99
Platform: PC [Windows-95]

Steps to Reproduce:
1] Please copy the code I'm providing. Save as HTML file.
2] Open this HTML file in apprunner as well as viewer.
3] Then try close the window.

Expected Results: After closing window browser should open another window
pointed to URL http://www.yahoo.com

Actual Results: Browser does not open another window.


Code:

<HTML>
<HEAD><TITLE>Unload Event</TITLE></HEAD>
<BODY onUnload="window.open('http://www.yahoo.com')">
<H4>This Page will test whether Unload event works or not.<Br>
After closing this window, browser should open another window<br>
which is pointed to http://www.yahoo.com<H4>
</BODY>
</HTML>
Priority: P3 → P2
Target Milestone: M3
Target is M3 per request.
QA Contact: 3847 → 4616
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Checked in 3/29.  Should be in next days builds.
Right now Window.open is not working and alert is also not working, so I'm
trying to find out some way to test onUnload event. I need to find out
way to test onUnload event without alert or opening new window.  So once I find
that I'll be able to test onUnload event. till then I'm leaving this bug as
marked Fixed.
onUnload should fire any time a document is going away, event just for
switching pages.
Status: RESOLVED → REOPENED
This bug is still there. Now window.open() method is working so we can test
whether onUnload event works or not. Please again follow the procedures provided
initially. This bug is still there.
Resolution: FIXED → ---
Target Milestone: M3 → M6
Per rickg, moving to M6.
Status: REOPENED → ASSIGNED
Target Milestone: M6 → M7
Well it now sort of works.  The unload will fire but some pieces of the
document/webshell are already gone.  For example in this case, the webshell
being unloaded is still intact but its parent is already gone (or at least
already null).  Will have to work more on this.
Target Milestone: M7 → M10
Unless someone comes up with a blocker based on how this currently works I'll
fix it later.
Whiteboard: [TESTCASE] New testcase shows bug in M8-1999070808
TEST ENVIRONMENT:
Win95, M8-1999070808

The original testcase bundled with this big did not even work properly in
Communicator 4.5

The expected result was that the browser window would close and a new window
would open, fired by the onUnload event.  This was not the result that I saw in
communicator.  The browser closed without any side-effects.

I wrote another test that does not rely on the window closing, but only the
document unLoading to load a new document in the browser.

Expected results:
The OnUnload event should fire an alert dialog box when a link is clicked to
load a new page.  (This is the result that is seen when the page is tested in
Communicator 4.5)

Actual Result:
No alert box is produced.


-------------TestCase-----------------

<HTML>
<HEAD>
<TITLE>Unload Event</TITLE>
</HEAD>
<BODY onUnload="alert('Unload has fired.');">
When the yahoo link is clicked, the document <BR>will 'unload' and an alert
should display.<P>
<A HREF="http://www.yahoo.com">yahoo link</A>.
</BODY>
</HTML>

---------------------------
The reason I wrote that testcase like that is because alert() is not working
yet. alert() method itself is not properly implemented yet. And the testcase I
wrote eirlier is working fine on communicator 4.5.
Getting output with alert is the most simple and convenient way, but since its
not working then I have to findout some other ways to get output right ? thats
why I used that thing to open new window and load it with www.yahoo.com.
I tested my testcase again and its working fine for me.
And if I call window.open() on Unload, then it must open new window on closing
the parent window.
Target Milestone: M10 → M11
m11.  let me know if something is close on this one.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → WORKSFORME
Just tested on MacOS, works for me!
Status: RESOLVED → REOPENED
I just tested this one with todays bulds [09-27-09] as well as with [09-23-09]
builds.
It works with viewer, but it does not work with apprunner.
Reopening bug.
I tested on windows-95.
Resolution: WORKSFORME → ---
The successful MacOS test was with apprunner
Its not working with Windows-95. I tested again.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
I tested today's apprunner/mozilla on Windows NT.  It works for me.  Resolving as
fixed.
Status: RESOLVED → REOPENED
Summary: onUnload Event Does Not Work. → onUnload Event is not firing on closing the window.
Resolution: FIXED → ---
Yead onUnload event is working fine if we load another page and try to catch
unload event. But if we try to catch unload event on closing window then, we can
see that unload event is not firing.

We have two testcases in this bug report. One is with alert which fires on
cliking the link. [This testcase works fine coz we are not closing window here]
If we try first testcase and follow steps I provided to reproduce then you'll
see that its not working.
This is pretty important because lot of websites use this event to open another
window on closing main window of the site.

Please try to reproduce it with first testcase that I provided while filing bug.

Re-opening the bug since its not working correctly on closing window.
Changed summary, and clearing resolution.
Target Milestone: M11 → M12
m12
Moving to m13 because Joki seems to be distracted.
Target Milestone: M13 → M14
Bulk moving [testcase] code to new testcase keyword. Sorry for the spam!
Keywords: testcase
Keywords: beta1
Status: REOPENED → ASSIGNED
Whiteboard: [TESTCASE] New testcase shows bug in M8-1999070808 → [TESTCASE] fix in hand, waiting on review from travis
We'd like to see this fixed for beta, but we'd ship without it.
Whiteboard: [TESTCASE] fix in hand, waiting on review from travis → [PDT-][TESTCASE] fix in hand, waiting on review from travis
Okay, so this is 90% fixed.  The unload event now fires and some things work.  
Like an alert on unload is fine.  However, when opening a new window we seem to 
have a race condition if the window closed is the last browser window open at 
the time.  Sometimes app data has already gone.  If other windows are open this 
works fine.

Updating summary and moving out to further milestone.
Summary: onUnload Event is not firing on closing the window. → window.open during unload event fails when closing last window
Target Milestone: M14 → M16
Bulk prioritizing bugs for correct milestones.
Target Milestone: M16 → M18
This bug has been marked "future" because the original netscape engineer working 
on this is over-burdened. If you feel this is an error, that you or another 
known resource will be working on this bug,or if it blocks your work in some way 
-- please attach your concern to the bug for reconsideration.
Target Milestone: M18 → Future
WFM with 2001091618
This seems working fine to me now.
marking worksforme.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago22 years ago
Resolution: --- → WORKSFORME
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.