Closed Bug 86378 Opened 25 years ago Closed 24 years ago

[FIX]Print system does not listen to nsresult values...

Categories

(Core :: Printing: Output, defect)

All
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.8

People

(Reporter: roland.mainz, Assigned: rods)

Details

Attachments

(1 file)

[this is a general issue in the print system/API, I am using Xprint module only as an example here...] Any NS_ERROR_FAILURE returned by print DeviceContext methods used to indicate that something went wrong during setup is currently ignored by the underlying print system - causing crashes everywhere because the print system uses an invalid object (e.g. not properly initalized). For example - the following functions in Xprint module may return an error if something went wrong (printer not found, invalid printer attribute (DIN A3 on a printer which only supports DIN A4 etc.), illegal access, no memory etc. etc.): nsDeviceContextXp::SetSpec() nsDeviceContextXp::CreateRenderingContext() nsDeviceContextXp::InitDeviceContextXP() Optionally - for correctess - a failure returned by the following functions should _abort_ the print job. nsDeviceContextXp::BeginDocument() nsDeviceContextXp::EndDocument() nsDeviceContextXp::BeginPage() nsDeviceContextXp::EndPage() Suggested fix: Check nsresult for error and do not use half-initalized objects. I see a minor problem here: What happens if BeginDocument() returns NS_OK - but something after that point (BeginPage()/EndPage()/EndDocument()) failed ? I suggest to add a new method called "CancelDocument()" to tell the print module that the job has been canceled - and to give the print module a way to "clean up"... dcone: Is there a way to notify the user _why_ the print attempt failed (e.g. pass error message to user (dialog !?)) ?
Target Milestone: --- → mozilla0.9.8
Severity: critical → normal
Target Milestone: mozilla0.9.8 → mozilla1.0
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
rods: Wanna take a look at this one, please ?
taking bug
Assignee: dcone → rods
Target Milestone: mozilla1.0.1 → mozilla0.9.7
Status: NEW → ASSIGNED
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Attached patch patch — — Splinter Review
Added extra error codes for Start/End Doc/Page and now all paths terminating printing shows a dialog.
Summary: Print system does not listen to nsresult values... → [FIX]Print system does not listen to nsresult values...
Comment on attachment 63562 [details] [diff] [review] patch r=dcone
Attachment #63562 - Flags: review+
Comment on attachment 63562 [details] [diff] [review] patch sr=attinasi
Attachment #63562 - Flags: superreview+
fixed
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Roland, please verify and mark verified-fixed...thanks.
QA Contact: sujay → Roland.Mainz
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: