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

Set proper DDG config as a default alternate SE except QWANT region in Tor #9486

Merged
merged 1 commit into from
Jul 21, 2021

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Jul 19, 2021

fix brave/brave-browser#16950

Resolves

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
  • 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:

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.

++

@simonhong simonhong changed the title Set DDG explicitely as default alternate SE in unexpected situation Set DDG explicitely as default alternate SE except for QWANT region Jul 19, 2021
@@ -39,25 +39,9 @@ SearchEngineProviderService::SearchEngineProviderService(
base::BindRepeating(&SearchEngineProviderService::OnPreferenceChanged,
base::Unretained(this)));

std::vector<TemplateURLPrepopulateData::BravePrepopulatedEngineID>
Copy link
Member Author

Choose a reason for hiding this comment

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

@bsclifton Should I leave this logic as-is? this alternative url is used for private/guest profile.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is OK 😄 Like you shared, this is only used in Tor window and then private window when "use DDG" flag is enabled

@@ -54,26 +55,14 @@ void TorWindowSearchEngineProviderService::OnTemplateURLServiceChanged() {
std::unique_ptr<TemplateURLData>
TorWindowSearchEngineProviderService::GetInitialSearchEngineProvider(
PrefService* prefs) const {
std::unique_ptr<TemplateURLData> provider_data;

int initial_id = TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(
Copy link
Member Author

@simonhong simonhong Jul 19, 2021

Choose a reason for hiding this comment

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

Instead of using TemplateURLPrepopulateData::duckduckgo for all regions,
how about using this logic(https://github.com/brave/brave-core/pull/9486/files#diff-303c4f4e4e368bfb2681efc54ff35e1412d362740939fc50c7f93b9b92bcca2cL42) for private and tor profile both?

Copy link
Member

Choose a reason for hiding this comment

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

We already talked on Slack- but just documenting that we can use regular DDG link for Tor window 👍

@simonhong simonhong changed the title Set DDG explicitely as default alternate SE except for QWANT region Set proper DDG config as a default alternate SE except QWANT region Jul 19, 2021
@iefremov
Copy link
Contributor

Maybe we could add a browser test to reproduce the crash?

@simonhong
Copy link
Member Author

simonhong commented Jul 20, 2021

@iefremov hmm, fortunately, can't add crash test because we'll always use proper non-null data. :)
https://github.com/brave/brave-core/pull/9486/files#diff-47f3a46781b3d57c425d88997d333a4fc8b2000d435b2140ffb8eb18cd9870d6R67

@simonhong simonhong changed the title Set proper DDG config as a default alternate SE except QWANT region Set proper DDG config as a default alternate SE except QWANT region in Tor Jul 20, 2021
…n tor

As we changed some regions(AU, NZ, IE, DE)'s DSE to google, orignally used DDG
variants(ex, DDG_DE)  was set to initial_id. However, Those regions's default list
doesn't have previously used DDG variants. So, |provider_data| could be nullptr.
Set DDG always for non QWANT region.

fix brave/brave-browser#16950
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.

Thanks for digging in and confirming the root cause 😄

@simonhong simonhong merged commit b8801a3 into master Jul 21, 2021
@simonhong simonhong deleted the fix_tor_window_crash branch July 21, 2021 06:38
@simonhong simonhong added this to the 1.29.x - Nightly milestone Jul 21, 2021
brave-builds pushed a commit that referenced this pull request Jul 21, 2021
bsclifton pushed a commit that referenced this pull request Jul 21, 2021
Set proper DDG config as a default alternate SE except QWANT region in Tor
bsclifton pushed a commit that referenced this pull request Jul 21, 2021
@stephendonner
Copy link
Contributor

stephendonner commented Jul 21, 2021

Verified PASSED using the testplan from brave/brave-browser#16950 (comment) with build

Brave 1.29.16 Chromium: 92.0.4515.101 (Official Build) nightly (64-bit)
Revision edb73f4fb624e2ea0cb6f5cc39c9e317ecd3535b-refs/branch-heads/4515@{#1536}
OS Windows 10 OS Version 2009 (Build 22000.71)

Steps:

  1. changed Region in Windows 10 to Australia
  2. new profile
  3. launched Brave
  4. clicked on the "hamburger" menu and chose New private window with Tor
  5. confirmed I wasn't able to reproduce a crash
  6. also tried before this clean profile, with existing, always-crashing profile, and it was fine there, too 👍
  7. also changed search engines and regions a bit, to try to test around the fix; observed no crashes

Verification PASSED on macOS 11.4 x64 using the following build:

Brave | 1.29.16 Chromium: 92.0.4515.101 (Official Build) nightly (x86_64)
--- | ---
Revision | edb73f4fb624e2ea0cb6f5cc39c9e317ecd3535b-refs/branch-heads/4515@{#1536}
OS | macOS Version 11.4 (Build 20F71)

Reproduced the original issue using 1.29.15 Chromium: 92.0.4515.101 while running through from brave/brave-browser#16950 (comment).

  • ensured that the browser doesn't crash when selecting New private window with Tor from the Hamburger Menu
  • updated an existing profile that crashed under 1.29.15 Chromium: 92.0.4515.101 --> 1.29.16 Chromium: 92.0.4515.101 and ensured everything was working as expected
  • ran through a few Tor cases (opening websites, running through check.torproject.org etc..)

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.

Browser crash clicking on New private window with Tor
4 participants