Closed Bug 1916730 Opened 2 months ago Closed 4 days ago

Printing the selection from the context menu doesn't capture the page title (which might end up falling back to "Firefox" if there's no URI)

Categories

(Toolkit :: Printing, defect, P3)

Firefox 130
defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: mattias.roy, Assigned: mstriemer)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0

Steps to reproduce:

Website-Inhalte gedruckt

Actual results:

Seit 12.08.2024 zeigt Firefox beim Drucken von Websitetexten bei aktivierter Option "Kopf- und Fußzeile drucken" in der Kopfzeile nicht mehr den Websitenamen an, stattdessen steht an deren Stelle "Firefox".

Expected results:

Es hätte der Websitename oben links stehen sollen.

I can't replicate on macOS and Nightly (Firefox 132), or Release (130).

Are you using the default print dialog, or are you switching to the system dialog?
Does it happen on all sites?

Not sure why the first page in your attachment is vertical, and the second landscape
https://www.nachdenkseiten.de/?p=120732

P.S. Bug reports on Bugzilla should be in English, using machine translation is fine in most cases.

Component: Untriaged → Printing
Flags: needinfo?(mattias.roy)
Product: Firefox → Toolkit
Summary: Beim Drucken von Website-Texten wird in der Kopfzeile statt des Websitenamens "Firefox" eingetragen. Dieses Verhalten tritt erst seit August 2024 auf. → When printing, the first page has "Firefox" instead of the web page title when footer is enabled

Hello, it is not a mistake. It does not always occur, only when selecting text passages, which I want to mark with the mouse and then have the selection printed.
I apologise.

Flags: needinfo?(mattias.roy)

Hello, how are you initiating the print? Is it from the right-click/context menu > Print selection... or through the primary Print shortcut/menu item and then changing the format to "Selection"? Does it also say Firefox for the entire page or just the selection? What version of Windows are you on?

Can you include a screenshot of the dialog where it's showing a preview with the Firefox text?

Flags: needinfo?(mattias.roy)

Hallo,
in der Kopfzeile erscheint "Firefox" dann, wenn ich Text einer Website markieren und diesen über das Kontextmenü "Auswahl drucken" an den Drucker weiterleite. Ich war der Ansicht, dass dann statt "Firefox" der Name der Website ausgegeben werden müsste.
Nutze ich aber die Druckfunktion, die eine Website selbst zur Verfügung stellt, erscheint dann auch der Name der Website in der Kopfzeile.
Ich fände es gut, wenn der Browser immer den Namen der Website mit ausgibt. Schön wäre auch ein Menü, in dem der Nutzer auswählen kann, was in der Kopf- und Fußzeile ausgegeben wird. Ähnlich wie bei den Office-Programmen.
Auf meinem Rechner läuft Windows 10 22H2 19045.4842.
Ich nutze zur Kommunikation die maschinelle Übersetzung des Browsers, ist eine gute Eigenschaft.

Hello,
"Firefox" appears in the header when I mark text on a website and forward it to the printer via the context menu "Print selection". I thought that instead of "Firefox", the name of the website would have to be displayed.
However, I use the print function, which a website itself makes available, the name of the website will then also appear in the header.
I think it would be good if the browser always includes the name of the website. It would also be nice to include a menu in which the user can choose what is output in the header and footer. Similar to the Office programs.
My computer runs Windows 10 22H2 19045.4842.
I use the machine translation of the browser to communicate, is a good feature.

Flags: needinfo?(mattias.roy)

Emilio, I'm not able to reproduce this bug, getting "Firefox" to be shown as the page title. When I print selection from the context menu I see the URL instead of the title for the page. Do you know if there's some way that may fall back to a default title in this case to cause this bug? Do you think this might be fixed by something like providing the page title from the primary document before we extract the selection content for printing?

Flags: needinfo?(emilio)

(In reply to Mark Striemer [:mstriemer] from comment #5)

Emilio, I'm not able to reproduce this bug, getting "Firefox" to be shown as the page title. When I print selection from the context menu I see the URL instead of the title for the page.

Yeah, I can see that. That does seem worth fixing.

Do you know if there's some way that may fall back to a default title in this case to cause this bug?

Yes, somewhat surprisingly: https://searchfox.org/mozilla-central/rev/c169f7d0287c1a6a5dd7469864135e605eed765f/layout/printing/nsPrintJob.cpp#533

I guess if in some site we end up getting a blank URI / empty docURL from the settings we could hit what the reporter is seeing. It seems fixing the above bug would also fix this.

Do you think this might be fixed by something like providing the page title from the primary document before we extract the selection content for printing?

Yeah, that seems about right. Or capturing the title before-hand... It seems this call should happen before we remove the title in here, but not 100% sure that's the code-path we're hitting without more debugging, and it's quite late here... Does that fix it on your end?

Flags: needinfo?(emilio) → needinfo?(mstriemer)

Hallo, ich kann Ihrer Diskussion nicht folgen. Muss ich etwas tun? Wenn ja, können Sie mir bitte mitteilen, was ich tun soll.

Hello, I can't follow your discussion. Do I need to do something? If so, please tell me what I should do.

No, I think we understand what is going on. Thanks!

Summary: When printing, the first page has "Firefox" instead of the web page title when footer is enabled → Printing the selection from the context menu doesn't capture the page title (which might end up falling back to "Firefox" if there's no URI)
Status: UNCONFIRMED → NEW
Ever confirmed: true

Providing the title in the settings does indeed work. Attaching a patch here that does that, if you think we should solve this in nsPrintJob though I'm good with abandoning the patch

Flags: needinfo?(mstriemer)
Assignee: nobody → mstriemer
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P3
Pushed by mstriemer@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a2d92a218347 Provide page title to print backend when printing selection r=sfoster
Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: