Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

allow PDFJS to load local files #8645

Merged
merged 1 commit into from
May 8, 2017
Merged

allow PDFJS to load local files #8645

merged 1 commit into from
May 8, 2017

Conversation

diracdeltas
Copy link
Member

@diracdeltas diracdeltas commented May 3, 2017

fix #2714

test plan:

  1. start Brave with PDFJS enabled and browse to a local PDF file. it should display correctly. the urlbar should show the 'file:' location.
  2. turn off PDFJS and go to the file. it should prompt to download.
  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Test Plan:

fix #2714

test plan:
1. start Brave with PDFJS enabled and browse to a local PDF file. it should display correctly. the urlbar should show the 'file:' location.
2. turn off PDFJS and go to the file. it should prompt to download.
@diracdeltas diracdeltas added this to the 0.15.2 milestone May 3, 2017
@diracdeltas diracdeltas self-assigned this May 3, 2017
@diracdeltas diracdeltas requested a review from bbondy May 3, 2017 00:58
@@ -400,6 +400,9 @@ module.exports.init = () => {
}

let loadExtension = (extensionId, extensionPath, manifest = {}, manifestLocation = 'unpacked') => {
if (extensionId === config.PDFJSExtensionId) {
manifestLocation = 'component'
Copy link
Member Author

@diracdeltas diracdeltas May 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: 'component' type extensions are able to access cross-origin 'file:' URLs, but somehow they are not able to see 'file:' URLs in the chrome.webRequest listener; instead the 'file:' URL webrequest listener must be added using session.webRequest.

@diracdeltas diracdeltas changed the title fix PDF loading local files allow PDFJS to load local files May 3, 2017
@bbondy
Copy link
Member

bbondy commented May 8, 2017

It would be interesting to dig into chrome.webRequest more, but this is ok for now. Nice to have it working, thanks!

@bbondy bbondy merged commit c1b8e87 into master May 8, 2017
@bsclifton bsclifton deleted the fix/local-pdf-2 branch May 22, 2017 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pdfjs needs local file access
3 participants