|
37 | 37 | from tools import feature_matrix, utils |
38 | 38 | from tools.feature_matrix import UNSUPPORTED |
39 | 39 | from tools.shared import DEBUG, EMCC, exit_with_error |
40 | | -from tools.utils import MACOS, WINDOWS, memoize, path_from_root, read_binary |
| 40 | +from tools.utils import LINUX, MACOS, WINDOWS, memoize, path_from_root, read_binary |
41 | 41 |
|
42 | 42 | logger = logging.getLogger('common') |
43 | 43 |
|
@@ -167,6 +167,13 @@ def get_firefox_version(): |
167 | 167 | return UNSUPPORTED |
168 | 168 | exe_path = shlex.split(EMTEST_BROWSER)[0] |
169 | 169 | ini_path = os.path.join(os.path.dirname(exe_path), '../Resources/platform.ini' if MACOS else 'platform.ini') |
| 170 | + # On Linux, Firefox system installation uses a specific directory structure. |
| 171 | + if LINUX and exe_path.startswith('/usr/bin/'): |
| 172 | + if os.path.isfile('/usr/lib/firefox-esr/platform.ini'): |
| 173 | + ini_path = '/usr/lib/firefox-esr/platform.ini' |
| 174 | + elif os.path.isfile('/usr/lib/firefox/platform.ini'): |
| 175 | + ini_path = '/usr/lib/firefox/platform.ini' |
| 176 | + |
170 | 177 | # Extract the first numeric part before any dot (e.g. "Milestone=102.15.1" → 102) |
171 | 178 | m = re.search(r"^Milestone=(.*)$", read_file(ini_path), re.MULTILINE) |
172 | 179 | milestone = m.group(1).strip() |
@@ -318,7 +325,17 @@ def configure_test_browser(): |
318 | 325 | return |
319 | 326 |
|
320 | 327 | if not EMTEST_BROWSER: |
321 | | - EMTEST_BROWSER = 'google-chrome' |
| 328 | + def find_in_path(cmd): |
| 329 | + for path in os.environ['PATH'].split(os.pathsep): |
| 330 | + exe_file = os.path.join(path, cmd) |
| 331 | + if WINDOWS: |
| 332 | + exe_file += '.exe' |
| 333 | + if os.path.isfile(exe_file): |
| 334 | + return exe_file |
| 335 | + |
| 336 | + EMTEST_BROWSER = find_in_path('google-chrome') |
| 337 | + if not EMTEST_BROWSER: |
| 338 | + EMTEST_BROWSER = find_in_path('firefox') |
322 | 339 |
|
323 | 340 | if WINDOWS and '"' not in EMTEST_BROWSER and "'" not in EMTEST_BROWSER: |
324 | 341 | # On Windows env. vars canonically use backslashes as directory delimiters, e.g. |
|
0 commit comments