Giving javascript uncaught exception while trying to open a new window on unload of the present window..

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
16 years ago
16 years ago

People

(Reporter: sudramac, Assigned: jst)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
User-Agent:       Mozilla/4.76 [en]C-CCK-MCD   (Windows NT 5.0; U)
Build Identifier: Netscape 7.0

My page has 2 frames and the frameset calls  a javascript function on unload. 
This unload function tries to open a window. This works fine in netscape 4.7X, 
6.X, but giving uncaught Exception in netscape 7.0 & 7.01. Please help me to 
resolve this problem.

Here is the error i got
Error: uncaught exception: [Exception... "Component returned failure code: 
0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open]"  nsresult: "0x80004005 
(NS_ERROR_FAILURE)"  location: "JS frame :: "http://a.b.c.com" :: winClose :: 
line 24"  data: no]

Reproducible: Always

Steps to Reproduce:
1.Create a page with 2 frames and have onunload on the frame set
2.during unload try to do a window.open and there gives the uncaught exception
3.

Actual Results:  
Got a Javascript uncaught Exception error

Expected Results:  
Should open a window while closing another window which has window.open function
.
Assignee: asa → jst
Component: Browser-General → DOM Level 0
QA Contact: asa → ashishbhatt
Sudhir,
   You probably have the "Open Unrequested Windows" option unchecked in the
Preferences->Advanced->Scripts & Plugins panel. With that option unchecked, any
window.open calls from an onLoad or onUnload handler will return null. It's
designed to block pop-up ads. Does your script work with that box checked?
(Reporter)

Comment 3

16 years ago
Sir,

I took care of this in the starting itself. Still it gives me this error. When i 
do onLoad it opens up popup window but not on Unload.

Regards

Sudhir

Comment 4

16 years ago
Created attachment 114250 [details]
Frameset with on unload function

This test case works fine on Netscape 7.0, Open up new popup when frameset
onunload is called.

Try this test case with a new profile if this dosen't work.
(Reporter)

Comment 5

16 years ago
Hi,

Here is what the situation is, when we call a window.open()onunload, if the page 
is a parent window it is working fine. My situation is, i have a parent window 
which opens a child window which has frameset and on this child window if i 
call window.open()on unload, it gave me the error. So i changed it to 
opener.window.open() gives me permission denied error(because i am opening a 
window which is being closed). Is there anyway that i can create a new window 
object and call open on that.

Thanks for your time regarding this issue.

Sudhir  
(Reporter)

Comment 6

16 years ago
Sir,

I got the same error when i used mozilla 1.1. I upgraded mozilla version to 1.2 
and it is working now in Mozilla, but still getting the same error in Netscape 
7.0.

Thanks

Sudhir
This works for me as well in today's build, marking Worksforme. Sudhir, Netscape
7.0 is based on Mozilla 1.0.1, which evidently had this problem. The problem has
since been fixed in Mozilla and the fix will appear in a future Netscape release.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 8

16 years ago
Hi Sir,

Since this bug is affecting our reporting, we need this to be fixed ASAP. The 
attachment you have sent me was working only for the Parent window. I am sending 
a dummy page in which i am calling the attachment you have created. If i call 
like this then it is giving me javascritp error.is there any way you could fix 
this ASAP.

I really appreciate your help regarding this.

Here is the parent window code which calls the child window which has 2 frames 
in turns should open a pop up window while unloading the child window.

***************************************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<A 
HREF="Javascript:window.open('http://bugzilla.mozilla.org/attachment.cgi?id=1142
50&action=view','child','height=500,width=500,toolbar=no,scrollbar=no')">Child 
Window with Frameset</A>
</BODY>
</HTML>
*************************************************************

Thanks

Sudhir
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Sudhir,
   I tried your testcase in Netscape 7.01 and I see the error you are
describing. This error has been fixed in subsequent Mozilla releases (the error
is not present in Mozilla 1.3). The fix will be included in a future Netscape
release. I looked around for a workaround for Netscape 7.01 users, but I can't
find one - I recommend you detect Netscape 7.01 and earlier users and present
them with different content that doesn't require a window.open() call in the
onUnload handler.

This is the bug system for Mozilla.org, and as this bug has been fixed in
Mozilla I am resolving it Worksforme. Please do not reopen it. 
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago16 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.