Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CRX] Ignore PDFs from responses to POST requests #6176

Merged
merged 1 commit into from
Jul 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions extensions/chromium/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down