Skip to content

Commit

Permalink
Turned on the sec-fetch-dest header for Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeenan committed Apr 25, 2019
1 parent fcf14e5 commit 1bf502e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
11 changes: 8 additions & 3 deletions internal/chrome_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
'"MAP clients1.google.com 127.0.0.1"'
]

ENABLE_CHROME_FEATURES = [
'SecMetadata'
]

""" Orange page
<html>
<head>
Expand Down Expand Up @@ -109,6 +113,7 @@ def prepare(self, job, task):
def launch(self, job, task):
"""Launch the browser"""
args = list(CHROME_COMMAND_LINE_OPTIONS)
features = list(ENABLE_CHROME_FEATURES)
host_rules = list(HOST_RULES)
if 'host_rules' in task:
host_rules.extend(task['host_rules'])
Expand All @@ -119,9 +124,9 @@ def launch(self, job, task):
self.adb.shell(['rm', '/data/local/tmp/netlog.txt'])
args.append('--log-net-log=/data/local/tmp/netlog.txt')
if 'overrideHosts' in task and task['overrideHosts']:
args.append('--enable-features=NetworkService')
else:
args.append('--disable-features=NetworkService')
features.append('NetworkService')
features.append('NetworkServiceInProcess')
args.append('--enable-features=' + ','.join(features))
command_line = 'chrome ' + ' '.join(args)
if 'addCmdLine' in job:
command_line += ' ' + job['addCmdLine']
Expand Down
12 changes: 8 additions & 4 deletions internal/chrome_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
'"MAP clients1.google.com 127.0.0.1"'
]

ENABLE_CHROME_FEATURES = [
'NetworkService',
'NetworkServiceInProcess',
'SecMetadata'
]

class ChromeDesktop(DesktopBrowser, DevtoolsBrowser):
"""Desktop Chrome"""
def __init__(self, path, options, job):
Expand All @@ -58,6 +64,7 @@ def launch(self, job, task):
"""Launch the browser"""
self.install_policy()
args = list(CHROME_COMMAND_LINE_OPTIONS)
features = list(ENABLE_CHROME_FEATURES)
host_rules = list(HOST_RULES)
if 'host_rules' in task:
host_rules.extend(task['host_rules'])
Expand All @@ -73,16 +80,13 @@ def launch(self, job, task):
if 'profile' in task:
args.append('--user-data-dir="{0}"'.format(task['profile']))
self.setup_prefs(task['profile'])
if 'overrideHosts' in task and task['overrideHosts']:
args.append('--enable-features=NetworkService')
else:
args.append('--disable-features=NetworkService')
if self.options.xvfb:
args.append('--disable-gpu')
if self.options.dockerized:
args.append('--no-sandbox')
if platform.system() == "Linux":
args.append('--disable-setuid-sandbox')
args.append('--enable-features=' + ','.join(features))
if self.path.find(' ') > -1:
command_line = '"{0}"'.format(self.path)
else:
Expand Down

0 comments on commit 1bf502e

Please sign in to comment.