content_scripts won't load with pdf.js tabs
Categories
(WebExtensions :: General, enhancement, P5)
Tracking
(Not tracked)
People
(Reporter: pmheil, Unassigned)
References
(Depends on 1 open bug)
Details
Attachments
(1 file)
522 bytes,
application/x-zip-compressed
|
Details |
Updated•7 years ago
|
Comment 3•7 years ago
|
||
Comment 7•7 years ago
|
||
Comment 8•7 years ago
|
||
Comment 10•7 years ago
|
||
Updated•6 years ago
|
Comment hidden (advocacy) |
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
Comment 17•6 years ago
|
||
Comment 18•6 years ago
|
||
Comment 19•6 years ago
|
||
Comment 20•6 years ago
|
||
Comment 21•6 years ago
|
||
Comment 22•6 years ago
|
||
Comment 23•6 years ago
|
||
Comment 24•6 years ago
|
||
Comment 25•6 years ago
|
||
Comment 27•6 years ago
|
||
Comment 28•6 years ago
|
||
Comment 29•6 years ago
|
||
Comment 30•6 years ago
|
||
Comment 32•6 years ago
|
||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
Comment 35•6 years ago
|
||
Comment 36•6 years ago
|
||
The arXiv-title-fixer extension is really needed for anyone doing research and it is currently broken due to this bug :(
Comment 37•6 years ago
|
||
So this bug is intentional? It is still a bug as far as we users are concerned.
My extension won't work on PDF content any more, so it has lost a part of its functionality due to this bug. Judging from the discussion above, I'll have to ask users to switch to another browser unless the bug is fixed.
Comment 38•6 years ago
|
||
My addon Read Aloud stopped working on PDF and there's no workaround. Before, I call PDFJS to grab the doc content to read aloud. Even without PDFJS I could still use content script to grab the PDF file via same-origin AJAX. But now, have no way to access what the user is looking at.
Comment 39•5 years ago
|
||
Sorry, I still don't know why content_scripts aren't allowed in PDF.js at the first place. Are there any obvious bugs or loopholes?
I'm also trying to use arXiv-title-fixer on Firefox, but it stopped working due to this bug.
However, I somehow achieved the results by some hacky work around in: https://github.com/j3soon/arxiv-utils
First, I intercept the PDF requests, and launch my custom extension page instead.
Second, my custom page embeds the original PDF into its html content.
Third, seems like I can do anything I like in my custom page now...
I wonder if this hacky work around is a vulnerability?
Thanks in advance!
Comment 41•5 years ago
|
||
With Firefox 70 the scrollbar in PDF documents is how unusable - the position is the same grey as the background. For normal pages I can use custom styles from an extension to fix the color. It would be great if this ability wasn't nurfed in the PDF viewer.
Comment 42•5 years ago
|
||
(In reply to Devin Bayer from comment #41)
With Firefox 70 the scrollbar in PDF documents is how unusable - the position is the same grey as the background.
It might be worth filing a separate bug for this. See bug 1575914 for a potentially related issue.
Comment 45•4 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #27)
To get a better understanding of why extension developers want to run
scripts in PDF pages, please share your use case if it is not convered in
this bug or the linked duplicates.
Thanks, Rob - extension developers want to run scripts in PDF pages because firefox users like me need to use their addons in PDF pages (=exactly the same as we need to use in html pages! We need to do the same things, the only thing "special" about PDFs is they often have unintelligible names as well, which makes 2. even more necessary):
- Page body markup- higlight, comments, stickies (eg pagemark, textmarker addons)
- Tab annotation/highlight (eg Tab Retitle, the legacy Colorful Tabs addons)
- Print/save annotated pages or selected areas (eg Fireshot, Singlefile addons)
- Copy images.
- Translation (as above).
- Indexing (as above).
- Accessing bookmarks (broken)
Is that enough reasons?
Comment 46•4 years ago
|
||
(In reply to Piecevcake from comment #45)
Is that enough reasons?
I would add : sliding down page viewer using the mouse (not the scrollwheel) juste like any other PDF reader (using Scrollanywhere).
Either they could implement those functionalities directly in the PDF viewer, either they should let us use our addons.
Comment hidden (offtopic) |
Comment 48•4 years ago
|
||
use their addons in PDF pages (=exactly the same as we need to use in html pages! We need to do the same things,
the only thing "special" about PDFs is they often have unintelligible names as well
Perhaps to a human user. To extensions, PDFs are not like HTML pages.
PDF rendering is closer to rendering an image or a video. The user can see them, but extensions have very little ability to change their behavior, except the minimal part that is available through APIs. The fact that the PDF viewer is HTML+JS is just an internal implementation detail.
Nevertheless, some of the examples (e.g. the changing title or changing the mouse behavior) are largely independent of the page's content.
Although the viewer logic itself (from PDF.js) is designed to be functional in web pages, its integration in Firefox includes extra privileges to improve its functionality (for example find bar integration).
comment 16 expressed willingness to accept a patch to allow access again. I would also accept a patch, provided that it doesn't introduce security or maintainability issues. In fact, if there are no issues at all, I would rather make this the default behavior rather than an opt-in via a pref. Bug 1436482 has a bit more of background, since this feature was disabled as a precaution in that bug.
Comment 49•4 years ago
|
||
(In reply to Piecevcake from comment #45)
(In reply to Rob Wu [:robwu] from comment #27)
To get a better understanding of why extension developers want to run
scripts in PDF pages, please share your use case if it is not convered in
this bug or the linked duplicates.Thanks, Rob - extension developers want to run scripts in PDF pages because firefox users like me need to use their addons in PDF pages (=exactly the same as we need to use in html pages! We need to do the same things, the only thing "special" about PDFs is they often have unintelligible names as well, which makes 2. even more necessary):
- Page body markup- higlight, comments, stickies (eg pagemark, textmarker addons)
- Tab annotation/highlight (eg Tab Retitle, the legacy Colorful Tabs addons)
- Print/save annotated pages or selected areas (eg Fireshot, Singlefile addons)
- Copy images.
- Translation (as above).
- Indexing (as above).
- Accessing bookmarks (broken)
Is that enough reasons?
Ended up here from https://pncnmnp.github.io/blogs/firefox-dark-mode.html (wanted to add a dark mode for pdf).
I was just trying to build an extension to automatically remember the last position of a pdf (I'm aware you can create bookmarks but I want something automatic) and I wasn't able because of this. It also seems people at hypothes.is are dealing with this too (https://github.com/hypothesis/browser-extension/issues/100)
Products such as Obsidian.md and many other like those rely on being able to take notes, and many of them come from browser. Annotation is more and more popular and this is a big drawback.
I hope someone can work on this feature, I'd really appreciate it.
Thank you for all the good work.
Comment 51•4 years ago
|
||
This bug prevents all our customers from using Firefox.
I work at an e-signing company where we have a browser plugin for sending pdf:s to the e-signing platform.
In Chrome this works fantastic. The plugin will inject a small script that presents a small GUI and grabs the pdf via AJAX. The user clicks a button in the injected GUI to send the pdf for signing via our system. The reason we need the content script is to be able to make the AJAX call from the same domain as the pdf is on. We do not tamper with the pdf-viewer.
Please Firefox, fix this so our users can use their preferred browser.
Comment 52•4 years ago
|
||
(In reply to clara.attermo from comment #51)
This bug prevents all our customers from using Firefox.
I work at an e-signing company where we have a browser plugin for sending pdf:s to the e-signing platform.
In Chrome this works fantastic. The plugin will inject a small script that presents a small GUI and grabs the pdf via AJAX.
The browser.windows.create
API can be used to open a popup window with the dialog.
Alternatively, if the entry point of the functionality is the extension button, then you can show the UI in the browserAction panel.
The user clicks a button in the injected GUI to send the pdf for signing via our system. The reason we need the content script is to be able to make the AJAX call from the same domain as the pdf is on.
If your extension has host permissions or even an activated activeTab permission (the latter doesn't have permission warnings), then you can send the request from a background script.
We do not tamper with the pdf-viewer.
This example is a case where content-script access to the PDF viewer is not necessary.
bug 1670278 and bug 1340930 sound like more fitting features to support your scenario.
Comment 53•4 years ago
|
||
@clara.attermo
Since firefox introduced this "feature" of forbidding extension on behalf of the user, we used to point our user to use chrome. Luckly this is not the case anymore, with both safari and edge chromium supporting extensions on pdf pages - which is wherever the user fancies - the amount of customers reporting the issue has gone down considerably as most of them will just try the default system browser.
Still it's saddening that mozilla that once did PDFjs allowing the gap between the open web and the siloed pdf format to be brdiged to some extent, is now unable to see the issue here, and the more general problem of taking decisions on behalf on the user.
You can as Rob explained open a window or a popup telling the user that in their default system browser everything is fine, hope that help :)
Comment 54•4 years ago
|
||
I've just read that Firefox 88 supports executing JavaScript in the PDF.
If a third party script can run in the PDF, does it mean it's secure now and we could enable addons content scripts as well?
Comment 55•4 years ago
|
||
PDF scripts are executed in a sandbox, not in the viewer itself. This feature request here is about running content scripts in the viewer itself.
Comment hidden (metoo) |
Comment hidden (metoo) |
Comment 58•2 years ago
|
||
From the UX perspective it's less than comfortable. I'm using Navigate Up WE: on Chrome, it works on any page; on Firefox, it doesn't work on pages consisting only of PDFs, and it's not immediately obvious that it's supposed to be for our own good. I don't think PDFs as webpages are going to be replaced by HTMLs with embedded PDFs any time soon.
Comment 59•2 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #27)
To get a better understanding of why extension developers want to run
scripts in PDF pages, please share your use case if it is not convered in
this bug or the linked duplicates.
Hi, I need to extend the PDF viewer itself. I don't see that mentioned in any of
the duplicates. My extension would not need access to the PDF content at all,
just the viewer. Does that count as a valid use case? :)
Comment 60•19 days ago
|
||
Re-opening this bug; I spoke to people from the PDF.js team and the WebExtensions team. If there are compelling use cases for this feature request we may reconsider, to allow extensions to run content scripts in the viewer.
Before this is feasible at all, we would have to make sure that the viewer does not have any access to privileged functionality that are unavailable to regular web content. And not just now, but also in the future.
Comment 61•19 days ago
|
||
Zotero displays a progress dialog popup at the top right of the screen when our user saves a webpage. This has been broken on Firefox for us and we have had to resort to workarounds. We are able to display a progress dialog on other browsers and would be more than happy to bring this functionality back.
See for how this looks on other browsers: https://github.com/zotero/zotero-connectors/issues/250#issuecomment-2354675737
Description
•