Closed Bug 126802 Opened 23 years ago Closed 16 years ago

Printing while in print preview disabled on Unix

Categories

(Core :: Print Preview, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: leon.sha)

References

Details

Attachments

(1 file)

BUILD: Linux 2002-02-20-08

STEPS TO REPRODUCE:
1)  Open a webpage
2)  Selecte File > Print Preview
3)  Click the "Print..." button

EXPECTED RESULTS:
A print dialog.

ACTUAL RESULTS:
An alert saying "You cannot print while in print preview".

NOTE:  This is because the "print.whileInPrintPreview" pref is set to false in
unix.js.  Is there a reason for this?  Is there UI for this pref somewhere?
Printing while in p
bz:
The reason why this was turned off is that we have tons of global vars in both
PostScript and Xprint module which cannot be shared by multiple instances of
nsDeviceContextPS/nsFontMetricsPS(PostScript module) or
nsDeviceContextXp/nsFontMetricsXlib(Xprint module).
If we try to share the global vars we corrupt the heap (try it yourself and
watch the output of rational purify... =:-) - and crash sooner or later.
Print preview already needs one device context, therefore there is no one left
for printing itself. Shareing the device context between print preview and print
system does not work either as the user may change properies in the
nsIPrintSettings via the print dialog (and print dialog startup calls
InitPrintSettingsFromPrinter() which cleans the object, too).

rods filed bug 119491 ("Cleanup global vars in PostScript and Xprint modules")
to get that fixed, however this requires to move massive amounts of code as each
reference to a global var/object has to be touched. The fix is easy but I do not
know whether anyone will approve such a code change before 1.0. If you find a
driver who says "OK for that before 1.0" will start hacking the patch...
Depends on: 119491
If bug 119491 is not going to be fixed for mozilla1.0 then we should hide the
print button on unix (although this seems like quite a user experience hit). 
Nominate this bug if we are planning to hide the print button on unix.
Target Milestone: --- → Future
Ah, OK.  In that case, please just remove the "Print..." button on Unix for now
till that bug is fixed (dymically set display:none based on the pref value
should work fine).
Er... like "We should do what Samir said".  The user experience hit of a print
button that pops up modal alerts is much greater than the hit of a hidden (or
even just disabled) print button.
bug 119491 can be fixed before 1.0, but I'd like to have somehow the gurantee
that noone blocks the patch. I do not want to spend two or more sleepless days
to hack&test the patch and then get the message "thumbs down, not for 1.0" -
which would cause bitrot in the patch (which is very very bad for large patches,
I am expecting that the patch size will be beyond 250k).
{ hack patch, request r=, sleep, fix review issues, request sr=, sleep, fix
superreview issues, check it in } should be "done" in less than one week if
possible...
Brendan, would a patch for this be able to get a= for 1.0?
No, actually this bug is worse than that. If you are in PrintPreview you cannot
change any settings and redo PP without a crash. See Bug 127627
nominating...
Keywords: nsbeta1
nsbeta1+ per Nav triage team. If possible, we should fix this by just getting
rid of the print button in PP in Linux. ->1.0
Keywords: nsbeta1nsbeta1+
Target Milestone: Future → mozilla1.0
Peter Trudelle wrote:
> nsbeta1+ per Nav triage team. If possible, we should fix this by just getting
> rid of the print button in PP in Linux. ->1.0

Removing the print button won't work. For some unknown (to me :) reason the
PrintPreview stuff sometimes wants to create more than one print device context
- which does currently not work because both implementations (PostScript and
Xprint) use global vars which cannot be shared between more than one object
instance. Currently the device contexts have a "safeguard" implemented to avoid
the creation of more than one print device object (otherwise we crash sooner or
later because the objects corrupt their global vars). A side-effect of the
safeguard is that most of the functionality in PrintPreview is defunct (still
better than random crashes due heap corruption... =:-)

bug 119491 ("Cleanup global vars in PostScript and Xprint modules") will fix
that (I am working on it currently) ...
The print button is already gone from print preview.  This bug is about being
able to print, not about not getting an error alert.  Please leave it open to
track reinstating the print button.
Alright, but this is another reason why morphing bugs is bad. If this is now
seen as getting print back, then it should be nsbeta1-, ->1.2/helpwanted

Roland, we noted the dep bug you are working on, but thought that was in danger
of not making 1.0.  If you get these in, great, if not we will probably have to
live with not being able to print from print preview, but that is still better
than what we had before (i.e, not print preview at all)
Target Milestone: mozilla1.0 → mozilla1.2
Peter Trudelle wrote:
> Roland, we noted the dep bug you are working on, but thought that was in 
> danger of not making 1.0. 

Not really. I think it's possible for me to get it fixed before we freeze for
1.0 (no gurantee yet, I am being punished with a defunct Purify (customer
escalation pending...) which slows-down development a lot... ;-( ).

I already have a half-done prototype ...
Apparently, Mozilla (at least rc1) can get confused and think it is always in
print preview mode. Just happened to me. I filed bug 142410 on it.
*** Bug 156290 has been marked as a duplicate of this bug. ***
I have fixed the issue as part of bug 187125 - PrintPreview's toolbar is now
enabled again if the underlying device code supports multiple device instances
(this is true for the Xprint module, the PostScript module may likely never be
fixed).

Marking bug as FIXED.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Louie/Pete, any thoughts with regard to comment 16 ?
Um, this is _not_ fixed, since my steps to reproduce still fail.  Note that I am
using whatever comes default with Mozilla for printing (that happens to be the
PS module).

Feel free to mark this fixed once Xprint is the default module or to mark it
wontfix if you don't plan to fix it...
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
*** Bug 214486 has been marked as a duplicate of this bug. ***
Blocks: 230287
*** Bug 230692 has been marked as a duplicate of this bug. ***
Assignee: sgehani → core.printing
Status: REOPENED → NEW
*** Bug 256094 has been marked as a duplicate of this bug. ***
I set the pref print.whileInPrintPreview to true, and could make multiple prints
without a problem. (to a file actually, because i don't have a printer on this box)
From scanning the code, i didn't see much global vars in gfx/src/ps. The ones
that i did see didn't look like a problem.
does this mean we can enable printing from print preview for ps again?
(cvs build 20041107, no xprint, fc2)
If I set print.whileinPrintPreview to TRUE in about:config I still encounter this error.

The error also seems to happen when printing more than one document at the same time.
Since firefox 3.0 is no longer use postscript/xprint, can we enable print.whileinPrintPreview now. I just tested it on linux, this feature works.
This bug should be already fixed by using cairo priting. So need to enable this feature in preference.
Attachment #333675 - Flags: review?(bzbarsky)
Comment on attachment 333675 [details] [diff] [review]
patch to enable printing while in print preview

Sorry, I have no idea whether this is the right thing to do, or what the new printing code looks like.  You'll have to get review from someone who does, and can confirm that none of the relevant code that used global variables exists anymore.
Attachment #333675 - Flags: review?(bzbarsky) → review?
Attachment #333675 - Flags: review? → review?(roc)
Comment on attachment 333675 [details] [diff] [review]
patch to enable printing while in print preview

We're certainly not using any of the code mentioned in comment #1. The code in nsDeviceContextSpecG.cpp looks fine and I'm not aware of any other problems. I say, enable it and if something bad happens, we'll fix it. There won't be serious stability/security problems since this is something the user has to go out of their way to trigger.
Attachment #333675 - Flags: review?(roc) → review+
Assignee: printing → nobody
Keywords: helpwanted
QA Contact: sujay → printing
Assignee: nobody → leon.sha
Target Milestone: mozilla1.2alpha → ---
Attachment #333675 - Flags: superreview?(roc)
Attachment #333675 - Flags: superreview?(roc) → superreview+
changeset 16985	366ff8a1133f
parent 16984	79040d7ff66c
child 16986	98cbd06e2376
Bug 126802 Printing while in print preview disabled on Unix. roc: review+ roc: superreview+ 
Status: NEW → RESOLVED
Closed: 22 years ago16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: