Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
only set the user agent override if we are overriding the user agent
Browse files Browse the repository at this point in the history
auditors @bbondy
  • Loading branch information
bridiver authored and bbondy committed Dec 29, 2016
1 parent b3b9896 commit 0d2d46f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions atom/browser/api/atom_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1117,16 +1117,18 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
blink::WebReferrerPolicyDefault);

std::string user_agent;
if (options.Get("userAgent", &user_agent))
if (options.Get("userAgent", &user_agent)) {
web_contents()->SetUserAgentOverride(user_agent);
params.override_user_agent =
content::NavigationController::UA_OVERRIDE_TRUE;
}

std::string extra_headers;
if (options.Get("extraHeaders", &extra_headers))
params.extra_headers = extra_headers;

web_contents()->UserGestureDone();
params.transition_type = ui::PAGE_TRANSITION_TYPED;
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
web_contents()->GetController().LoadURLWithParams(params);
}

Expand Down

0 comments on commit 0d2d46f

Please sign in to comment.