Closed Bug 1659818 Opened 5 years ago Closed 2 years ago

Implement and expose window.print

Categories

(GeckoView :: General, enhancement, P1)

Unspecified
All
enhancement

Tracking

(Webcompat Priority:P1, relnote-firefox 114+, firefox111 disabled, firefox112 disabled, firefox113 disabled, firefox114 fixed)

RESOLVED FIXED
113 Branch
Webcompat Priority P1
Tracking Status
relnote-firefox --- 114+
firefox111 --- disabled
firefox112 --- disabled
firefox113 --- disabled
firefox114 --- fixed

People

(Reporter: agi, Assigned: olivia)

References

(Blocks 3 open bugs)

Details

(Keywords: webcompat:platform-bug, Whiteboard: [android-print][geckoview:m109][geckoview:m110][geckoview:m111][geckoview:m112][geckoview:m113])

Attachments

(1 file)

GeckoView does not implement window.print.

mdn: https://developer.mozilla.org/en-US/docs/Web/API/Window/print

Priority: -- → P3

Any updates on this? IIRC there was actually a 'print page' button in the menue in firefox android - don't know why this was removed. I would like to use Firefox for this feature and not fallback to other apps or browsers like Chrome, which supports calling androids print dialogue. It's required not just for printing on a printer but also to pdf to store a file or page.

See https://github.com/mozilla-mobile/fenix/issues/13214
window.print is sorely needed from a webcompat point of view.

Webcompat Priority: --- → P1
Depends on: 1659819
Severity: -- → N/A

Looks like all the blockers on this are fixed now. I await the final resolution. :-)

See Also: → 1770971

Chris, any feel who would be picking this up? This has become a webcompat risk area to be solved.

Flags: needinfo?(cpeterson)

(In reply to Frank Griffith Jr from comment #4)

Chris, any feel who would be picking this up? This has become a webcompat risk area to be solved.

Do you have any examples of sites with webcompat issues due to window.print? I'm surprised that pages or users want to print from a phone. :)

Flags: needinfo?(cpeterson)
Priority: P3 → P2

Let's consider for Fenix 109, since this bug is Webcompat Priority P1.

Do you have any examples of sites with webcompat issues due to window.print?

I found an example here: https://github.com/mozilla-mobile/fenix/issues/13214

Severity: N/A → S3
Type: enhancement → defect
Whiteboard: [geckoview:m109?]

The severity field for this bug is set to S3. However, this bug has a P1 WebCompat priority.
:cpeterson, could you consider increasing the severity of this web compatibility bug?

For more information, please visit auto_nag documentation.

Flags: needinfo?(cpeterson)
Assignee: nobody → ohall

Should we implement window.print using "Save as PDF" (bug 1780639) instead of calling Android print APIs?

Flags: needinfo?(cpeterson)
Priority: P2 → --
Priority: -- → P1
Whiteboard: [geckoview:m109?] → [geckoview:m109]
Severity: S3 → N/A
Type: defect → enhancement

(In reply to Chris Peterson [:cpeterson] from comment #8)

Should we implement window.print using "Save as PDF" (bug 1780639) instead of calling Android print APIs?

It's my understanding (from a cursory look at code I barely understood, so may be wrong but no one's contradicted me yet) that the Android print API requires one to generate a PDF document, so it's been my expectation while #1780639 has rumbled onward that this bug would build on that work, but not in the way you seem to be suggesting.

Apologies if I misread your intent, but I take it to be suggesting that window.print() simply routes straight to Save as PDF, not providing any capability to print to real printers (or external software pseudo-printers) available to the device through the Android API.

If that's the case I personally don't consider that to satisfy the expectations of window.print. In an earlier comment above, you expressed incredulity that anyone would be printing from a phone anyway, but on that topic I refer you then to this comment from your Customer Experience Team[1].

Of course it will be nice to at last have some roundabout method of achieving what other browsers and applicable Android apps can do natively, but it would be a mistake to think that users will settle for this when the proper, OS-level printing use case and interest is a bit more extensive than you may appreciate.

[1] https://github.com/mozilla-mobile/fenix/issues/10217#issuecomment-1299157823

Depends on: 1804467
Priority: P1 → P2
Whiteboard: [geckoview:m109] → [geckoview:m109][geckoview:m110][geckoview:m111]
Blocks: 1809922
Blocks: 1809915
Whiteboard: [geckoview:m109][geckoview:m110][geckoview:m111] → [android-print][geckoview:m109][geckoview:m110][geckoview:m111]
Rank: 109
See Also: → 1812149
Depends on: 1809919
Whiteboard: [android-print][geckoview:m109][geckoview:m110][geckoview:m111] → [android-print][geckoview:m109][geckoview:m110][geckoview:m111][geckoview:m112]
Priority: P2 → P1
Depends on: 1812149

This bug implements and opens window.print() for Android in Nightly.
Adds "GeckoView:DotPrintRequest" and "GeckoView:DotPrintFinish" events.
GeckoView:DotPrintRequest requests a PDF of the current window.print
page for Android to print. GeckoView:DotPrintFinish releases the static
browser clone created by window.print. PDF generation was additionally
adjusted to get the expected canonical browser context when printing
iframes.

Blocks: 1820218
Blocks: 1816151
Whiteboard: [android-print][geckoview:m109][geckoview:m110][geckoview:m111][geckoview:m112] → [android-print][geckoview:m109][geckoview:m110][geckoview:m111][geckoview:m112][geckoview:m113]

Holding for bug 1812149 and Nightly 113 to start before landing.

Pushed by ohall@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b7e15dac9bdd Android window.print Implemented for Nightly r=emilio,m_kato,geckoview-reviewers
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch

I assume this is something we want to call out for the release notes? Please set the relnote-firefox? flag and fill out the form.

Flags: needinfo?(ohall)

I think so for Nightly release notes for now - it is set behind a nightly preference, but if QA and everything goes well, the preference will be set to enabled fully in bug 1809922.

Release Note Request (optional, but appreciated)

[Why is this notable]:
The JavaScript call window.print() is now supported on Android in Nightly. This means Firefox on Android can now print website content that provides a print button that utilizes window.print(). For example, a website with a recipe that has a "Print" button will now prepare the recipe to print as expected. (Note - This change did not add a print option to the Firefox browser menu, it allows JavaScript web page content print buttons to work.)

[Suggested wording]:
(Nightly only) Websites that use window.print() can now be printed on Android.
or
(Nightly only) Window.print() is now supported on Android.

[Links (documentation, blog post, etc)]:
MDN link - https://developer.mozilla.org/en-US/docs/Web/API/Window/print

relnote-firefox: --- → ?
Flags: needinfo?(ohall) → behind-pref+

I added a note to the Firefox 113 Nightly release notes.

Given bug 1809922, tagging the note to ride the trains when 113 goes to Beta next week.

Depends on: 1831223

Pushed back to 114 due to some quality issues which weren't able to be addressed in time for 113.
https://hg.mozilla.org/releases/mozilla-release/rev/484eaf4a9552

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

Attachment

General

Created:
Updated:
Size: