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

Use pdfium #2342

Merged
merged 6 commits into from
May 31, 2019
Merged

Use pdfium #2342

merged 6 commits into from
May 31, 2019

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Apr 25, 2019

Fixes brave/brave-browser#3846
Fixes brave/brave-browser#3694
Fixes brave/brave-browser#884
Fixes brave/brave-browser#3119
Fixes brave/brave-browser#4424

To use pdfium, PluginRegistry::GetPlugins() must include pdfium plugins.
Built-in pdf plugins and flash are all that we can expose via navigator.plugins and mimeTypes.
So BravePluginRegistryImpl is deleted.

Submitter Checklist:

Test Plan:

Test fix for brave/brave-browser#3694

  1. Go to https://docs.google.com and login
  2. Create a new Google Sheets document
  3. Type some values in there
  4. Pick File => Print from the Google apps menu (not the browser menu)
  5. Try to print document
  6. Document should actually print (you should not be prompted to save as PDF)

Test fix for brave/brave-browser#884

  1. Go to http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.144.7135&rep=rep1&type=pdf
  2. Document should load properly

Test fix for brave/brave-browser#4424

  1. Go to http://pdfkit.org/demo/browser.html
  2. Document on right hand side should load properly

Embed test (possible fix for brave/brave-browser#3119)

  1. Go to https://pdfobject.com/examples/detection.html
  2. Message This browser supports inline PDFs should be shown (green color)

Test that PDF.js is still installable

  1. Go to https://chrome.google.com/webstore/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm
  2. Verify that you can install PDF.js
  3. Verify that PDF.js puts a browser action button in the extension area
  4. Verify that PDF.js shows in brave://extensions
  5. Open a PDF document and verify PDF.js is used

Test that PDF.js does not show

  1. Have an existing profile BEFORE testing this. Make sure PDF.js works
  2. Upgrade to a build with this fix
  3. Launch Brave from the command line with --show-component-extension-options
  4. Verify PDF.js does not show in brave://extensions
  5. Verify PDF.js does not show in brave://components

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@simonhong simonhong self-assigned this Apr 25, 2019
@simonhong simonhong added this to the 0.66.x - Nightly milestone Apr 25, 2019
@simonhong simonhong mentioned this pull request Apr 25, 2019
19 tasks
DEPS Outdated Show resolved Hide resolved
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "base/path_service.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we planning to re-introduce navigator.plugins? I think updating the test makes more sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jumde I deleted existing tests because this PR deleted all related codes and went back to chromium's original state. If we want to control exposed plugin/mimetype list strictly, I think we need to re-implement instead of previous BravePluginRegistryImpl way. (See #2128 (comment)). WDYT?

@bsclifton
Copy link
Member

Did some quick tests - looks great! 😄 Will create a test plan and update original post here

Besides creating a security review (which I can help with, when ready) one of the big TODO's (several called out on brave/brave-browser#3846) would be removing the existing PDF.js install for users (in favor of PDFium)

@bsclifton
Copy link
Member

bsclifton commented Apr 25, 2019

@simonhong
Copy link
Member Author

Pushed commit for fixing brave/brave-browser#3694. forgot to add. :)

@simonhong
Copy link
Member Author

Hmm, brave/brave-browser#1264 is still reproduced and I checked that our current stable(0.63.48) have same issue.

@bsclifton
Copy link
Member

@simonhong weird- it works for me on Nightly. But perhaps that hints to why. Does brave/brave-browser#1264 still happen with your latest fix?

@simonhong
Copy link
Member Author

@simonhong weird- it works for me on Nightly. But perhaps that hints to why. Does brave/brave-browser#1264 still happen with your latest fix?

Yes, still happening.

@simonhong
Copy link
Member Author

@bsclifton I'm testing on Mac and Nightly and Stable on my local have same issue... strange..

@simonhong
Copy link
Member Author

simonhong commented Apr 25, 2019

@bsclifton http://www.fina.org/content/swimming-world-ranking seems shields issue. When shields off, it displays well. Third party cookie block causes this issue.

@simonhong
Copy link
Member Author

Did some quick tests - looks great! 😄 Will create a test plan and update original post here

Besides creating a security review (which I can help with, when ready) one of the big TODO's (several called out on brave/brave-browser#3846) would be removing the existing PDF.js install for users (in favor of PDFium)

Yes, you're right. This PR should include logic for deleting PDF.js. I'll take a look that, too now.

@bsclifton bsclifton self-assigned this Apr 27, 2019
@bsclifton
Copy link
Member

Note to self: will look into the removal of PDF.js (and making sure it can be installed)

@NejcZdovc NejcZdovc removed this from the 0.66.x - Dev milestone May 15, 2019
@bsclifton bsclifton force-pushed the use_pdfium branch 3 times, most recently from b7bc646 to c600e87 Compare May 22, 2019 21:59
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Created a test plan a while back - added some more and ran through it. Things look great!

Waiting until go-update change is deployed and security review happens before approving

@diracdeltas
Copy link
Member

please remember to update
https://github.com/brave/brave-browser/wiki/Deviations-from-Chromium-(features-we-disable-or-remove) since it mentions we use pdfjs

@jumde
Copy link
Contributor

jumde commented May 30, 2019

Update to https://github.com/brave/brave-browser/wiki/Fingerprinting-Protection-Mode will be needed post merge for plugins and mime types.

https://github.com/brave/brave-browser/wiki/Deviations-from-Chromium-(features-we-disable-or-remove) - Need to be updated to remove any references to PDF.js

bsclifton and others added 6 commits May 30, 2019 14:26
So far, brave only exposes flash when it is available.
Brave will use pdfium as a pdf viewer instead of pdf.js.
That causes plugins and mimeTypes will include pdf things.
That means we expose all that brave have.
So, we don't need to blacklist except flash plugins.
Some google sites check pdf plugin name and do a different behavior whether
browser has chrome pdf plugin or not.
Ex, google docs print menu displays print preview when chrome pdf plugin is available.
Otherwise, just tries to download that documents as a pdf document.
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Tested out, works great 😄 Filled in test plan and re-tested / tagged all bugs this closes

@jumde jumde self-requested a review May 31, 2019 05:04
@bsclifton
Copy link
Member

go-update change pushed to prod with https://github.com/brave/devops/issues/1103

Updating the docs now...

@bsclifton
Copy link
Member

@@ -19,9 +19,9 @@ const char ChromeContentClient::kPDFExtensionPluginName[] = "Chrome PDF Viewer";
const char ChromeContentClient::kPDFInternalPluginName[] = "Chrome PDF Plugin";
#else
const char ChromeContentClient::kPDFExtensionPluginName[] =
Copy link
Collaborator

Choose a reason for hiding this comment

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

this can be done with a chromium_src override

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants