1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[CRX] Remove obsolete manifest features

In preparation for migrating the Chrome extension to Manifest Version 3,
this patch removes parts of the manifest that are obsolete and/or
unsupported in MV3.

Remove ftp mentions: ftp was dropped from 6 years ago, in Chrome 59.

Remove file_browser_handlers: does not work on Chrome OS according to
https://github.com/mozilla/pdf.js/issues/14161 . MV3 replacement needs
a different manifest key and logic, which will be added later.

Remove content_security_policy: MV3 does not support unsafe-eval CSP,
and PDF.js does not require it. This may result in a mild performance
degradation in PDFs that contain PostScript.

Remove page_action logic: When this logic was originally introduced,
Chrome showed page action buttons in the address bar, which enabled
the extension to display the button on specific PDF viewer tabs only.
In Chrome 49 (2016), pageActions were dropped from the address bar and
put in an UI area that is hidden by default. The user can pin the button
to be unconditionally visible on the toolbar, which is distracting.
Because the UX is no longer serving the original needs, this patch
removes page_action from the manifest.
This commit is contained in:
Rob Wu 2024-08-25 20:34:03 +02:00
parent cd99be0aa5
commit 683b511f20
11 changed files with 1 additions and 250 deletions

View file

@ -36,9 +36,6 @@ if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("CHROME")) {
// Example: chrome-extension://.../http://example.com/file.pdf
const humanReadableUrl = "/" + defaultUrl + location.hash;
history.replaceState(history.state, "", humanReadableUrl);
if (top === window) {
chrome.runtime.sendMessage("showPageAction");
}
AppOptions.set("defaultUrl", defaultUrl);
})();

View file

@ -394,15 +394,6 @@ class PDFHistory {
} else {
window.history.pushState(newState, "", newUrl);
}
if (
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("CHROME") &&
top === window
) {
// eslint-disable-next-line no-undef
chrome.runtime.sendMessage("showPageAction");
}
}
#tryPushCurrentPosition(temporary = false) {