Modified: trunk/Tools/ChangeLog (292518 => 292519)
--- trunk/Tools/ChangeLog 2022-04-07 01:06:34 UTC (rev 292518)
+++ trunk/Tools/ChangeLog 2022-04-07 01:08:53 UTC (rev 292519)
@@ -1,3 +1,16 @@
+2022-04-06 Dewei Zhu <dewei_...@apple.com>
+
+ Use 'open' command on macOS to launch URL should pass Safari app bundle instead of binary
+ https://bugs.webkit.org/show_bug.cgi?id=238915
+ <rdar://91384008>
+
+ Reviewed by Stephanie Lewis.
+
+ Pass 'Safari.app' instead of 'Safari.app/Contents/MacOS/Safari' when launching URL via 'open' command.
+
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+ (OSXSafariDriver.launch_url):
+
2022-04-04 Jonathan Bedard <jbed...@apple.com>
[Merge-Queue] Run `git svn fetch`
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py (292518 => 292519)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py 2022-04-07 01:06:34 UTC (rev 292518)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py 2022-04-07 01:08:53 UTC (rev 292519)
@@ -23,7 +23,8 @@
self._maximize_window()
def launch_url(self, url, options, browser_build_path, browser_path):
- args = ['/Applications/Safari.app/Contents/MacOS/Safari']
+ safari_app_path = '/Applications/Safari.app'
+ safari_binary_path = os.path.join(safari_app_path, 'Contents/MacOS/Safari')
env = {}
for key, value in os.environ.items():
if re.match(r"^__XPC_", key):
@@ -30,31 +31,29 @@
env[key] = value
if browser_build_path:
browser_build_absolute_path = os.path.abspath(browser_build_path)
- safari_app_in_build_path = os.path.join(browser_build_absolute_path, 'Safari.app/Contents/MacOS/Safari')
- has_safari_app = os.path.exists(safari_app_in_build_path)
- content_in_path = os.listdir(browser_build_absolute_path)
+ safari_app_path = os.path.join(browser_build_absolute_path, 'Safari.app')
+ safari_binary_path = os.path.join(safari_app_path, 'Contents/MacOS/Safari')
+ has_safari_binary = os.path.exists(safari_binary_path)
contains_frameworks = any(map(lambda entry: entry.endswith('.framework'), os.listdir(browser_build_absolute_path)))
- if has_safari_app:
- args = [safari_app_in_build_path]
-
if contains_frameworks:
env['DYLD_FRAMEWORK_PATH'] = browser_build_absolute_path
env['DYLD_LIBRARY_PATH'] = browser_build_absolute_path
env['__XPC_DYLD_FRAMEWORK_PATH'] = browser_build_absolute_path
env['__XPC_DYLD_LIBRARY_PATH'] = browser_build_absolute_path
- elif not has_safari_app:
+ elif not has_safari_binary:
raise Exception('Could not find any framework "{}"'.format(browser_build_path))
elif browser_path:
- safari_app_in_browser_path = os.path.join(browser_path, 'Contents/MacOS/Safari')
- if os.path.exists(safari_app_in_browser_path):
- args = [safari_app_in_browser_path]
+ safari_binary_path = os.path.join(browser_path, 'Contents/MacOS/Safari')
+ if os.path.exists(safari_binary_path):
+ safari_app_path = browser_path
else:
- raise Exception('Could not find Safari.app at {}'.format(safari_app_in_browser_path))
+ raise Exception('Could not find Safari.app at {}'.format(safari_app_path))
- args.extend(self._safari_preferences)
- _log.info('Launching safari: %s with url: %s' % (args[0], url))
+ args = [safari_binary_path] + self._safari_preferences
+
+ _log.info('Launching safari: %s with url: %s' % (safari_binary_path, url))
self._safari_process = OSXSafariDriver._launch_process_with_caffeinate(args, env)
# Stop for initialization of the safari process, otherwise, open
@@ -71,12 +70,12 @@
**(dict(encoding='utf-8') if sys.version_info >= (3, 6) else dict())
)
output = process.communicate()[0]
- if has_safari_app:
+ if has_safari_binary:
assert 'Safari.app/Contents/MacOS/Safari' in output, 'Safari.app is not launched from "{}"'.format(browser_build_path)
if contains_frameworks:
assert '.framework' in output, 'No framework is loaded from "{}"'.format(browser_build_path)
- subprocess.Popen(['open', '-a', args[0], url])
+ subprocess.Popen(['open', '-a', safari_app_path, url])
def launch_driver(self, url, options, browser_build_path):
from selenium import webdriver