bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

Can't print with today's 09/28/01 Mozilla Trunk Build.




Printing: Output
17 years ago
17 years ago


(Reporter: kinmoz, Assigned: rbs)



Windows 2000

Firefox Tracking Flags

(Not tracked)



(1 attachment)



17 years ago
Printing seems to be broken in my 09/28/01 Debug Mozilla Trunk Build.

Every time I press the OK button on the print dialog to start printing ...  I 
get a "Failure" dialog.

It seems that the call to StartDoc() in nsDeviceContextWin::BeginDocument() 
(nsDeviceContextWin.cpp line 756) fails and short circuits the printing process.

Comment 1

17 years ago
cc: twalker
Keywords: smoketest
Reassigning to Rod.
Assignee: dcone → rods

Comment 3

17 years ago
no problem printing on linux, but it's another dialog as far as I know.

Comment 4

17 years ago
Cc'ing rbs@maths.uq.edu.au ... rbs any chance this could've been caused by your 
landing yesterday?
Has anyone traced the source of the failure result?
I just pulled and built the trunk on WINNT and it prints fine.
Attinasi has a trunk build from this morning on WIN2K and it fails for him. His
build should be about the same as my trunk build on WINNT.

Looks like its WIN2K specific.

Comment 8

17 years ago
As I said above, nsDeviceContextWin::BeginDocument() is calling ::StartDoc(), 
which is failing with a -1 value which then gets mapped to an NS_ERROR_FAILURE.

I added the following call after ::StartDoc():

    DWORD err = ::GetLastError();

to retrieve the OS Error, and it returns err == 6 (ERROR_INVALID_HANDLE)
I would guess the mDC (printer device handle) must be bad. Either it was never
allocated in the first place or it was released.

Comment 10

17 years ago
WFM on win98 using 9/28 build. must be win2K specific.

Comment 11

17 years ago
Not sure if this is related or not ... I put a call to GetLastError() after the 
call to CreateDC() in nsDeviceContextWin::GetDeviceContextFor(), and it returns 
a 50 (ERROR_NOT_SUPPORTED (The network request is not supported.)). Here's 
what's being passed into CreateDC() in my case:

    drivername == "winspool"
    devicename == "Print to File (HP LaserJet 5 PostScript)"

Does that mean the DC it returns isn't valid or a type we expect?

Comment 12

17 years ago
Puzzling that it works on some systems and doesn't work on some. My checkins
didn't involve nsDeviceContextWin per se. Maybe another problem was exposed.
Here are links to the win32-specific parts of my checkins if they can be of any

Comment 13

17 years ago
Could people seeing the problem try what kin did above, i.e., 
printf("error:%d\n", ::GetLastError()) - that might help to know if the problem
can be isolated in that function.

Comment 14

17 years ago
This is me. Kevin's gut feeling was right and provided the helpful clue...
Click on the first link, and look at the second match of Find of: 
::ReleaseDC(win, mDeviceContext->mDC ? dc : dc1)

See how the logic is twisted!! Will attach the fix shortly.
Assignee: rods → rbs

Comment 15

17 years ago
Created attachment 51472 [details] [diff] [review]
fix, ready for r/sr

Comment 16

17 years ago
I think renaming the two dc might be helpful, also put a comment in front of 
this call explaining why you are doing the check and what exactly failure means:
  nsFontWin* font = FindFont(dc1, 'a');


Comment 17

17 years ago
Yup the patch allows printing again in my build.

sr=kin@netscape.com after addressing rod's comments.


17 years ago
Attachment #51472 - Flags: superreview+
Attachment #51472 - Flags: review+

Comment 18

17 years ago
> nsFontWin* font = FindFont(dc1, 'a');

In fact, I don't think the check for a non-null |font| is even worth it.
Failure never happens and in the even of failure (i.e., if there is no font at
all to represent the simple letter 'a') the program cannot work, a crash will
happen sooner or later.

Comment 19

17 years ago
Fix checked in.
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 20

17 years ago
*** Bug 102586 has been marked as a duplicate of this bug. ***


17 years ago
Summary: Can't print with today's 09/28/01 Mozilla Trunk Build. → Can't print on Win2K with today's 09/28/01 Mozilla Trunk Build.

Comment 21

17 years ago
*** Bug 102604 has been marked as a duplicate of this bug. ***

Comment 22

17 years ago
*** Bug 102605 has been marked as a duplicate of this bug. ***

Comment 23

17 years ago
not Win2K specific....removing from subject
Summary: Can't print on Win2K with today's 09/28/01 Mozilla Trunk Build. → Can't print with today's 09/28/01 Mozilla Trunk Build.

Comment 24

17 years ago
okay this should now be fixed in today's trunk builds.
Can people on the cc: list who have Win2K please try it out
and report back here in the bug report? thanks.

Comment 25

17 years ago
seems to be working for me now.

Comment 26

17 years ago
okay marking VERIFIED...REOPEN if any of you are still having problems
printing with Win2K..thanks.

Comment 27

17 years ago
*** Bug 103237 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.