Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 312018 - Page with "long" title saved as PDF as "Untitled.pdf"
: Page with "long" title saved as PDF as "Untitled.pdf"
: testcase, verified1.8.1.12
Product: Core
Classification: Components
Component: Printing: Output (show other bugs)
: unspecified
: PowerPC Mac OS X
: -- normal (vote)
: ---
Assigned To: Stuart Morgan
: Jet Villegas (:jet)
: 410527 (view as bug list)
Depends on:
Blocks: 407434
  Show dependency treegraph
Reported: 2005-10-11 01:25 PDT by Smokey Ardisson (offline for a while; not following bugs - do not email)
Modified: 2008-12-26 15:52 PST (History)
11 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Shorter, but long-ish, title (375 bytes, text/html)
2005-10-11 01:26 PDT, Smokey Ardisson (offline for a while; not following bugs - do not email)
no flags Details
fix (2.31 KB, patch)
2008-01-04 08:53 PST, Stuart Morgan
jaas: review+
benjamin: superreview+
dveditz: approval1.8.1.12+
mtschrep: approval1.9+
Details | Diff | Splinter Review

Description Smokey Ardisson (offline for a while; not following bugs - do not email) 2005-10-11 01:25:09 PDT
If you save a page with a long-ish title as a PDF from the Print dialogue,
Camino suggests a filename of "Untitled.pdf" instead of "Document Title.pdf". 
However, this only seems to happen the *first* time you perform a "printing"
operation on the page; if you've previously printed the page (the print job has
the full document name, as expected, even if it's the first printing operation
performed on a page) or saved the page as PDF, then saving as PDF (as the second
print operation) gets the full document title suggested as the filename.  

Firefox properly suggests the full document title as the PDF name the first time
out of the box.  It even does it with really long titles, like that in the URL

This happens even with a fresh launch of Camino, so it's not bug 303547.
Comment 1 Smokey Ardisson (offline for a while; not following bugs - do not email) 2005-10-11 01:26:47 PDT
Created attachment 199148 [details]
Shorter, but long-ish, title

Er, Camino 2005101004 (v1.0a1+) here, 10.3.9.
Comment 2 Smokey Ardisson (offline for a while; not following bugs - do not email) 2007-02-25 14:06:24 PST
Other sorts of pages (like bug query results, which have title "Bug List") also do this; I wonder if there's something about "generated"/dynamic pages that also causes this?
Comment 3 Livin Stephen Sharma 2007-03-12 11:17:20 PDT
1. WRT the Description:
> …Camino suggests a filename of "Untitled.pdf"…

 I found the "Untitled" to actually be ".pdf" - and this is pre-highlighted/selected when the dialogue pops up, and can be replaced like any transient selection; so that the suggested title is ".pdf.pdf".

2. And a quick question WRT Comment #1:
 Is the "Title:" of the attachment (id=199148) (displaying the following text)

> "Testcase for long titles being saved as Untitled.pdf"

 - seen in the "Page Info" (Cmd-I) window -
 supposed to be…
> "State Assistance Programs for SSI Recipients, January 2005 - Massachusetts" ?
Comment 4 Livin Stephen Sharma 2007-03-12 11:18:37 PDT
I'm using "Version 2007022701 (1.1b+)".
Comment 5 Smokey Ardisson (offline for a while; not following bugs - do not email) 2007-06-13 20:22:22 PDT
Mass un-setting milestone per 1.6 roadmap.

Filter on RemoveRedonkulousBuglist to remove bugspam.

Developers: if you have a patch in hand for one of these bugs, you may pull the bug back to 1.6 *at that point*.
Comment 6 Stuart Morgan 2008-01-04 08:53:13 PST
Created attachment 295384 [details] [diff] [review]

The issue here (and in bug 303547, although I don't know what causes the different bad default there) is that the print job name is set only once we actually start printing, and it's supposed to be set before showing the panel according to the Carbon printing docs. This will grab the page title and insert it into the print settings just before opening the panel, which seems like the right solution.

It's not clear to me whether or not Firefox uses this code; the comments above sound like not, but I would have thought that they would...

Josh, if you aren't a good person to review this, please let me know who is.
Comment 7 Stuart Morgan 2008-01-04 09:32:13 PST
And actually, I think the underlying issue does affect Firefox; I suspect this fix would also cover bug 410527 and bug 244814 (as well as Camino bug 407434).

Bug 407434 is probably the clearest description of the basic problem.
Comment 8 Josh Aas 2008-01-08 20:47:49 PST
Comment on attachment 295384 [details] [diff] [review]

looks good, thanks Stuart!
Comment 9 Stuart Morgan 2008-01-08 22:16:49 PST
Comment on attachment 295384 [details] [diff] [review]

pink, are you a good person to sr this?
Comment 10 Samuel Sidler (old account; do not CC) 2008-01-08 22:28:58 PST
Boris or Benjamin should probably look at this patch.
Comment 11 Benjamin Smedberg [:bsmedberg] 2008-01-09 07:41:59 PST
Comment on attachment 295384 [details] [diff] [review]

>Index: embedding/components/printingui/src/mac/nsPrintingPromptServiceX.cpp

>+    // Set the print job title
>+    PRUnichar** docTitles;
>+    PRUint32 titleCount;
>+    webBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles);

Please add an nsresult-check here.

>+        nsMemory::Free(docTitles[i]);

Here and below please use NS_Free instead of nsMemory::Free.

sr=me with those changes
Comment 12 Stuart Morgan 2008-01-10 15:45:26 PST
Landed on trunk with the above changes.

Moving to Core, since that's probably where it belonged in the first place.
Comment 13 Smokey Ardisson (offline for a while; not following bugs - do not email) 2008-01-10 20:30:55 PST
Verified fixed with tinderbuild:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en; rv:1.9b3pre) Gecko/2008011019 Camino/2.0a1pre (like Firefox/3.0b3pre)
Comment 14 Smokey Ardisson (offline for a while; not following bugs - do not email) 2008-01-10 20:54:46 PST
I also ran through these testcases and a number of random pages (since bug 410527 and bug 244814 have no testcases) in the equivalent Minefield tinderbuild and could not trigger this bug (again, on 10.5.1):

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3pre) Gecko/2008011019 Firefox/3.0b2pre
Comment 15 Daniel Veditz [:dveditz] 2008-01-14 16:18:41 PST
Comment on attachment 295384 [details] [diff] [review]

approved for, a=dveditz for release-drivers
Comment 16 Stuart Morgan 2008-01-14 19:22:35 PST
Landed on MOZILLA_1_8_BRANCH, with PMSetJobNameCFString instead of PMPrintSettingsSetJobName; the latter is the 10.4+ only version of the function (the former being deprecated as of 10.5), but both take the same arguments and have the same purpose and behavior.
Comment 17 Al Billings [:abillings] 2008-01-22 16:51:50 PST
Sam Sidler, can you track down a Camino nightly using the 1.8 branch and verify this?
Comment 18 Smokey Ardisson (offline for a while; not following bugs - do not email) 2008-01-22 18:31:35 PST
Verified fixed on the branch with Camino 1.6b2 on 10.3.9/PPC and 10.5.1/Intel:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv: Gecko/20080118 Camino/1.6b2 (like Firefox/
Comment 19 Smokey Ardisson (offline for a while; not following bugs - do not email) 2008-12-26 15:52:47 PST
*** Bug 410527 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.