532 bytes, patch
|Details | Diff | Splinter Review|
mozilla/layout/base/src/nsDocumentViewer.cpp around line 1497 does: // get the document title const nsString* docTitle = mDocument->GetDocumentTitle(); PRUnichar * docStr = docTitle->ToNewUnicode(); printService->SetTitle(docStr); nsMemory::Free(docStr); This crashes if mDocument->GetDocumentTitle() returns NULL, as it does when printing a picture (or probably an XML file, untested). This requires at least a null pointer check. STEPS TO REPRODUCE 1. Go to an image, for example: http://www.dilbert.com/comics/dilbert/archive/images/dilbert20010121044118.gif 2. Print. ACTUAL RESULTS 1. Laugh at picture. 2. Cry at crash. EXPECTED RESULTS 1. Laugh at picture. 2. Collect printout and stick it to your cube wall. 3. Watch other people laugh at picture. This bug was introduced by Rod's recent checkin, so assigning direct to him.
reassigning to dcone he has a fix in his tree for this, I have already checked in the fix on the embed branch for this
verified in 2/26 build.
The fix for this bug corrects the crash, but introduces other behaviour which is not ideal. Specifically, there are bugs 80799 and 81848 which are mis-listed as duplicates of 71976 but aren't... With this fix, a document with no title will print with the title of the previous printed page. The correct fix for this is actually the fix for 71976, which gets rid of the unprotected check of the title pointer. To fix the stale title, I propose one of two patches. Either allow the title to be null in the print properties, or set it to the empty string if it is null... I am testing patches as I type this... Should I enter this as a new bug, or is one of the bugs mentioned here more appropriate?
Created attachment 39065 [details] [diff] [review] Fixes printing of title for document with no title
I filed a new bug for this, Bug: 86558 and included my patch