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

Unable to download pdf instead opening them in brave. Unable to disable pdf.js via command line. #1531

Closed
Techguyprivate opened this issue Oct 11, 2018 · 9 comments · Fixed by brave/brave-core#941
Assignees
Labels
extension/PDFJS feature/global-settings Settings at browser level independent of shields settings priority/P3 The next thing for us to work on. It'll ride the trains. QA Pass-Linux QA Pass-macOS QA Pass-Win64 QA/Test-Plan-Specified QA/Yes release-notes/include

Comments

@Techguyprivate
Copy link

Description

I always download pdf instead of opening them in browser. Going to content setting in chrome://setting , toggling the option to download pdf instaed of opening them, doesn't work.Pdf gets opened in browser. Unable to disable Pdf.js extension component via command line.No toggable option in extension setting .It is greyed out.

Steps to Reproduce

  1. Go to chrome://setting.
  2. Go to content setting.Then go to the option pdf document.
  3. Toggle the option to download pdf instead of opening them in brave. Try to download any pdf file..

Actual result:

Pdf file is opening inside brave ,instead of getting downloaded.

Expected result:

Pdf file should be downloaded in brave, instead of opening inside the browser.

Reproduces how often:

Easily.

Brave version (chrome://version info)

Brave 0.55.12 Chromium: 70.0.3538.45 (Official Build) beta(64-bit)
Revision cbdc32e4334458954e9def214d7e5fa1ca1960eb-refs/branch-heads/3538@{#830}
OS Linux
JavaScript V8 7.0.276.25
Flash (Disabled)
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.45 Safari/537.36
Command Line /usr/bin/brave-browser-beta --enable-tab-audio-muting --disable-domain-reliability --disable-chrome-google-url-tracking-client --no-pings --enable-features=EnableEmojiContextMenu,DesktopPWAWindowing,fill-on-account-select,NewExtensionUpdaterService --disable-features=SharedArrayBuffer,DefaultEnableOopRasterization,VizDisplayCompositor --flag-switches-begin --flag-switches-end
Executable Path /opt/brave.com/brave-beta/brave-browser-beta
Profile Path /home/anama/.config/BraveSoftware/Brave-Browser-

Reproducible on current release:

  • Does it reproduce on brave-browser dev/beta builds? Yes.
  • Does it reproduce on browser-laptop? No.

Website problems only:

  • Does the issue resolve itself when disabling Brave Shields? No.
  • Is the issue reproducible on the latest version of Chrome? No.

Additional Information

Remove any profile data.
Launch beta version with/Applications/Brave\ Browser\ Beta.app/Contents/MacOS/Brave\ Browser\ Beta --show-component-extension-options
Navigate to chrome://extensions.
@rebron rebron added extension/PDFJS feature/global-settings Settings at browser level independent of shields settings labels Oct 11, 2018
@bsclifton bsclifton changed the title Unable to download pdf instaed opening them in brave. Unable to disable pdf.js via command line. Unable to download pdf instead opening them in brave. Unable to disable pdf.js via command line. Oct 12, 2018
@bbondy bbondy added this to the 1.x Backlog milestone Oct 16, 2018
@bbondy bbondy added the priority/P3 The next thing for us to work on. It'll ride the trains. label Oct 16, 2018
@rebron
Copy link
Collaborator

rebron commented Nov 13, 2018

@Techguyprivate is this still an issue in current release?

@carn1x
Copy link

carn1x commented Nov 14, 2018

I'm still unable to View PDFs in Version 0.55.22 Chromium: 70.0.3538.77 (Official Build) (64-bit). Setting Download PDF files instead of automatically opening them in Brave to True seems to make no difference PDF.js still seems try and show it in browser and gives invalid/corrupt error which other browsers (FF/Chrome) do not.

@Techguyprivate
Copy link
Author

The issue is still there. .Still pdf not getting downloaded even when setting the option to " Download PDF files instead of automatically opening them in Brave " is set to true. Brave stable
Version 0.56.12 Chromium: 70.0.3538.77 (Official Build) (64-bit).

@mkarolin mkarolin self-assigned this Nov 19, 2018
mkarolin added a commit to brave/brave-core that referenced this issue Nov 20, 2018
Fixes brave/brave-browser#1531

The fix does the following:

1. Makes the initial decision on whether to load PDFJS extension based
on the value of kPluginsAlwaysOpenPdfExternally profile preference.

2. Watches profile preference value kPluginsAlwaysOpenPdfExternally and
adds/removes PDFJS extension when the value changes.

3. Modifies js behind the chrome://settings/content/pdfDocuments so that
if the PDFJS extension is disabled from the command line the option to
download PDF files instead of opening them in Brave is set to ON and the
toggle is disabled.

Note, that this fix doesn't address being able to turn off opening PDFs
in Brave in Guest/Tor profiles. The web ui setting to do so is not
available in these profiles.

The command line switch to not load PDFJS already applies to all profile
types.
@Techguyprivate
Copy link
Author

#2267 #2267

@alabamavtec
Copy link

alabamavtec commented Nov 29, 2018

#2267

Also reproducible on Ubuntu 18.10 (64-bit):

`Brave 0.56.15 Chromium: 70.0.3538.110 (Official Build) (64-bit)
Revision ca97ba107095b2a88cf04f9135463301e685cbb0-refs/branch-heads/3538@{#1094}
OS Linux
JavaScript V8 7.0.276.40
Flash (Disabled)
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Command Line /usr/bin/brave-browser --enable-tab-audio-muting --disable-domain-reliability --disable-chrome-google-url-tracking-client --no-pings --enable-features=EnableEmojiContextMenu,DesktopPWAWindowing,fill-on-account-select,NewExtensionUpdaterService --disable-features=SharedArrayBuffer,DefaultEnableOopRasterization,VizDisplayCompositor,AutofillSaveCardSignInAfterLocalSave,kAutofillServerCommunication --flag-switches-begin --flag-switches-end
Executable Path /opt/brave.com/brave/brave-browser
Profile Path /home/alabamavtec/.config/BraveSoftware/Brave-Browser/Default`

Setting does work, as expected (prompts download), in Chromium Browser version:
Version 70.0.3538.110 (Official Build)

mkarolin added a commit to brave/brave-core that referenced this issue Dec 5, 2018
Fixes brave/brave-browser#1531

The fix does the following:

1. Makes the initial decision on whether to load PDFJS extension based
on the value of kPluginsAlwaysOpenPdfExternally profile preference in
addition to the command line switch.

2. Watches profile preference value kPluginsAlwaysOpenPdfExternally and
adds/removes PDFJS component when the value changes.

3. Modifies js behind the chrome://settings/content/pdfDocuments so that
if the PDFJS extension is disabled from the command line the option to
download PDF files instead of opening them in Brave is set to ON and the
toggle is disabled.

4. Adds an alternative call for whitelisted extensions in
extensions/common/manifest_handlers/mime_types_handler.h that removes
Chrome's PDF Extension ID from whitelisted IDs and patches
chrome/browser/plugins/plugin_utils.cc to use the alternative call. This
is done because on Linux that extension is not removed from profile
enabled extensions (because there is no extensions install verification)
and it ends up being picked as a handler for PDFs. If our PDFJS extension
is disabled via command line, this causes a PDF to be neither displayed
nor downloaded.

Note, that this fix doesn't address being able to turn off opening PDFs
in Brave in Guest/Tor profiles. The web ui setting to do so is not
available in these profiles.

The command line switch to not load PDFJS already applies to all profile
types.

Adds browser tests to check that when the preference is set to always
download or PDFJS is disabled from command line a download is initiated
when navigating to a pdf url.
@cndouglas
Copy link
Contributor

Related: #1778 (allow disabling PDF.js in settings)

mkarolin added a commit to brave/brave-core that referenced this issue Dec 6, 2018
Fixes brave/brave-browser#1531

The fix does the following:

1. Makes the initial decision on whether to load PDFJS extension based
on the value of kPluginsAlwaysOpenPdfExternally profile preference in
addition to the command line switch.

2. Watches profile preference value kPluginsAlwaysOpenPdfExternally and
adds/removes PDFJS component when the value changes.

3. Modifies js behind the chrome://settings/content/pdfDocuments so that
if the PDFJS extension is disabled from the command line the option to
download PDF files instead of opening them in Brave is set to ON and the
toggle is disabled.

4. Adds an alternative call for whitelisted extensions in
extensions/common/manifest_handlers/mime_types_handler.h that removes
Chrome's PDF Extension ID from whitelisted IDs and patches
chrome/browser/plugins/plugin_utils.cc to use the alternative call. This
is done because on Linux that extension is not removed from profile
enabled extensions (because there is no extensions install verification)
and it ends up being picked as a handler for PDFs. If our PDFJS extension
is disabled via command line, this causes a PDF to be neither displayed
nor downloaded.

Note, that this fix doesn't address being able to turn off opening PDFs
in Brave in Guest/Tor profiles. The web ui setting to do so is not
available in these profiles.

The command line switch to not load PDFJS already applies to all profile
types.

Adds browser tests to check that Chromium's PDF extension is not
considered for handling PDFs and if the PDFJS extension is not loaded or
disabled from command line a download is initiated when navigating to a
PDF URL. Also adds test to verify that when PDF download preference is
toggled the component loader will take an appropriate action (add or
remove PDFJS extension).
@btlechowski
Copy link

btlechowski commented Jan 2, 2019

Verification passed on

Brave 0.59.14 Chromium: 72.0.3626.28 (Official Build) beta(64-bit)
Revision 997b1040b63bac324e815797ba52be0cd8f616ed-refs/branch-heads/3626@{#461}
OS Windows 7

Used Test plan from brave/brave-core#941
Used links:
https://basicattentiontoken.org/BasicAttentionTokenWhitePaper-4.pdf
http://www.pdf995.com/samples/pdf.pdf

image

Verified passed with

Brave 0.59.14 Chromium: 72.0.3626.28 (Official Build) beta(64-bit)
Revision 997b1040b63bac324e815797ba52be0cd8f616ed-refs/branch-heads/3626@{#461}
OS Mac OS X

@srirambv
Copy link
Contributor

srirambv commented Jan 3, 2019

Verification only passed for manual enabling the switch in chrome://settings/content/pdfDocuments. Command line test failed on Linux due #1253 but based on #1253 (comment), ok to pass the test on Linux

Brave 0.59.14 Chromium: 72.0.3626.28 (Official Build) beta(64-bit)
Revision 997b1040b63bac324e815797ba52be0cd8f616ed-refs/branch-heads/3626@{#461}
OS Linux

@mkarolin
Copy link
Contributor

mkarolin commented Jan 3, 2019

@srirambv, I tested on Mint 19 Cinnamon with the command line switch and navigating to a pdf link results in a download prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension/PDFJS feature/global-settings Settings at browser level independent of shields settings priority/P3 The next thing for us to work on. It'll ride the trains. QA Pass-Linux QA Pass-macOS QA Pass-Win64 QA/Test-Plan-Specified QA/Yes release-notes/include
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants