aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/background
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-04-03 13:55:54 +0300
committerManeraKai <manerakai@protonmail.com>2022-04-03 13:55:54 +0300
commit0e889c2d4285b3cf1767cb9b8a3957ec5392324d (patch)
treeaee145d37c3edbe969a5d7ef5c9fae1de535e7a6 /src/pages/background
parentFixed some branch merging issues. Bump version => 1.6.2 (diff)
downloadlibredirect-0e889c2d4285b3cf1767cb9b8a3957ec5392324d.zip
Restructured exceptions to behave in another way #164 #161
Diffstat (limited to 'src/pages/background')
-rw-r--r--src/pages/background/background.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index e54627c4..650a48a8 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -92,7 +92,12 @@ browser.webRequest.onBeforeRequest.addListener(
if (!newUrl) newUrl = wikipediaHelper.redirect(url);
- if (generalHelper.isException(url, initiator)) newUrl = null;
+ if (
+ details.frameAncestors && details.frameAncestors.length > 0 &&
+ generalHelper.isException(new URL(details.frameAncestors[0].url))
+ ) newUrl = null;
+
+ if (generalHelper.isException(url)) newUrl = null;
if (BYPASSTABs.includes(details.tabId)) newUrl = null;
@@ -103,15 +108,11 @@ browser.webRequest.onBeforeRequest.addListener(
}
else if (newUrl == 'BYPASSTAB') {
console.log(`Bybassed ${details.tabId} ${url}`);
- BYPASSTABs.push(details.tabId);
+ if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId);
return null;
}
else {
console.info("Redirecting", url.href, "=>", newUrl);
- // let wewe = new URL(newUrl);
- // console.log("wewe", wewe.search);
- // console.log("path", wewe.pathname);
- // console.log("searchParams", wewe.searchParams);
return { redirectUrl: newUrl };
}
}
@@ -206,7 +207,8 @@ browser.tabs.onUpdated.addListener(
if (instagramHelper.isBibliogram(url)) instagramHelper.initBibliogramCookies(url);
// if (changeInfo.url && youtubeHelper.isPipedorInvidious(url, 'main_frame', 'pipedMaterial')) youtubeHelper.initPipedMaterialLocalStorage(tabId);
- });
+ }
+);
function changeWholeInstance(url) {
let newUrl = youtubeHelper.switchInstance(url);