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

Commit

Permalink
Only replace PDF URL when PDFJS is enabled
Browse files Browse the repository at this point in the history
Fix #2530

Auditors: @diracdeltas
  • Loading branch information
bbondy committed Jul 17, 2016
1 parent 0464ce3 commit e962ef9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ usePasswordManager=Use Brave's password manager
useOnePassword=Use 1Password (requires 1Password Application)
useDashlane=Use Dashlane (requires Dashlane Application)
useLastPass=Use LastPass
usePDFJS=Use HTML5 PDF reader
usePDFJS=Use HTML5 PDF reader (requires browser restart)
enableFlash=Enable Adobe Flash support (requires browser restart)
enableFlashSubtext=Flash support is experimental and requires Pepper Flash to be installed from
enableFlashSubtextLinux=Flash support is experimental and requires the pepperflashplugin-nonfree package.
Expand Down
11 changes: 11 additions & 0 deletions docs/appActions.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@ Adds a word to the dictionary



### setPDFJSOrigin(origin)

Sets PDFJS origin

**Parameters**

**origin**: `string`, The origin of the PDFJS extension. Ends in
a slash.




* * *

Expand Down
3 changes: 3 additions & 0 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ const updateNavBarInput = (loc, frameStatePath = activeFrameStatePath()) => {
* @param {string=} loc - Original URL
*/
const setPDFLocation = (loc) => {
if (!getSetting(settings.PDFJS_ENABLED)) {
return loc
}
PDFJS_ORIGIN = PDFJS_ORIGIN || require('./appStoreRenderer').state.get('pdfjsOrigin')
if (loc && PDFJS_ORIGIN &&
UrlUtil.isFileType(loc, 'pdf') && !loc.startsWith(PDFJS_ORIGIN)) {
Expand Down

1 comment on commit e962ef9

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

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

++, nice catch

Please sign in to comment.