Closed Bug 2034982 Opened 5 months ago Closed 4 months ago

Add a PDF entry point in about:pdf

Categories

(Firefox :: PDF Viewer, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox153 --- fixed

People

(Reporter: calixte, Assigned: calixte)

Details

Attachments

(4 files, 1 obsolete file)

The design spec is still a WIP:
https://www.figma.com/design/rsS3P88qV1XovaVwssmIHf/PDF.js--Null-state?node-id=245-6478&p=f&t=QIgJ9CjbrxIFXCCK-0

The idea is have a page about:pdf we can use as an entry point for the pdf viewer.

Registers about:pdf as a privileged-about page that lets users drop or
pick a local PDF and have it open in Firefox's PDF.js viewer. On Windows,
the page also offers to set Firefox as the default PDF handler when it
isn't already.

The page itself is sandboxed content (URI_SAFE_FOR_UNTRUSTED_CONTENT)
and bridges to chrome via a RemotePage actor pair (AboutPDFChild /
AboutPDFParent) for file validation, navigation, and the
ShellService.setAsDefaultPDFHandler call.

moz-promo sets display: flex on :host, which overrides the default
[hidden] handling, so setting the hidden attribute or property on a
moz-promo had no effect. Add an explicit :host([hidden]) rule so
consumers can hide it.

Add the markup, styles, script and strings for the about:pdf landing
page: a drop zone and file picker for opening a local PDF in the built-in
viewer, and a promo (hidden by default) offering to set Firefox as the
default PDF handler.

The page is wired up to chrome and registered as an about: page in a
follow-up commit; on its own it is not yet reachable.

Register about:pdf as a privileged-about page pointing at the landing
page, and add the AboutPDF JSWindowActor pair that bridges the sandboxed
content to chrome. The parent validates a dropped/picked file (file
scheme, .pdf extension, existence and %PDF- header) before navigating
the top browsing context to it, and, on Windows, exposes whether Firefox
can be set as the default PDF handler and performs that change.

Allow the page to call the RPM helpers it needs and to read/write the
promo dismissal pref.

Cover page rendering and the drop zone, the AboutPDFParent file
validation and navigation logic, and the promo dismissal flow (including
persistence of the dismissal pref).

Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/38c07ccc0970 https://hg.mozilla.org/mozilla-central/rev/71ccc32d8010 part 1: Make moz-promo honor the hidden attribute. r=desktop-theme-reviewers,tgiles https://github.com/mozilla-firefox/firefox/commit/0976e580e02e https://hg.mozilla.org/mozilla-central/rev/17ba3bddaa21 part 2: Add the about:pdf landing page front-end. r=firefox-desktop-core-reviewers ,fluent-reviewers,bolsson,hjones https://github.com/mozilla-firefox/firefox/commit/f0ee1ef65154 https://hg.mozilla.org/mozilla-central/rev/ec244662c5cb part 3: Register about:pdf and wire it up to chrome. r=mossop https://github.com/mozilla-firefox/firefox/commit/b0ff20f270d2 https://hg.mozilla.org/mozilla-central/rev/7f377d7a30e9 part 4: Add browser tests for about:pdf. r=mossop
Attachment #9573775 - Attachment is obsolete: true
QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: