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

Remove dom_distiller dependency from BraveAds #17366

Merged
merged 3 commits into from
Mar 1, 2023
Merged

Remove dom_distiller dependency from BraveAds #17366

merged 3 commits into from
Mar 1, 2023

Conversation

aseren
Copy link
Collaborator

@aseren aseren commented Feb 24, 2023

Resolves brave/brave-browser#28751

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 wiki
    • npm run lint, npm run presubmit wiki, 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:

@aseren aseren requested review from a team as code owners February 24, 2023 18:46
@aseren aseren changed the title Remove BraveAds dependency from dom_distiller Remove dom_distiller dependency from BraveAds Feb 24, 2023
@@ -47,7 +46,6 @@ AdsServiceFactory::AdsServiceFactory()
"AdsService",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(NotificationDisplayServiceFactory::GetInstance());
DependsOn(dom_distiller::DomDistillerServiceFactory::GetInstance());
Copy link
Contributor

Choose a reason for hiding this comment

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

@boocmp fyi

@iefremov
Copy link
Contributor

it seems there are unused

app/DEPS:  "+components/dom_distiller/core/dom_distiller_switches.h",
app/brave_main_delegate.cc:#include "components/dom_distiller/core/dom_distiller_switches.h"

// get all browser tests crashing when dom_distiller::RunIsolatedJavaScript()
// gets called from AdsTabHelper::RunIsolatedJavaScript() (called via the
// WebContentsObserver machinery), since the JS World ID won't be set yet when
// dom_distiller::RunIsolatedJavaScript() gets called.
absl::optional<int> ChromeMainDelegate::BasicStartupComplete() {
BraveCommandLineHelper command_line(base::CommandLine::ForCurrentProcess());
command_line.AppendSwitch(switches::kDisableDomainReliability);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove command_line.AppendSwitch(switches::kEnableDomDistiller); ?

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 tried, but removing this line hides the speed-reader icon in Brave.

Copy link
Contributor

@boocmp boocmp Feb 28, 2023

Choose a reason for hiding this comment

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

thats because we have #define ReaderIconView SpeedreaderIconView :/

@iefremov
Copy link
Contributor

also there is a dep in brave/browser/sources.gni
and a strange ancient patch patches/components-dom_distiller-content-browser-distiller_page_web_contents.cc.patch

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM++

@aseren
Copy link
Collaborator Author

aseren commented Feb 27, 2023

app/DEPS:  "+components/dom_distiller/core/dom_distiller_switches.h",
app/brave_main_delegate.cc:#include "components/dom_distiller/core/dom_distiller_switches.h"

These are still needed for command_line.AppendSwitch(switches::kEnableDomDistiller); so I moved them to chromium_src/chrome/app/chrome_main_delegate.cc

@aseren
Copy link
Collaborator Author

aseren commented Feb 27, 2023

also there is a dep in brave/browser/sources.gni
and a strange ancient patch patches/components-dom_distiller-content-browser-distiller_page_web_contents.cc.patch

Fixed, thanks for pointing out these. The patch becomes unused after PR #4649.

@aseren aseren merged commit dae25bb into master Mar 1, 2023
@aseren aseren deleted the issues/28751 branch March 1, 2023 20:38
@github-actions github-actions bot added this to the 1.51.x - Nightly milestone Mar 1, 2023
@@ -27,6 +26,15 @@

namespace brave_ads {

namespace {

constexpr char16_t kGetDocumentHTMLScript[] =
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're injecting this into every page? This seems like a probable perf issue, but what exactly are we using this for anyway? If the purpose of this is to get page content, this is definitely not what we should be doing

Copy link
Collaborator

Choose a reason for hiding this comment

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

also this appears to be happening even if ads is disabled?

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.

Remove BraveAds dependency from dom_distiller
6 participants