Closed Bug 130947 Opened 22 years ago Closed 22 years ago

window.open() fails in OnUnLoad

Categories

(Core :: DOM: Events, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

VERIFIED WONTFIX

People

(Reporter: cassadyb, Assigned: joki)

References

Details

From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (WinNT; U)
BuildID:    2002031403

HTML document is making a call to window.open() in a JS function referenced from 
an OnUnLoad= option in a HTML BODY tag.

It works fine if you move to another document in the same window.

It fails when the browser window is closed.


Reproducible: Always
Steps to Reproduce:
1.  Create a typical HTML file.
1.  Add a JS section in the HEAD section with a function that opens a window 
(eg. function test() { window.open("http://www.mozilla.org") } )
2.  Add OnUnLoad="test()" to BODY tag.
3.  Open in browser.
4.  Close browser window.


Actual Results:  Browser window closes and secondary browser window does not 
open.


Expected Results:  Browser window closes and secondary browser window opens and 
displays the Mozilla web site home page.

The JS Console error message that is produced is:

Error: uncaught exception: [Exception... "Component returned failure code: 
0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open]"  nsresult: "0x80004005 
(NS_ERROR_FAILURE)"  location: "JS frame :: file:///d:/temp/test.html :: logout 
:: line 8"  data: no]
window.open() is supposed to fail in onunload.  See bug 33448.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
I apologize.  I did not find that bug posting when I was researching this 
problem.  Don't know why, since I spent a couple of days on this before posting.

I will be adding some comments to Bug 33448, as I entirely disagree with 
disabling this mechanism in code (vs. a configurable option).
verifying
Status: RESOLVED → VERIFIED
*** Bug 153099 has been marked as a duplicate of this bug. ***
*** Bug 161798 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.