()
| 176 | |
| 177 | @memoize |
| 178 | def get_firefox_version(): |
| 179 | if not is_firefox(): |
| 180 | return UNSUPPORTED |
| 181 | exe_path = shutil.which(shlex.split(EMTEST_BROWSER)[0]) |
| 182 | ini_path = os.path.join(os.path.dirname(exe_path), '../Resources/platform.ini' if MACOS else 'platform.ini') |
| 183 | # On Linux, Firefox system installation uses a specific directory structure, |
| 184 | # where platform.ini is not located in same directory as the browser executable. |
| 185 | if LINUX and exe_path.startswith('/usr/bin/'): |
| 186 | def find_system_firefox_platform_ini(): |
| 187 | for path in ['/usr/lib/firefox-esr/', '/usr/lib/firefox/']: |
| 188 | ini = os.path.join(path, 'platform.ini') |
| 189 | if os.path.isfile(ini): |
| 190 | return ini |
| 191 | |
| 192 | ini_path = find_system_firefox_platform_ini() |
| 193 | if not ini_path: |
| 194 | logger.warning(f'Firefox browser detected in {EMTEST_BROWSER}, but could not find Firefox platform.ini to detect Firefox version. Assuming OLDEST_SUPPORTED_FIREFOX={OLDEST_SUPPORTED_FIREFOX}') |
| 195 | return OLDEST_SUPPORTED_FIREFOX |
| 196 | |
| 197 | # Extract the first numeric part before any dot (e.g. "Milestone=102.15.1" → 102) |
| 198 | m = re.search(r"^Milestone=(.*)$", read_file(ini_path), re.MULTILINE) |
| 199 | milestone = m.group(1).strip() |
| 200 | version = int(re.match(r"(\d+)", milestone).group(1)) |
| 201 | # On Nightly and Beta, e.g. 145.0a1, pretend it to still mean version 144, |
| 202 | # since it is a pre-release version |
| 203 | if any(c in milestone for c in ('a', 'b')): |
| 204 | version -= 1 |
| 205 | return version |
| 206 | |
| 207 | |
| 208 | def browser_should_skip_feature(skip_env_var, feature): |
no test coverage detected