Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5831 Remove chrome.tabs.onUpdated listener in firefox #5837

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions extension/js/service_worker/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

'use strict';

import { Catch } from '../common/platform/catch.js';

export const injectFcIntoWebmail = () => {
const contentScriptGroups = chrome.runtime.getManifest().content_scripts ?? []; // we know it's in the manifest
// one time when extension installed or on browser start - go through all matching tabs and inject
Expand All @@ -14,21 +12,6 @@ export const injectFcIntoWebmail = () => {
}
});
}
// on Firefox, standard way of loading content scripts stopped working. We have to listen to tab loaded events, and inject then
// basically here we do what normally the browser is supposed to do (inject content scripts when page is done loading)
if (Catch.isFirefox()) {
chrome.tabs.onUpdated.addListener((tabId, changed, tab) => {
if (changed.status === 'complete' && tab.active && tab.url) {
for (const group of contentScriptGroups) {
for (const groupMatchUrl of group.matches || []) {
if (tab.url.startsWith(groupMatchUrl.replace(/\*$/, ''))) {
injectContentScriptIntoTabIfNeeded(tabId, group.js || []);
}
}
}
}
});
}
};

const injectContentScriptIntoTabIfNeeded = (tabId: number, files: string[]) => {
Expand Down
Loading