Closed Bug 263977 Opened 20 years ago Closed 20 years ago

if i use window.focus() the window never stops loading

Categories

(SeaMonkey :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 251529

People

(Reporter: Josef.Rosenlehner, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910

When i create a window via window.open() and set after filling this window the
focus via window.focus() to this window, the window never stops loading.
If i try to print this page Mozilla messages that the page can't be print
because it has not finished loading.

It works well if i delete the focus method.

example page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unbenanntes Dokument</title>
    <script language="JavaScript" type="text/javascript">
    <!--
	  function doPrint()
	  {
	    printWindow = window.open( "", "print",
"toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=250,height=200");
		if ( printWindow )
		{
		  printWindow.document.open() ;
		  printWindow.document.write("<html><body>Something to print</body></html>") ;
		  printWindow.document.focus() ;
		  printWindow.document.close() ;
		}
	  }
    -->
    </script>
  </head>

  <body>
    <button value="print" onClick="javascript:doPrint();"></button>
  </body>
</html>

Reproducible: Always
Steps to Reproduce:
1.Load the example into Mozilla
2.Click on the button
3.a second window appears and never stops loading
Actual Results:  
the newly created window never stops loading

Expected Results:  
the second window should get the focus and stop loading
*** Bug 264476 has been marked as a duplicate of this bug. ***
(In reply to comment #0) 
>     printWindow.document.focus() ; 
>     printWindow.document.close() ; 
 
There is no function document.focus(), so this causes a JavaScript error. Thus 
document.close() is never executed and Mozilla loads the page "forever". 
 
This is a dupe of bug 251529 (which is INVALID in my opinion). 

*** This bug has been marked as a duplicate of 251529 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.