mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-05-02 00:54:26 +02:00
Avoid injecting script to unrelated sites (#665)
* Avoid injecting script to unrelated sites * unnecessary comment
This commit is contained in:
parent
ad1afe9b63
commit
e33f019c1f
@ -348,6 +348,9 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
||||
}
|
||||
|
||||
if (tabId !== -1) {
|
||||
extensionApi.tabs.get(tabId, function (currentTab) {
|
||||
// Validate url of current tab to avoid injecting script to unrelated sites
|
||||
if (currentTab && isSiteEnabled(currentTab)) {
|
||||
// run contentScript inside tab
|
||||
extensionApi.tabs.executeScript(tabId, {
|
||||
file: 'src/js/contentScript.js',
|
||||
@ -358,6 +361,8 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return { requestHeaders: requestHeaders };
|
||||
}, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user