()
| 426 | |
| 427 | // Check if Vimium should be enabled or not based on the top frame's URL. |
| 428 | async function checkIfEnabledForUrl() { |
| 429 | const promises = []; |
| 430 | promises.push(chrome.runtime.sendMessage({ handler: "initializeFrame" })); |
| 431 | if (!Settings.isLoaded()) { |
| 432 | promises.push(Settings.onLoaded()); |
| 433 | } |
| 434 | const [response, ...unused] = await Promise.all(promises); |
| 435 | |
| 436 | isEnabledForUrl = response.isEnabledForUrl; |
| 437 | |
| 438 | // This browser info is used by other content scripts, but can only be determinted by the |
| 439 | // background page. |
| 440 | Utils._isFirefox = response.isFirefox; |
| 441 | Utils._firefoxVersion = response.firefoxVersion; |
| 442 | Utils._browserInfoLoaded = true; |
| 443 | // This is the first time we learn what this frame's ID is. |
| 444 | globalThis.frameId = response.frameId; |
| 445 | |
| 446 | if (normalMode == null) installModes(); |
| 447 | normalMode.setPassKeys(response.passKeys); |
| 448 | // Hide the HUD if we're not enabled. |
| 449 | if (!isEnabledForUrl) HUD.hide(true, false); |
| 450 | } |
| 451 | |
| 452 | // If this content script is running in the help dialog's iframe, then use the HelpDialogPage's |
| 453 | // methods to control the dialog. Otherwise, load the help dialog in a UIComponent iframe. |
no test coverage detected