Closed Bug 264476 Opened 20 years ago Closed 7 years ago

Printing is blocked if document.open() is not followed by document.close()

Categories

(Core :: Printing: Output, defect)

x86
All
defect
Not set
minor

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Josef.Rosenlehner, Unassigned)

References

()

Details

(Keywords: testcase, Whiteboard: DUPEME)

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

If i use the window method focus(), the sandglass will stay forever and the page
can't be printed because loading will never finish.
If i omit the focus() method it works well.

Examplpe focusError.html:
<!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 focusError.html into Mozilla 1.8a4
2.click to the only button
3.now try to print the page
Actual Results:  
You get an error mesage "wait til loading has finished"
and the sandglass will never go away

Expected Results:  
The page should finish loading and the sandglass should go away.

*** This bug has been marked as a duplicate of 263977 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Not a dupe. The other bug leaves out the third step

3.now try to print the page

which turns out to be the interesting part.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
(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".

So this is basically a programming error in your side (when you correct the
error everyting works as expected).

Still it seems to be a bug that that File|Print... is blocked in this case.

Note: When you leave out the doc.write(...) call from the testcase the document
still loads "forever", but File|Print... is *not* blocked.

> Actual Results:  
> You get an error mesage "wait til loading has finished"

This alert only comes up when you select "File|Print Preview", not "File|Print...".

Tested with a Seamonkey gtk2 trunk build from yesterday.
Assignee: general → core.printing
Severity: normal → minor
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Printing
Ever confirmed: true
Keywords: testcase
OS: Windows XP → All
QA Contact: pschwartau
Summary: window.focus() runs into a forever loop → File|Print... is blocked while loading this testcase (javascript:win=window.open();doc=win.document.open();doc.write(""))
I think we have an existing bug on the fact that you can't print pages that
aren't done loading.
Whiteboard: DUPEME
(In reply to comment #4)
> I think we have an existing bug on the fact that you can't print pages that
> aren't done loading.

perhaps there is but I couldn't find one.
filed bug 306850
(In reply to comment #4)
> I think we have an existing bug on the fact that you can't print pages that
> aren't done loading.

bz are you thinking of Bug 150200
*** Bug 350247 has been marked as a duplicate of this bug. ***
Adding dependency per comment #5.
Depends on: 306850
Assignee: printing → nobody
QA Contact: printing
Status: NEW → RESOLVED
Closed: 20 years ago7 years ago
Resolution: --- → WONTFIX
Summary: File|Print... is blocked while loading this testcase (javascript:win=window.open();doc=win.document.open();doc.write("")) → Printing is blocked if document.open() is not followed by document.close()
You need to log in before you can comment on or make changes to this bug.