question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Convert PDF.js Firefox add-on to a WebExtension

See original GitHub issue

PDF.js has three different build targets: web, Firefox add-on and Chromium extension.

The Firefox add-in is built using legacy add-on technology that will be gone from Firefox 57. Although the Chromium extension can be used in Firefox as-is, doing so would degrade the functionality (compared to the existing Firefox add-on). Mainly, the fact that the URL looks ugly (#6444) and the inability to render PDF resources that are not available via another GET request (e.g. POST, or URLs that expire after one request).

To convert PDF.js to a WebExtension, we need to:

  • Migrate preferences from the preference service to the storage API.
  • Use the i18n API for localization.
  • Integrate in the find bar.
  • Detect PDF network requests, grab the response body, serve the PDF viewer HTML and pass the PDF data down to the page (with sufficient validation at each step to avoid cross-origin information leakage). This feature can be implemented using the API from https://bugzilla.mozilla.org/show_bug.cgi?id=1255894.

The first two are easy, we already use these APIs in the Chromium extension. To send the preferences from the old to the new storage, an Embedded WebExtension can be used.

(this has been reported before, at #8227 and https://bugzil.la/1271476, but there were no concrete implementation plan)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
jscher2000commented, Jun 26, 2018

Would generating pdf.js pages with an extension allow users to work around the block on content scripts being injected into pdf.js pages in Firefox 60+ (intentional, per bug 1454760)? It is a question of particular interest to users of translation extensions.

1reaction
ExE-Bosscommented, May 20, 2018

We could probably use the content handlers API that is being implemented in bug 1457500.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[tracking] move PDF.js into a web extension, ship as a system ...
PDF.js is developed as a Firefox extension right now, although it gets packaged directly into Firefox instead of shipping as an extension: ...
Read more >
Open in PDF Viewer – Get this Extension for Firefox (en-US)
Open in PDF Viewer is a simple and very lite addon that allows you to easily open desired PDF links in a chosen...
Read more >
content_scripts won't load with pdf.js tabs - Bugzilla@Mozilla
Add-ons support in pdf documents was the only reason for me and many other people to use Firefox for viewing pdf documents. Now...
Read more >
Android PDF.js – Get this Extension for Firefox (en-US)
Android PDF.js by Manuel Reimer. Opens PDF files on Firefox for Android using PDF.js. You'll need Firefox to use this extension.
Read more >
Application/pdf XPCOM stream converter registering but not ...
I am developing an addon that exposes a custom PDF viewer based on the ... addon must work on Firefox 49, which rules...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found