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

Don't check main frame requests through shields network delegate helper #8402

Merged
merged 2 commits into from
Apr 1, 2021

Conversation

antonok-edm
Copy link
Collaborator

@antonok-edm antonok-edm commented Mar 31, 2021

Resolves brave/brave-browser#15047

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:

Visit https://shivankaul.com and click on the LinkedIn icon. The navigation to LinkedIn should not be blocked, both when #brave-domain-block is enabled and disabled under brave://flags.

Also, ensure that when #brave-domain-block is enabled under brave://flags, visiting https://1-1ads.com brings up a "Suspicious site ahead" interstitial with a "Proceed" button.

@antonok-edm antonok-edm requested a review from iefremov April 1, 2021 17:01
"domAutomationController.send(clickLink('" + cross_url.spec() + "'));";
bool success = false;
EXPECT_TRUE(
ExecuteScriptAndExtractBool(web_contents(), clickLink.c_str(), &success));
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rewrite this with EvalJs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good call, updated

// helper.
const std::string location =
EvalJs(web_contents(), "window.location.href").ExtractString();
ASSERT_STRNE("chrome-error://chromewebdata/", location.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for c_str

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we do need it, when I remove it I get this:

../../third_party/googletest/src/googletest/include/gtest/gtest.h:1669:28: note: candidate function not viable: no known conversion from 'const std::string' (aka 'const basic_string<char>') to 'const char *' for 4th argument
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
                           ^
../../third_party/googletest/src/googletest/include/gtest/gtest.h:1694:28: note: candidate function not viable: no known conversion from 'const char [30]' to 'const wchar_t *' for 3rd argument
GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,

@antonok-edm antonok-edm force-pushed the no-more-blocked-by-extension branch from 7d51927 to a49f954 Compare April 1, 2021 17:56
@antonok-edm antonok-edm merged commit ffc1365 into master Apr 1, 2021
@antonok-edm antonok-edm deleted the no-more-blocked-by-extension branch April 1, 2021 18:03
brave-builds pushed a commit that referenced this pull request Apr 1, 2021
@antonok-edm antonok-edm added this to the 1.23.x - Beta milestone Apr 1, 2021
@kjozwiak
Copy link
Member

kjozwiak commented Apr 6, 2021

Verification PASSED on Win 10 x64 using the following build:

Brave | 1.24.50 Chromium: 90.0.4430.51 (Official Build) nightly (64-bit)
-- | --
Revision | 32e5fa33a31641bded70a90e60121060691e7125-refs/branch-heads/4430@{#927}
OS | Windows 10 OS Version 2009 (Build 19042.868)

Test Cases from #8402 (comment):

  • visited https://shivankaul.com and ensured it loaded without any issues with #brave-domain-block set as Default (enabled)
  • visited https://shivankaul.com and ensured it loaded without any issues with #brave-domain-block set as Enabled (enabled)
  • visited https://shivankaul.com and ensured it loaded without any issues with #brave-domain-block set as Disabled
Enabled Example Enabled Example
enabled1 enabled2
Disabled Example Disabled Example
disabled1 disabled2

Visited https://1-1ads.com and ensured that Brave brings up a "Suspicious site ahead" interstitial with a "Proceed" button as per the following:

domainBlocked

Test Cases from brave/brave-browser#15047 (comment):

Ensured that selecting the Unsubscribe button and clicking on Submit works as expected:

DowUnsuscribe

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.

frequent "blocked by extension" error page
5 participants