Skip to content

Commit

Permalink
Never handle unhandlable URLs (about:, file: and etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 23, 2022
1 parent 3e36762 commit 4b7c7cd
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/\?.*/, '');
}
Expand All @@ -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(/\?.*/, '');
}
Expand All @@ -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;
Expand Down

0 comments on commit 4b7c7cd

Please sign in to comment.