Skip to content

Commit

Permalink
Merge pull request #8934 from brave/pr8921_issues/16062_1.26.x
Browse files Browse the repository at this point in the history
Get context from frame_tree_node_id in AdblockCnameResolveHostClient (uplift to 1.26.x)
  • Loading branch information
kjozwiak authored May 26, 2021
2 parents 2cc9d03 + 6313664 commit 9800dcb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion browser/net/brave_ad_block_tp_network_delegate_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ class AdblockCnameResolveHostClient : public network::mojom::ResolveHostClient {
if (secure_dns_config.mode() == net::SecureDnsMode::kSecure)
optional_parameters->source = net::HostResolverSource::DNS;

auto* web_contents =
content::WebContents::FromFrameTreeNodeId(ctx->frame_tree_node_id);
if (!web_contents) {
start_time_ = base::TimeTicks::Now();
this->OnComplete(net::ERR_FAILED, net::ResolveErrorInfo(), base::nullopt);
return;
}

network::mojom::NetworkContext* network_context =
content::BrowserContext::GetDefaultStoragePartition(
ctx->browser_context)
web_contents->GetBrowserContext())
->GetNetworkContext();

start_time_ = base::TimeTicks::Now();
Expand Down

0 comments on commit 9800dcb

Please sign in to comment.