Open Bug 1521655 Opened 5 years ago Updated 2 days ago

[meta] Support client-side printing in Google Docs and GSuite (Google Workspace)

Categories

(Core :: Printing: Setup, enhancement, P1)

Unspecified
All
enhancement

Tracking

()

Webcompat Priority P2

People

(Reporter: karlcow, Unassigned)

References

(Depends on 6 open bugs, )

Details

(Keywords: meta, Whiteboard: [layout:backlog][print2020])

Attachments

(1 file)

This is a bug reported on webcompat.com.
See https://webcompat.com/issues/22225

The reporter tried to print a document by clicking the print icon.

On Firefox it brings (on macos) The PDF save menu for printing.
On Chrome it directly open the document to be printed.

On Firefox, if you select File -> Print, you get the equivalent menu than Chrome.

Interestingly on Firefox there's a network request for the PDF, whereas Chrome doesn't do any network request when you hit their print button.

Firefox still attempts to print the right thing when you do File -> Print though.

This makes me think there's some sort of API or something that docs is using. I realise it was mentioned that the user agent was changed to Chrome, but I wouldn't be surprised if they're doing API detection rather than user agent detection.

Moving across to Toolkit -> Printing to hopefully get some more experienced eyes on this.

Component: General → Printing
Priority: P3 → --
Product: Firefox → Toolkit

I believe the only way for content to request a print job for a document is to call window.print() on the window hosting the document.

Since Docs is probably generating a PDF on the server side and sending it back to the client, my hypothesis is that there's probably a hidden <iframe> hosting that PDF, and some script might be trying to call iframe.contentWindow.print() on it. I'm not 100% certain that we allow this - looking at nsGlobalWindowOuter::PrintOuter (which is what iframe.contentWindow.print() would resolve to), I see this code that checks to see if we're in a window that has dialogs enabled, and I think hidden iframes fail that check because of this code here.

My guess is that Docs is falling back when iframe.contentWindow.print() fails, and offering up the save dialog instead.

I think I'm actually inclined to move this over to Core :: DOM, since (if my guesses here are right) I think this is more about that check in nsGlobalWindowOuter::PrintOuter for dialog capabilities.

Component: Printing → DOM
Product: Toolkit → Core

Thanks Mike for the details.
Hi Neha, this looks like at your team's wheelhouse. Can you help with it? Thanks

Component: DOM → Document Navigation
Flags: needinfo?(nkochar)

Google Docs doesn't even call window.print when using FF.

Component: Document Navigation → Desktop
Product: Core → Tech Evangelism
Version: 63 Branch → Trunk
Flags: needinfo?(nkochar)
Component: Desktop → PDF Viewer
Product: Tech Evangelism → Firefox

...and the reason is probably that FF throws an exception.
http://mozilla.pettay.fi/moztests/1.html is a testcase.

Safari and Edge are also downloading the PDF. Chrome and Opera are getting the print menu.

Started a conversation with Google about this on our gsuite mailing list, CC'd :smaug.

Was there any conclusion on the mailing list?

Flags: needinfo?(astevenson)

We're missing some css print features, especially @page size.

Component: PDF Viewer → Layout
Product: Firefox → Core
Flags: needinfo?(astevenson)
Whiteboard: [layout:triage-discuss]

We have pretty insightful info from Google now based on the mailing list conversation on how to improve things here. Triaging to P3 with an intent to get this on our backlog sooner than later.

Priority: -- → P3
Whiteboard: [layout:triage-discuss]
Whiteboard: [layout:backlog]
Webcompat Priority: --- → P1
Attached image print-menu-command-P
  • Command P brings the print menu on macos + firefox 83.0a1 (2020-10-05) (64-bit)

But when selecting the print icon of the document, after a little while it proposes to save or open the file as pdf.

So this is not solved. But an interesting thing is that if I masquerade the user agent to be Chrome, the normal print menu is invoked. The rendering of the page is not finishing but at least it is calling the right thing.

So it seems there is a bit of user agent sniffing involved. It would be good to figure out why on the other hand the rendering is not fully completed or it does a Preview of the file and it crashes the tab.

Sean,

is there a meta bug for printing issues

Flags: needinfo?(svoisen)
Depends on: 851441

(In reply to Karl Dubost💡 :karlcow from comment #12)

Sean,

is there a meta bug for printing issues

We are having ongoing meetings with Google about supporting this. Unfortunately, it's not a simple matter of masquerading the UA as mentioned. We need to support @page { size } amongst other things to get client-side print support in Gsuite. But, this is our next big printing project once the new print UI work wraps up.

We don't have a single metabug for all printing improvements (other than fragmentation bugs), but we have been using the [print2020] whiteboard tag for tracking higher-priority print items.

Flags: needinfo?(svoisen)
Priority: P3 → P1
Whiteboard: [layout:backlog] → [layout:backlog][print2020]

Turning this into a meta bug to track all of the G Suite client-side printing work.

Severity: normal → N/A
Component: Layout → Printing: Setup
Keywords: meta
OS: Windows 10 → All
Summary: docs.google.com - Printing behaves differently in chrome and firefox → [meta] Support client-side printing in Google Docs and GSuite (Google Workspace)
Depends on: 1673987
Webcompat Priority: P1 → P2
Depends on: 1816345
Depends on: 1816554
Depends on: 1820892
Depends on: 1853773
Depends on: 1853766
Depends on: 1856081
Depends on: 1853455
No longer depends on: 1816554
Depends on: 1819335
Depends on: 1859634
Depends on: 1865155
Depends on: 1865172
Depends on: 1865200
Depends on: 1865203
Depends on: 1867106
No longer depends on: 1867106
No longer depends on: 1856081
Depends on: 1869304
Depends on: 1869339
Duplicate of this bug: 1869387
No longer depends on: 1865203
Depends on: 1869880
Depends on: 1889252
Depends on: 1729276
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: