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

Hide the chrome-extension prefix in PDFjs URLs (closes brave/brave-browser#368) #1074

Closed
wants to merge 0 commits into from

Conversation

fmarier
Copy link
Member

@fmarier fmarier commented Dec 12, 2018

Submitter Checklist:

  • 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).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests) on
    • Windows
    • macOS
    • Linux
  • Ran git rebase master (if needed).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Yes or QA/No) to include the closed issue in milestone

Test Plan:

Fixes: brave/brave-browser#368

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

@fmarier
Copy link
Member Author

fmarier commented Dec 12, 2018

Note: this patch also fixes the edit URLs for things like brave://rewards and brave://settings (which currently revert back to the chrome:// scheme when you try to copy/paste them (brave/brave-browser#1616).

@fmarier
Copy link
Member Author

fmarier commented Dec 12, 2018

Hi @yrliou, would you be willing to review this patch? Please let me know if I've missed anything process-wise.

@yrliou yrliou self-requested a review December 13, 2018 00:07
@@ -32,5 +37,21 @@ base::string16 BraveToolbarModelImpl::GetURLForDisplay() const {
formatted_text.replace(0, original_scheme_part.length(),
replacement_scheme_part);
}
Copy link
Member

Choose a reason for hiding this comment

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

Previously when I did the security review for using GetURLForDisplay to map brave:// to chrome:// in the URL bar, I assumed the returned URL was not being used for any security checks. However it turns out that assumption was wrong (brave/brave-browser#2631 - sorry you can't see the details yet! can share in Slack).

Copy link
Member

Choose a reason for hiding this comment

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

actually ignore my above comment, i got brave/brave-browser#213 mixed up with brave/brave-browser#1458

Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here, codes LGTM.
Could you rebase it so I could give it a quick try too?
BraveToolbarModelImpl is renamed to BraveLocationBarModelImpl now.

@@ -18,11 +20,14 @@ const base::string16 original_scheme_part =
const base::string16 replacement_scheme_part =
base::ASCIIToUTF16(kInternalUIScheme);

const base::string16 pdfjs_url_prefix =
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use BraveContentBrowserClient::BrowserURLHandlerCreated to add a HandlerPair for this? That's typically how it would work

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

Successfully merging this pull request may close these issues.

Opening PDF in a tab shows chrome://extension URL and PDF extension favicon
4 participants