Unknown error alert displayed when trying to print from computer that has no installed printer

VERIFIED FIXED

Status

()

Core
Printing: Setup
--
minor
VERIFIED FIXED
8 years ago
8 years ago

People

(Reporter: George Carstoiu, Assigned: timeless)

Tracking

({regression})

Trunk
x86
All
regression
Points:
---

Firefox Tracking Flags

(blocking2.0 final+)

Details

(Whiteboard: [hardblocker])

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0b8) Gecko/20100101 Firefox/4.0b8

When trying to print a website using either the "Print" option or the Ctrl+P shortcut an error message is received.

Reproducible: Always

Steps to Reproduce:
Prerequisites:
 - computer that has no installed printer

Steps to reproduce:
1. Open website
2. Press Ctrl+P 


Actual Results:  
An error message is displayed saying that "An unknown error occurred while printing."

Expected Results:  
An error message is displayed informing the user that there is no printer installed on the system
Confirmed using Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b9pre) Gecko/20101215 Firefox/4.0b9pre ID:20101215030322
Status: UNCONFIRMED → NEW
Component: General → Printing: Setup
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → printing.setup
Version: unspecified → Trunk
In 3.6.13, works fine, ie this shown instead:
"Before you can perform printer-related tasks such as page setup or printing a document, you need to install a printer. Do you want to install a printer now? Yes/No"

Therefore regression in Fx4.

Last good nightly: 2010-12-03 
First bad nightly: 2010-12-04

Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=0ff6d5984287&tochange=cd392793b0c0

Suspect:
http://hg.mozilla.org/mozilla-central/rev/5bab39756981
Bug 612272 crash [@ ShowNativePrintDialog ] when trying to print some pages
Blocks: 612272
blocking2.0: --- → ?
Keywords: regression
(In reply to comment #2)
> Suspect:
> http://hg.mozilla.org/mozilla-central/rev/5bab39756981
> Bug 612272 crash [@ ShowNativePrintDialog ] when trying to print some pages

Josh, could you check this?
blocking2.0: ? → final+
(Assignee)

Updated

8 years ago
Severity: normal → minor
(Assignee)

Comment 4

8 years ago
fwiw, in some versions of windows you get a dialog like this:

http://www.physiology.wisc.edu/comp/blog/2008/figs/bbf20081208_01_f01.jpg

The w7 dialog actually offers the option to install a printer now from that dialog.

Anyway, one or both of these hunks are probably relevant,

    1.45 @@ -858,31 +856,41 @@ ShowNativePrintDialog(HWND              
    1.71 -  NS_ASSERTION(printerName, "We have to have a printer name");
    1.72 -  if (!printerName) return NS_ERROR_FAILURE;
    1.73 +  NS_ASSERTION(!printerName.IsEmpty(), "We have to have a printer name");
    1.74 +  if (printerName.IsEmpty()) {
    1.75 +    return NS_ERROR_FAILURE;
    1.76 +  }

my guess is that we're currently dying in the above return

   1.104 @@ -1218,11 +1225,10 @@ ShowNativePrintDialogEx(HWND            
   1.113 -  if (printerName) {
   1.114 -    NS_ENSURE_SUCCESS(rv, rv);
   1.115 +  if (!printerName.IsEmpty()) {
   1.116      hGlobalDevMode = CreateGlobalDevModeAndInit(printerName, aPrintSettings);
   1.117    }

And we'd probably fail this if too. I'm grabbing symbols for ff3.6.13 so i can trace through the code.

Thanks for the report. I'm rather curious how you managed to have 0 printers on wXP and decided to use ctrl-p. I should be able to have a patch today or tomorrow either way, but I'd love to understand your use case, do you do this often? Is there something special you can do from the dialog? Was the computer "new"?

FWIW on my w7 starter ideapad I had a Fax driver (which I believe was preinstalled) + XPS (which I installed so I could "print" by passing a file to another computer which already had a real printer configured).
OS: Windows XP → All
(Assignee)

Comment 5

8 years ago
ok, it turns out that for the first hunk, we'd have a printername of "", so that hunk's additions need to be removed.

the second part i highlighted is probably not hit in our releases (which is why no one noticed its otherwise strange behavior).
(Assignee)

Comment 6

8 years ago
Created attachment 498982 [details] [diff] [review]
remove we must have a printername requirement

this is vaguely important since it removes code which currently blocks people who have no printers from getting a print dialog (which in modern windows allows users to add printers). This was caused by an error I made in interpreting an assertion, the code path for no printer maps to "" which was treated differently from 0 in the code before I cleaned it up.
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #498982 - Flags: review?(matspal)
Attachment #498982 - Flags: approval2.0?

Updated

8 years ago
Attachment #498982 - Flags: approval2.0?

Updated

8 years ago
Summary: Unknown error alert displayed when trying to print from computer that has no installed printer → [needs review] Unknown error alert displayed when trying to print from computer that has no installed printer
Whiteboard: [hardblocker]
Comment on attachment 498982 [details] [diff] [review]
remove we must have a printername requirement

r=mats
Attachment #498982 - Flags: review?(matspal) → review+
Summary: [needs review] Unknown error alert displayed when trying to print from computer that has no installed printer → Unknown error alert displayed when trying to print from computer that has no installed printer
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/088b1b76dc61
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
Gorge, can you please check it again in the latest Minefield build? Is it fixed for you?
I could previously replicate and now can't as of Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b10pre) Gecko/20110116 Firefox/4.0b10pre ID:20110116030325

However, when I press "no" on the "Do you want to install a printer?" prompt (it's the old style prompt, not tab modal), scrolling with the mouse wheel cannot occur until you switch to another tab and back again. I've had a search and can't find anything like it reported already. Do you think it's an underlying bug (perhaps due to the tab modal prompts) that's only now exposed or might it be a new regression?
Please file it as a new bug and attach a screencast if possible. It would make it easier for others to follow. Thanks.

Marking as verified fixed based on comment 10.
Status: RESOLVED → VERIFIED
(Reporter)

Comment 12

8 years ago
Build identifier: Mozilla/5.0 (Windows NT 6.1; rv:2.0b10pre) Gecko/20110116 Firefox/4.0b10pre

I just check it Henrik and it looks ok now. I was unable to reproduce the "unknown error" alert message.
(In reply to comment #11)
> Please file it as a new bug
Filed here: Bug 626403
You need to log in before you can comment on or make changes to this bug.