Commit 69fe5c77 authored by raymes@chromium.org's avatar raymes@chromium.org

Fix loading PDFs with no HTTP response headers in OOP PDF

Currently if no response headers are passed into the plugin in OOP PDF then the
headers fetched URLLoader that loaded the stream URL will be used, but the
MIME type for the blob URL is always plain text, which causes the document
loader to refuse to load the document. Currently, if no headers are passed
to the in process plugin, we always try to load the document, so this just
mimics that behavior in the OOP plugin. When the in-process plugin is removed
we can change the document loader and remove the hack.

This also removes blob: URLs from the MIME type check in document loader
because they are no longer ever passed in.

BUG=303491

Review URL: https://codereview.chromium.org/301223004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274081 0039d316-1c4b-4281-b951-d872f2087c98
parent 6273e79e
...@@ -79,8 +79,7 @@ bool DocumentLoader::Init(const pp::URLLoader& loader, ...@@ -79,8 +79,7 @@ bool DocumentLoader::Init(const pp::URLLoader& loader,
!EndsWith(type, "/x-pdf", false) && !EndsWith(type, "/x-pdf", false) &&
!EndsWith(type, "/*", false) && !EndsWith(type, "/*", false) &&
!EndsWith(type, "/acrobat", false) && !EndsWith(type, "/acrobat", false) &&
!EndsWith(type, "/unknown", false) && !EndsWith(type, "/unknown", false)) {
!StartsWithASCII(url, "blob:", false)) {
return false; return false;
} }
if (StartsWithASCII(disposition, "attachment", false)) { if (StartsWithASCII(disposition, "attachment", false)) {
......
...@@ -316,6 +316,12 @@ bool OutOfProcessInstance::Init(uint32_t argc, ...@@ -316,6 +316,12 @@ bool OutOfProcessInstance::Init(uint32_t argc,
headers = argv[i]; headers = argv[i];
} }
// TODO(raymes): This is a hack to ensure that if no headers are passed in
// then we get the right MIME type. When the in process plugin is removed we
// can fix the document loader properly and remove this hack.
if (!headers || strcmp(headers, "") == 0)
headers = "content-type: application/pdf";
if (!original_url) if (!original_url)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment