MCPcopy
hub / github.com/philc/vimium / checkIfEnabledForUrl

Function checkIfEnabledForUrl

content_scripts/vimium_frontend.js:428–450  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

426
427// Check if Vimium should be enabled or not based on the top frame's URL.
428async 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.

Callers 2

vimium_frontend.jsFile · 0.85
initializePreDomReadyFunction · 0.85

Calls 4

installModesFunction · 0.85
setPassKeysMethod · 0.80
pushMethod · 0.45
hideMethod · 0.45

Tested by

no test coverage detected