Javascript can't create pop-up window

REOPENED
Unassigned

Status

()

Core
DOM: Core & HTML
REOPENED
16 years ago
2 months ago

People

(Reporter: Scott Lambdin, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

16 years ago
This code snippet makes a new window pop up with two other browsers.
It just makes this mozilla wiggle.

To open the window....
        function GetHeight(defhei) 
        {
                var ah = window.screen.availHeight - 30;
                if ( ah > defhei ) 
                {
                ah = defhei;
                }
                return ah;
        }
      
        <script language="JavaScript">
                //this script opens the window
            page =
'frame_work.cfm?req_no='+document.temp.l_req_no.value+'&pagetype=EDIT&re
q_type='+document.temp.l_req_type.value;
            var pAttrib =
"toolbar=Yes,scrollbars=Yes,resizable=yes,width=700,height=" +
GetHeight(720);
            window.open(page, "CARESWindow", pAttrib);
      </script>

Comment 1

16 years ago
Hi - the form wouldn't let me put in version.  It is 
mozilla-0.9.7-0.i386.rpm.

--Scott
Do you have the preference to prevent pages from opening windows by themselves set?

Comment 3

16 years ago
Browser, not engine. Reassigning to Browser-General until we can get more info.
Will attach the reduced testcase below, with |page| changed from 

page = 'frame_work.cfm?req_no='+document.temp.l_req_no.value+'&pagetype=EDIT&re
q_type='+document.temp.l_req_type.value;

to 

page = 'http://www.mozilla.org';
Assignee: rogerl → asa
Component: JavaScript Engine → Browser-General
QA Contact: pschwartau → doronr

Comment 4

16 years ago
Created attachment 66808 [details]
Reduced testcase

Comment 5

16 years ago
The reduced testcase works fine for me with Mozilla binaries dated
20020125xx on WinNT, Linux, and Mac9.1. 

Scott: 

1. See the Prefs question in Comment #2 above; that's set in
Edit > Preferences > Advanced > Scripts & Windows > Allow scripts to ... etc.

2. Could you provide the URL where the code snippet comes from? 
That way we can debug it

3. Is Mozilla hanging on this, or just not executing?

4. If the latter, are there any errors in Tasks > Tools > JavaScript Console?
  (Be sure to clear it out of any previous errors first)

5. How does the reduced testcase work for you? 
Comments from Scott in email:


Under "Scripts and Windows" > "Allow scripts to do the following", "Open windows
by themselves" is checked

Comment 7

16 years ago
testcase in attachment 66808 [details] WFM (3h old cvs build, linux)
(Reporter)

Comment 8

16 years ago
Reduced test case works for me, too.

I will ask our app developer if this javascript console error means anything to
him.  Always good to attack from two directions.  
Oh, and does a window named "CARESWindow" already exist in your app?  If that
window has the code in question run in it you would not get a new window and
_would_ get the "wiggle" effect.

Of course in that case the same thing should happen in other browsers...

Comment 10

16 years ago
Scott reports:

> 1. See the Prefs question in Comment #2 above; that's set in
> Edit > Preferences > Advanced > Scripts & Windows > Allow scripts to ... etc.

All boxes checked.


> 2. Could you provide the URL where the code snippet comes from? 
> That way we can debug it

I don't think "they" will go for that, but I will see if they will let 
me give you a tempory account.


> 3. Is Mozilla hanging on this, or just not executing?

I hit the Submit button, there is a pause like the app is hitting the 
database, and then the whole browser drops about 10-20 pixels on the 
screen.  No hang.


> 4. If the latter, are there any errors in Tasks > Tools > JavaScript Console?
>   (Be sure to clear it out of any previous errors first)

Yes!

Error:  document.temp has no properties
Source File:  
https://dobby.niehs.nih.gov/cares/support/searchbyarnum.cfm

Comment 11

16 years ago
Created attachment 66907 [details]
Excerpt from searchbyarnum.cfm

Comment 12

16 years ago
http://icewind2.blackisle.com/screens.html provides an instance where the popup
window does not work correctly.  Clicking on any image provides a flashing window.
That site has broken client-sniffing:

var NS = (document.layers) ? 1 : 0;
win =
window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");

if (NS) {
  sWidth = win.innerWidth;
  sHeight = win.innerHeight;
} else {
  sWidth = win.document.body.clientWidth;
  sHeight = win.document.body.clientHeight;
}
if(sWidth!=ix || sHeight!=iy) {
win.close();
return;
}

In this case there is no document in the window when the width/height checking
code runs.  So sWidth and sHeight (which get set on the IE branch) are
wrong....  and the window gets closed.

Comment 14

16 years ago
->DOM
Assignee: asa → jst
Status: UNCONFIRMED → NEW
Component: Browser-General → DOM Level 0
Ever confirmed: true
QA Contact: doronr → desale

Comment 15

16 years ago
All testcase WFM on mozilla1.0.
win.document.body.clientWidth/Height has correct value in mozilla.
We supports both win.innerWidth and win.document.body.clientWidth?

Comment 16

15 years ago
Worksforme, Linux SuSE 7.3, Moz nightly 2003021905
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
Marking invalid per comment 13
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → INVALID
(Reporter)

Comment 19

15 years ago
Okay - I guess Netscape and IE are broken for working properly.  <shrug>

--Scott
Scott, the site purposefully executes one set of code in IE and another in NS4.
 In Mozilla it executes a mix of the two sets of code.  It looks like this:

w = window.open;
if (IE) {
  w.browser = "ie";
} else {
  w.browser = "ns";
}

if (NS4) {
  if (w.browser != "ns") w.close();
} else {
  if (w.browser != "ie") w.close();
}

Trace through this code, keeping in mind that in Mozilla both "NS4" and "IE" are
false (since it's neither).

So all three browsers are working properly; the bug is in the page itself.
(Reporter)

Comment 21

15 years ago
Boris, I can't find where our site does that client sniffing and the developer
says that he doesn't do it.  Are you referring to the site in comment 12?  --Scott
Ah, sorry.  Yes, I got confused about the comments that had nothing to do with
this bug.  Reopening....

Scott, have you had any luck with getting a testcase that does reproduce the
problem?  It's a little hard to fix as things stand. ;)
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Scott, any chance of a page showing this bug?
Assignee: general → nobody
QA Contact: desale → general

Comment 24

2 months ago
Similar, but not a duplicate of:
Bug 1390490 - "middle" or command-clicking on link opens new "pop up" window, instead of opening link in new tab
You need to log in before you can comment on or make changes to this bug.