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

Display brave:// protocol for internal urls when hovered #15336

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

petemill
Copy link
Member

@petemill petemill commented Oct 4, 2022

Replaces chrome://. This is another unfortunate side effect of us still using chrome:// as the protocol which is neccessary as there are many checks for that string specifically and we're not at a point to change that at the moment. However, this is probably the most visible place remaining where Brave still shows chrome:// and so changing it to brave:// is helpful to avoid confusion.

This was also attempted similarly in #1825 and reverted by #2188, so first I'm seeing which tests fail.

Resolves brave/brave-browser#2566

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@petemill petemill self-assigned this Oct 4, 2022
@petemill petemill force-pushed the url_bubble_brave_protocol branch 2 times, most recently from 7ccfe2b to 9daa348 Compare October 25, 2022 21:33
@petemill petemill added the CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux) label Oct 25, 2022
@petemill petemill force-pushed the url_bubble_brave_protocol branch from 9daa348 to c029de0 Compare October 25, 2022 22:58
@petemill
Copy link
Member Author

I ran upstream tests since this changes some chromium UI. Looks like upstream tests all passed on macOS, Linux and Android (if applicable?) but some failed on Windows. They seem unrelated

3 tests failed:
17:44:09      MetricIntegrationTest.FirstInputDelay (..\..\chrome\browser\page_load_metrics\integration_tests\first_input_delay_browsertest.cc:17)
17:44:09      PersistedPermissionsFileSystemAccessBrowserTest.UsageIndicatorVisibleWithPersistedPermissionsEnabled (..\..\chrome\browser\ui\views\file_system_access\file_system_access_browsertest.cc:804)
17:44:09      WebAppTabStripBrowserTest.OnlyNavigateHomeTabIfDifferentUrl (..\..\chrome\browser\ui\views\web_apps\web_app_tab_strip_browsertest.cc:494)

@sangwoo108
Copy link
Contributor

One of error looks interesting

Terminating render process for bad Mojo message: Received bad user message: No binder found for interface brave_news.mojom.BraveNewsController for the frame/document scope

Copy link
Contributor

@sangwoo108 sangwoo108 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

GURL::Replacements replacements;
replacements.SetSchemeStr(content::kBraveUIScheme);
target_url = target_url.ReplaceComponents(replacements);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be worth replacing 'chrome-untrusted' too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not so sure about that because chrome-untrusted is never meant to be displayed to users

Copy link
Member

@simonhong simonhong left a comment

Choose a reason for hiding this comment

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

++ 👍🏼 It would be nice to have a test case for this :)

@petemill
Copy link
Member Author

++ 👍🏼 It would be nice to have a test case for this :)

@simonhong Yes to be honest I was surprised that there weren't more existing test failures as I think you tried this in a previous PR but reverted or didn't merge?

@simonhong
Copy link
Member

++ 👍🏼 It would be nice to have a test case for this :)

@simonhong Yes to be honest I was surprised that there weren't more existing test failures as I think you tried this in a previous PR but reverted or didn't merge?

Not sure but maybe it would be possible that my previous PR was not the cause of test failure at that time.

@petemill petemill force-pushed the url_bubble_brave_protocol branch from c029de0 to 4a021e0 Compare October 28, 2022 17:35
Replaces chrome://. This is another unfortunate side effect of us still using chrome:// as the protocol which is neccessary as there are many checks for that string specifically and we're not at a point to change that at the moment. However, this is probably the most visible place remaining where Brave still shows chrome:// and so changing it to brave:// is helpful to avoid confusion
@petemill petemill force-pushed the url_bubble_brave_protocol branch from 4a021e0 to 7a808f8 Compare November 3, 2022 03:50
@petemill
Copy link
Member Author

petemill commented Nov 3, 2022

++ 👍🏼 It would be nice to have a test case for this :)

I looked in to adding a test for this, probably in brave_browser_browsertest.cc. The problem is that the GURL is passed to StatusBubbleViews::StatusView which does not provide a public API to read the value back. There aren't even any tests to check the set url in chromium. If anyone has a suggestion on a clean way to read this back then I'll consider it. Otherwise I could move the GURL-modifying code in to a testable static util function, but it seems to simple to need a test.

@simonhong
Copy link
Member

++ 👍🏼 It would be nice to have a test case for this :)

I looked in to adding a test for this, probably in brave_browser_browsertest.cc. The problem is that the GURL is passed to StatusBubbleViews::StatusView which does not provide a public API to read the value back. There aren't even any tests to check the set url in chromium. If anyone has a suggestion on a clean way to read this back then I'll consider it. Otherwise I could move the GURL-modifying code in to a testable static util function, but it seems to simple to need a test.

Ok, let's go with current PR :)

@linhkikuchi linhkikuchi merged commit 75145ac into master Nov 3, 2022
@linhkikuchi linhkikuchi deleted the url_bubble_brave_protocol branch November 3, 2022 23:46
@github-actions github-actions bot added this to the 1.47.x - Nightly milestone Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-upstream-tests Run upstream unit and browser tests on Linux and Windows (otherwise only on Linux)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Tab Page uses 'chrome' links for History, Bookmarks, and Preferences
4 participants