Crash [@ nsPrintEngine::PrintPreview] when trying to print preview a display:none iframe

VERIFIED FIXED

Status

()

--
critical
VERIFIED FIXED
12 years ago
12 years ago

People

(Reporter: martijn.martijn, Assigned: mats)

Tracking

({crash, testcase})

Trunk
x86
All
crash, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(crash signature)

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

12 years ago
See upcoming testcase, which crashes Mozilla within 1 second.
Because of the use of enhanced privileges, you need to download the testcase to your computer.
This also crashes Mozilla1.7.12, so no (recent) regression.

Talkback ID: TB27739504H
nsPrintEngine::PrintPreview  [mozilla\layout\printing\nsprintengine.cpp, line 783]
DocumentViewerImpl::PrintPreview  [mozilla\layout\base\nsdocumentviewer.cpp, line 3557]
NS_InvokeByIndex  [mozilla\xpcom\reflect\xptcall\src\md\win32\xptcinvoke.cpp, line 102]
XPCWrappedNative::CallMethod  [mozilla\js\src\xpconnect\src\xpcwrappednative.cpp, line 2162]
(Reporter)

Comment 1

12 years ago
Created attachment 249656 [details]
testcase
(Assignee)

Comment 2

12 years ago
Created attachment 249668 [details] [diff] [review]
Patch rev. 1

This patch adds the same test in ::PrintPreview as is already present in ::Print
http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/layout/base/nsDocumentViewer.cpp&rev=1.505&root=/cvsroot&mark=3464-3471#3432
Attachment #249668 - Flags: review?(sharparrow1)

Comment 3

12 years ago
Comment on attachment 249668 [details] [diff] [review]
Patch rev. 1

Not the right fix; what we should be doing is checking the return value of the print engine Initialize call, which is failing because a null device context and parent widget are provided.
Attachment #249668 - Flags: review?(sharparrow1) → review-
(Assignee)

Comment 4

12 years ago
Hmm, the convention elsewhere in the code base seems to be that the
caller is responsible for not making calls with invalid arguments, and that
the callee asserts this. But you're right that we should also check the return
value from Initialize of course.
OS: Windows XP → All
(Assignee)

Comment 5

12 years ago
Created attachment 249693 [details] [diff] [review]
Patch rev. 2

Added some more error checking.  The first two hunks are unrelated - they fix
two compile warnings.
Attachment #249668 - Attachment is obsolete: true
Attachment #249693 - Flags: review?(sharparrow1)

Comment 6

12 years ago
Comment on attachment 249693 [details] [diff] [review]
Patch rev. 2

I'd say OOM rather than FAILEDNEW, although it doesn't matter very much.
Attachment #249693 - Flags: review?(sharparrow1) → review+
(Assignee)

Updated

12 years ago
Assignee: printing → mats.palmgren
(Assignee)

Updated

12 years ago
Attachment #249693 - Flags: superreview?(roc)
Attachment #249693 - Flags: superreview?(roc) → superreview+
(Assignee)

Comment 7

12 years ago
Ok, I changed FAILEDNEW to OOM.

Checked in to trunk at 2006-12-31 00:13 PST

-> FIXED
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
(Reporter)

Comment 8

12 years ago
Verified fixed, using:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2pre) Gecko/20070103 Minefield/3.0a2pre

I now get this error in the error console:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebBrowserPrint.printPreview]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///C:/Documents%20and%20Settings/mw/Bureaublad/365004_nsPrintEnginePrintPreview.htm :: printpreview :: line 30"  data: no]
Status: RESOLVED → VERIFIED
Crash Signature: [@ nsPrintEngine::PrintPreview]
You need to log in before you can comment on or make changes to this bug.