Skip to content

Commit 4b7c7cd

Browse files
committed
Never handle unhandlable URLs (about:, file: and etc.)
1 parent 3e36762 commit 4b7c7cd

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

background.js

+10-20
Original file line numberDiff line numberDiff line change
@@ -500,16 +500,6 @@ var ThinBridgeTalkClient = {
500500
},
501501

502502
isMatchedURL: function(tbconfig, url, defaultMatched) {
503-
if (!url) {
504-
console.log(`* Empty URL found`);
505-
return false;
506-
}
507-
508-
if (!/^https?:/.test(url)) {
509-
console.log(`* Ignore non-HTTP/HTTPS URL`);
510-
return false;
511-
}
512-
513503
if (tbconfig.IgnoreQueryString) {
514504
url = url.replace(/\?.*/, '');
515505
}
@@ -534,16 +524,6 @@ var ThinBridgeTalkClient = {
534524
},
535525

536526
isMatchedURLLegacy: function(tbconfig, url) {
537-
if (!url) {
538-
console.log(`* Empty URL found`);
539-
return false;
540-
}
541-
542-
if (!/^https?:/.test(url)) {
543-
console.log(`* Ignore non-HTTP/HTTPS URL`);
544-
return false;
545-
}
546-
547527
if (tbconfig.IgnoreQueryString) {
548528
url = url.replace(/\?.*/, '');
549529
}
@@ -568,6 +548,16 @@ var ThinBridgeTalkClient = {
568548
},
569549

570550
handleURLAndBlock: function({ tbconfig, tabId, url, isMainFrame, isClosableTab }) {
551+
if (!url) {
552+
console.log(`* Empty URL found`);
553+
return false;
554+
}
555+
556+
if (!/^https?:/.test(url)) {
557+
console.log(`* Ignore non-HTTP/HTTPS URL (${url})`);
558+
return false;
559+
}
560+
571561
if (tbconfig.Sections) {
572562
// full mode
573563
let loadCount = 0;

0 commit comments

Comments
 (0)