mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 08:17:49 +01:00
Limit contentScript on external content
This commit is contained in:
parent
9fff9956fe
commit
24e62269ba
1 changed files with 12 additions and 8 deletions
|
@ -477,13 +477,17 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tabId !== -1) {
|
if (tabId !== -1) {
|
||||||
// run contentScript inside tab
|
ext_api.tabs.get(tabId, function (currentTab) {
|
||||||
ext_api.tabs.executeScript(tabId, {
|
if (isSiteEnabled(currentTab)) {
|
||||||
file: 'contentScript.js',
|
// run contentScript inside tab
|
||||||
runAt: 'document_start'
|
ext_api.tabs.executeScript(tabId, {
|
||||||
}, function(res) {
|
file: 'contentScript.js',
|
||||||
if (ext_api.runtime.lastError || res[0]) {
|
runAt: 'document_start'
|
||||||
return;
|
}, function(res) {
|
||||||
|
if (ext_api.runtime.lastError || res[0]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -556,7 +560,7 @@ function matchDomain(domains, hostname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function urlHost(url) {
|
function urlHost(url) {
|
||||||
if (url.startsWith('http')) {
|
if (url && url.startsWith('http')) {
|
||||||
try {
|
try {
|
||||||
return new URL(url).hostname;
|
return new URL(url).hostname;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue