[Pkg-javascript-commits] [pdf.js] 41/157: [CRX] Ignore PDFs from responses to POST requests
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 06:46:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 4367dd513088d3e4da49e06f5196c2d34ae4e78c
Author: Rob Wu <rob at robwu.nl>
Date: Sun Jul 5 01:01:03 2015 +0200
[CRX] Ignore PDFs from responses to POST requests
As explained in
https://github.com/mozilla/pdf.js/issues/6174#issuecomment-118502802.
To verify that this patch works:
1. Build the Chrome extension (node make chromium)
2. Load the Chrome extension (at chrome://extensions)
3. Visit https://robwu.nl/pdfjs/issue6174/.
4. Verify that PDF.js is not used to load the PDF. Either Chrome's
default PDF Viewer is used, or the PDF is offered as a file download.
---
extensions/chromium/contentscript.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/extensions/chromium/contentscript.js b/extensions/chromium/contentscript.js
index e17c15f..f6d7cb8 100644
--- a/extensions/chromium/contentscript.js
+++ b/extensions/chromium/contentscript.js
@@ -75,6 +75,19 @@ function watchObjectOrEmbed(elem) {
return;
}
+ if (elem.tagName === 'EMBED' && elem.name === 'plugin' &&
+ elem.parentNode === document.body &&
+ elem.parentNode.childElementCount === 1 && elem.src === location.href) {
+ // This page is most likely Chrome's default page that embeds a PDF file.
+ // The fact that the extension's background page did not intercept and
+ // redirect this PDF request means that this PDF cannot be opened by PDF.js,
+ // e.g. because it is a response to a POST request (as in #6174).
+ // A reduced test case to test PDF response to POST requests is available at
+ // https://robwu.nl/pdfjs/issue6174/.
+ // Until #4483 is fixed, POST requests should be ignored.
+ return;
+ }
+
if (elem[shadowRoot]) {
// If the element already has a shadow root, assume that we've already
// seen this element.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list