Skip to content

Commit 99e4743

Browse files
[WPE] MiniBrowser script doesn't proxy Sysprof env vars
https://bugs.webkit.org/show_bug.cgi?id=277363 Reviewed by Nikolas Zimmermann. The MiniBrowser Python script proxies Sysprof env vars in the GTK case, but a similar code in WPE is missing. Move this code to the generic path (GLib) and use it in both the GTK and WPE. * Tools/Scripts/webkitpy/port/glib.py: (GLibPort.setup_sysprof_for_minibrowser): * Tools/Scripts/webkitpy/port/gtk.py: (GtkPort.run_minibrowser): * Tools/Scripts/webkitpy/port/wpe.py: (WPEPort.run_minibrowser): Canonical link: https://commits.webkit.org/281652@main
1 parent 0d34665 commit 99e4743

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

Tools/Scripts/webkitpy/port/glib.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ def setup_environ_for_minibrowser(self):
154154
env['LD_LIBRARY_PATH'] = self._prepend_to_env_value(self._build_path('lib'), env.get('LD_LIBRARY_PATH', ''))
155155
return env
156156

157+
def setup_sysprof_for_minibrowser(self):
158+
pass_fds = ()
159+
env = self.setup_environ_for_minibrowser()
160+
161+
if os.environ.get("SYSPROF_CONTROL_FD"):
162+
try:
163+
control_fd = int(os.environ.get("SYSPROF_CONTROL_FD"))
164+
copy_fd = os.dup(control_fd)
165+
pass_fds += (copy_fd, )
166+
env["SYSPROF_CONTROL_FD"] = str(copy_fd)
167+
except (ValueError):
168+
pass
169+
170+
return env, pass_fds
171+
157172
def _get_crash_log(self, name, pid, stdout, stderr, newer_than, target_host=None):
158173
return GDBCrashLogGenerator(self._executive, name, pid, newer_than,
159174
self._filesystem, self._path_to_driver, self.port_name, self.get_option('configuration')).generate_crash_log(stdout, stderr)

Tools/Scripts/webkitpy/port/gtk.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,7 @@ def run_minibrowser(self, args):
181181
if os.environ.get("WEBKIT_MINI_BROWSER_PREFIX"):
182182
command = shlex.split(os.environ["WEBKIT_MINI_BROWSER_PREFIX"]) + command
183183

184-
env = self.setup_environ_for_minibrowser()
185-
pass_fds = ()
186-
if os.environ.get("SYSPROF_CONTROL_FD"):
187-
try:
188-
control_fd = int(os.environ.get("SYSPROF_CONTROL_FD"))
189-
copy_fd = os.dup(control_fd)
190-
pass_fds += (copy_fd, )
191-
env["SYSPROF_CONTROL_FD"] = str(copy_fd)
192-
193-
except (ValueError):
194-
pass
184+
env, pass_fds = self.setup_sysprof_for_minibrowser()
195185

196186
if self._should_use_jhbuild():
197187
command = self._jhbuild_wrapper + command

Tools/Scripts/webkitpy/port/wpe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def setup_environ_for_minibrowser(self):
131131
return env
132132

133133
def run_minibrowser(self, args):
134-
env = None
135134
miniBrowser = None
136135

137136
if self.browser_name() == "cog":
@@ -155,6 +154,8 @@ def run_minibrowser(self, args):
155154
if os.environ.get("WEBKIT_MINI_BROWSER_PREFIX"):
156155
command = shlex.split(os.environ["WEBKIT_MINI_BROWSER_PREFIX"]) + command
157156

157+
env, pass_fds = self.setup_sysprof_for_minibrowser()
158+
158159
if self._should_use_jhbuild():
159160
command = self._jhbuild_wrapper + command
160-
return self._executive.run_command(command + args, cwd=self.webkit_base(), stdout=None, return_stderr=False, decode_output=False, env=self.setup_environ_for_minibrowser())
161+
return self._executive.run_command(command + args, cwd=self.webkit_base(), stdout=None, return_stderr=False, decode_output=False, env=env, pass_fds=pass_fds)

0 commit comments

Comments
 (0)