From 4b7c7cd1e1de0f890fd4e4f97e1c8e3218c616a3 Mon Sep 17 00:00:00 2001 From: "YUKI \"Piro\" Hiroshi" Date: Tue, 23 Aug 2022 16:46:07 +0900 Subject: [PATCH] Never handle unhandlable URLs (about:, file: and etc.) --- background.js | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/background.js b/background.js index 31918a0..4a4930c 100644 --- a/background.js +++ b/background.js @@ -500,16 +500,6 @@ var ThinBridgeTalkClient = { }, isMatchedURL: function(tbconfig, url, defaultMatched) { - if (!url) { - console.log(`* Empty URL found`); - return false; - } - - if (!/^https?:/.test(url)) { - console.log(`* Ignore non-HTTP/HTTPS URL`); - return false; - } - if (tbconfig.IgnoreQueryString) { url = url.replace(/\?.*/, ''); } @@ -534,16 +524,6 @@ var ThinBridgeTalkClient = { }, isMatchedURLLegacy: function(tbconfig, url) { - if (!url) { - console.log(`* Empty URL found`); - return false; - } - - if (!/^https?:/.test(url)) { - console.log(`* Ignore non-HTTP/HTTPS URL`); - return false; - } - if (tbconfig.IgnoreQueryString) { url = url.replace(/\?.*/, ''); } @@ -568,6 +548,16 @@ var ThinBridgeTalkClient = { }, handleURLAndBlock: function({ tbconfig, tabId, url, isMainFrame, isClosableTab }) { + if (!url) { + console.log(`* Empty URL found`); + return false; + } + + if (!/^https?:/.test(url)) { + console.log(`* Ignore non-HTTP/HTTPS URL (${url})`); + return false; + } + if (tbconfig.Sections) { // full mode let loadCount = 0;