1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

Minor code review of subscriber scriptlet

This commit is contained in:
Raymond Hill 2020-09-21 07:25:24 -04:00
parent 1cdffea618
commit 99f605d28a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -55,11 +55,12 @@ const onMaybeSubscriptionLinkClicked = function(ev) {
return;
}
const subscribeURL = new URL('about:blank');
try {
// https://github.com/uBlockOrigin/uBlock-issues/issues/763#issuecomment-691696716
// Remove replacement patch if/when filterlists.com fixes encoded '&'.
subscribeURL.href = target.href.replace('&title=', '&title=');
const subscribeURL = new URL(
target.href.replace('&title=', '&title=')
);
if (
/^(abp|ubo):$/.test(subscribeURL.protocol) === false &&
subscribeURL.hostname !== 'subscribe.adblockplus.org'
@ -71,8 +72,8 @@ const onMaybeSubscriptionLinkClicked = function(ev) {
if ( location === '' || title === '' ) { return; }
vAPI.messaging.send('scriptlets', {
what: 'subscribeTo',
location: decodeURIComponent(location),
title: decodeURIComponent(title),
location,
title,
});
ev.stopPropagation();
ev.preventDefault();