MCPcopy Index your code
hub / github.com/darkreader/darkreader / updateContentScript

Method updateContentScript

src/background/tab-manager.ts:408–430  ·  view source on GitHub ↗
(options: {runOnProtectedPages: boolean})

Source from the content-addressed store, hash-verified

406 }
407
408 static async updateContentScript(options: {runOnProtectedPages: boolean}): Promise<void> {
409 (await queryTabs({discarded: false}))
410 .filter((tab) => __CHROMIUM_MV3__ || options.runOnProtectedPages || canInjectScript(tab.url))
411 .filter((tab) => !TabManager.tabs[tab.id!])
412 .forEach((tab) => {
413 if (__CHROMIUM_MV3__) {
414 chrome.scripting.executeScript({
415 target: {
416 tabId: tab.id!,
417 allFrames: true,
418 },
419 files: ['/inject/index.js'],
420 }, () => logInfo('Could not update content script in tab', tab, chrome.runtime.lastError));
421 } else {
422 chrome.tabs.executeScript(tab.id!, {
423 runAt: 'document_start',
424 file: '/inject/index.js',
425 allFrames: true,
426 matchAboutBlank: true,
427 });
428 }
429 });
430 }
431
432 static async registerMailDisplayScript(): Promise<void> {
433 await (chrome as any).messageDisplayScripts.register({

Callers 1

startMethod · 0.80

Calls 3

queryTabsFunction · 0.90
canInjectScriptFunction · 0.90
logInfoFunction · 0.90

Tested by

no test coverage detected