Skip to content

Commit

Permalink
Merge pull request #18651 from Rob--W/crx-mv3-prep-drop-manifest
Browse files Browse the repository at this point in the history
[CRX] Remove obsolete manifest features
  • Loading branch information
timvandermeij authored Aug 29, 2024
2 parents ea090fe + 1d54538 commit ce65623
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 286 deletions.
1 change: 0 additions & 1 deletion extensions/chromium/extension-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ limitations under the License.
var schemes = [
"http",
"https",
"ftp",
"file",
"chrome-extension",
"blob",
Expand Down
Binary file removed extensions/chromium/icon19.png
Binary file not shown.
Binary file removed extensions/chromium/icon38.png
Binary file not shown.
20 changes: 1 addition & 19 deletions extensions/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"16": "icon16.png"
},
"permissions": [
"fileBrowserHandler",
"webRequest",
"webRequestBlocking",
"<all_urls>",
Expand All @@ -20,21 +19,13 @@
],
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "ftp://*/*", "file://*/*"],
"matches": ["http://*/*", "https://*/*", "file://*/*"],
"run_at": "document_start",
"all_frames": true,
"css": ["contentstyle.css"],
"js": ["contentscript.js"]
}
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"file_browser_handlers": [
{
"id": "open-as-pdf",
"default_title": "Open with PDF Viewer",
"file_filters": ["filesystem:*.pdf"]
}
],
"storage": {
"managed_schema": "preferences_schema.json"
},
Expand All @@ -46,20 +37,11 @@
"background": {
"page": "pdfHandler.html"
},
"page_action": {
"default_icon": {
"19": "icon19.png",
"38": "icon38.png"
},
"default_title": "Show PDF URL",
"default_popup": "pageActionPopup.html"
},
"incognito": "split",
"web_accessible_resources": [
"content/web/viewer.html",
"http:/*",
"https:/*",
"ftp:/*",
"file:/*",
"chrome-extension:/*",
"blob:*",
Expand Down
45 changes: 0 additions & 45 deletions extensions/chromium/pageAction/background.js

This file was deleted.

44 changes: 0 additions & 44 deletions extensions/chromium/pageAction/popup.html

This file was deleted.

25 changes: 0 additions & 25 deletions extensions/chromium/pageAction/popup.js

This file was deleted.

102 changes: 0 additions & 102 deletions extensions/chromium/pdfHandler-vcros.js

This file was deleted.

2 changes: 0 additions & 2 deletions extensions/chromium/pdfHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@
<script src="preserve-referer.js"></script>
<script src="pdfHandler.js"></script>
<script src="extension-router.js"></script>
<script src="pdfHandler-vcros.js"></script>
<script src="pageAction/background.js"></script>
<script src="suppress-update.js"></script>
<script src="telemetry.js"></script>
36 changes: 0 additions & 36 deletions extensions/chromium/preserve-referer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ chrome.runtime.onConnect.addListener(function onReceivePort(port) {
if (port.name !== "chromecom-referrer") {
return;
}
// Note: sender.frameId is only set in Chrome 41+.
if (!("frameId" in port.sender)) {
port.disconnect();
return;
}
var tabId = port.sender.tab.id;
var frameId = port.sender.frameId;

Expand Down Expand Up @@ -127,21 +122,8 @@ chrome.runtime.onConnect.addListener(function onReceivePort(port) {
delete g_referrers[tabId][frameId];
}
chrome.webRequest.onBeforeSendHeaders.removeListener(onBeforeSendHeaders);
chrome.webRequest.onHeadersReceived.removeListener(exposeOnHeadersReceived);
});

// Expose some response headers for fetch API calls from PDF.js;
// This is a work-around for https://crbug.com/784528
chrome.webRequest.onHeadersReceived.addListener(
exposeOnHeadersReceived,
{
urls: ["https://*/*"],
types: ["xmlhttprequest"],
tabId,
},
["blocking", "responseHeaders"]
);

function onBeforeSendHeaders(details) {
if (details.frameId !== frameId) {
return undefined;
Expand All @@ -162,22 +144,4 @@ chrome.runtime.onConnect.addListener(function onReceivePort(port) {
refererHeader.value = referer;
return { requestHeaders: headers };
}

function exposeOnHeadersReceived(details) {
if (details.frameId !== frameId) {
return undefined;
}
var headers = details.responseHeaders;
var aceh = getHeaderFromHeaders(headers, "access-control-expose-headers");
// List of headers that PDF.js uses in src/display/network_utils.js
var acehValue =
"accept-ranges,content-encoding,content-length,content-disposition";
if (aceh) {
aceh.value += "," + acehValue;
} else {
aceh = { name: "Access-Control-Expose-Headers", value: acehValue };
headers.push(aceh);
}
return { responseHeaders: headers };
}
});
3 changes: 0 additions & 3 deletions web/chromecom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})();
Expand Down
9 changes: 0 additions & 9 deletions web/pdf_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ce65623

Please sign in to comment.