Fix directly opening a URL in new tab not triggering content script

This commit is contained in:
Râu Cao 2025-04-23 18:14:28 +04:00
parent 539d34e82a
commit 1f15f51b4a
Signed by: raucao
GPG Key ID: 37036C356E56CC51
2 changed files with 3 additions and 4 deletions

View File

@ -1,8 +1,7 @@
browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
if (changeInfo.status !== 'complete') { if (changeInfo.status !== 'complete') {
browser.pageAction.hide(tabId); browser.pageAction.hide(tabId);
await browser.storage.local.remove(`nl_tab_${sender.tab.id}`); browser.storage.local.remove(`nl_tab_${sender.tab.id}`);
return; return;
} }
}, { properties: ["status"] }); }, { properties: ["status"] });

View File

@ -23,7 +23,7 @@
{ {
"matches": [ "http://*/*", "https://*/*", "file:///*" ], "matches": [ "http://*/*", "https://*/*", "file:///*" ],
"js": ["content.js"], "js": ["content.js"],
"run_at": "document_end" "run_at": "document_start"
} }
], ],
"page_action": { "page_action": {