Skip to content

Commit 1bf502e

Browse files
committed
Turned on the sec-fetch-dest header for Chrome
1 parent fcf14e5 commit 1bf502e

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

internal/chrome_android.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
'"MAP clients1.google.com 127.0.0.1"'
4545
]
4646

47+
ENABLE_CHROME_FEATURES = [
48+
'SecMetadata'
49+
]
50+
4751
""" Orange page
4852
<html>
4953
<head>
@@ -109,6 +113,7 @@ def prepare(self, job, task):
109113
def launch(self, job, task):
110114
"""Launch the browser"""
111115
args = list(CHROME_COMMAND_LINE_OPTIONS)
116+
features = list(ENABLE_CHROME_FEATURES)
112117
host_rules = list(HOST_RULES)
113118
if 'host_rules' in task:
114119
host_rules.extend(task['host_rules'])
@@ -119,9 +124,9 @@ def launch(self, job, task):
119124
self.adb.shell(['rm', '/data/local/tmp/netlog.txt'])
120125
args.append('--log-net-log=/data/local/tmp/netlog.txt')
121126
if 'overrideHosts' in task and task['overrideHosts']:
122-
args.append('--enable-features=NetworkService')
123-
else:
124-
args.append('--disable-features=NetworkService')
127+
features.append('NetworkService')
128+
features.append('NetworkServiceInProcess')
129+
args.append('--enable-features=' + ','.join(features))
125130
command_line = 'chrome ' + ' '.join(args)
126131
if 'addCmdLine' in job:
127132
command_line += ' ' + job['addCmdLine']

internal/chrome_desktop.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
'"MAP clients1.google.com 127.0.0.1"'
4444
]
4545

46+
ENABLE_CHROME_FEATURES = [
47+
'NetworkService',
48+
'NetworkServiceInProcess',
49+
'SecMetadata'
50+
]
51+
4652
class ChromeDesktop(DesktopBrowser, DevtoolsBrowser):
4753
"""Desktop Chrome"""
4854
def __init__(self, path, options, job):
@@ -58,6 +64,7 @@ def launch(self, job, task):
5864
"""Launch the browser"""
5965
self.install_policy()
6066
args = list(CHROME_COMMAND_LINE_OPTIONS)
67+
features = list(ENABLE_CHROME_FEATURES)
6168
host_rules = list(HOST_RULES)
6269
if 'host_rules' in task:
6370
host_rules.extend(task['host_rules'])
@@ -73,16 +80,13 @@ def launch(self, job, task):
7380
if 'profile' in task:
7481
args.append('--user-data-dir="{0}"'.format(task['profile']))
7582
self.setup_prefs(task['profile'])
76-
if 'overrideHosts' in task and task['overrideHosts']:
77-
args.append('--enable-features=NetworkService')
78-
else:
79-
args.append('--disable-features=NetworkService')
8083
if self.options.xvfb:
8184
args.append('--disable-gpu')
8285
if self.options.dockerized:
8386
args.append('--no-sandbox')
8487
if platform.system() == "Linux":
8588
args.append('--disable-setuid-sandbox')
89+
args.append('--enable-features=' + ','.join(features))
8690
if self.path.find(' ') > -1:
8791
command_line = '"{0}"'.format(self.path)
8892
else:

0 commit comments

Comments
 (0)