Closed Bug 297669 Opened 19 years ago Closed 19 years ago

Print 0 height/width IFRAME via Javascript print() causes endless print spooling.

Categories

(Core :: Printing: Output, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: bentrafford, Assigned: martijn.martijn)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4


In the example given at http://www.prodigal.ca/PrintFrameBug/, we have an IFRAME
that's been set to minimal size -- no borders, no margins, no height, no width.
This has been set via http://www.prodigal.ca/PrintFrameBug/test.css, as well as
in the HTML markup, itself.

In the parent document, there is a Javascript function to set focus and print
the IFRAME. The function is enabled via an onClick event in an A tag. When
clicked, the print process spools endlessly and does nothing. I would expect
either a failure message (e.g. "You can't print an invisible IFRAME, dude!") or
a print-out of the IFRAME's content.

On Windows XP Professional SP2, print spooling will not cancel once this link is
clicked until Firefox is shutdown completely.

Reproducible: Always

Steps to Reproduce:
1. Open Firefox to http://www.prodigal.ca/PrintFrameBug/
2. Click on the link that says "Print this."


Actual Results:  

My printer (and I tried six of them, including Adobe's Acrobat printer) spooled
and spooled and spooled. It would not cancel printing until I shutdown Firefox
completely, at which point, it was possible to cancel the print job.

Expected Results:  
Either printed the IFRAME's contents, which consists of a plain sentence saying,
"Is this going to work? Sure hope so!" or given me an error of some sort.


The files used to create this example are available for download at:

http://www.prodigal.ca/PrintFrameBug/printframebug.zip

The error occurred whether the file was opened locally or accessed via a server.
Additional testing using an onLoad function in the BODY of the IFRAME to try the
print() also created the same bug. In addition, both solutions were tested via
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414
Firefox/1.0.3," with the same result.
Could you test this with the nightly trunk build?
http://ftp.scarlet.be/pub/mozilla.org/firefox/nightly/latest-trunk/
Deer Park Alpha 1 has the exact same behavior as the other version. I select the
print link, the Printing dialog pops up and declaring that it is Preparing the
print; the printer in my taskbar appears, and when clicked, says it's
spooling...and then nothing.
Attached patch patchSplinter Review
Well, removing those lines makes it work for me.
I have no idea if that's allowed, though. Those lines might have been put there
for a reason :-)
Robert might know this.
Attachment #186842 - Flags: review?(roc)
Component: General → Printing
Flags: review?(roc)
Keywords: testcase
Product: Firefox → Core
Version: unspecified → Trunk
Attachment #186842 - Flags: review?(roc)
 *  Check to see if the FrameSet Frame is Hidden
 *  if it is then don't let it be reflowed, printed, or shown

So that really shouldn't be interfering with anything.
Robert, I'm confused as to what you mean by "it shouldn't be interfering with
anything." Do you mean that the behavior I'm seeing is correct, or that you have
no idea why it would be causing the print spooling problem?

I'm guessing that the print process isn't taking into account the directive to
be unprintable, which is a wrong-headed directive, anyhow. I should be able to
print even non-visible areas of a frame.
(In reply to comment #7)
> Robert, I'm confused as to what you mean by "it shouldn't be interfering with
> anything." Do you mean that the behavior I'm seeing is correct, or that you
> have no idea why it would be causing the print spooling problem?

The latter.

> I'm guessing that the print process isn't taking into account the directive to
> be unprintable, which is a wrong-headed directive, anyhow. I should be able to
> print even non-visible areas of a frame.

Yes, you probably should.
Comment on attachment 186842 [details] [diff] [review]
patch

Thanks for the link, Robert.
so basically I was disabling the whole CheckForHiddenFrameSetFrames function
here.
Maybe that whole function can be removed, without regressing bug 134769 now,
which it tried to fix.
(I saw your name on the bonsai blame, so I thought you might know this code)
Attachment #186842 - Flags: review?(roc)
Feel free to try it, Martijn :-)
Attached patch patch2Splinter Review
Ok, this seems to work without regressing bug 134769, on first sight.
Comment on attachment 187157 [details] [diff] [review]
patch2

Yeah, that looks good. If this causes a regression we should fix the underlying
bug rather than doing this hack.
Attachment #187157 - Flags: superreview+
Attachment #187157 - Flags: review+
Attachment #187157 - Flags: approval1.8b3?
Assignee: nobody → martijn.martijn
Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: general → printing
Comment on attachment 187157 [details] [diff] [review]
patch2

a=chofmann
Attachment #187157 - Flags: approval1.8b3? → approval1.8b3+
checked in
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Wow, that was fast. 
It'll not be likely that I can fix eventuel regressions. My c knowledge doesn't
go further than the ability to remove code.
Status: RESOLVED → VERIFIED
I'll take care of it if necessary
*** Bug 203334 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.

Attachment

General

Created:
Updated:
Size: