Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/whitelisting.js

Issue 29772555: Issue 6647 - Stop converting domains from punycode to unicode (Closed)
Patch Set: Created May 6, 2018, 2:42 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/options.js ('K') | « lib/url.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/whitelisting.js
===================================================================
--- a/lib/whitelisting.js
+++ b/lib/whitelisting.js
@@ -23,8 +23,7 @@
const {Filter, RegExpFilter} = require("../adblockpluscore/lib/filterClasses");
const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier");
const {FilterStorage} = require("../adblockpluscore/lib/filterStorage");
-const {stringifyURL, getDecodedHostname,
- extractHostFromFrame, isThirdParty} = require("./url");
+const {extractHostFromFrame, isThirdParty} = require("./url");
const {port} = require("./messaging");
const {logWhitelistedDocument} = require("./devtools");
const {verifySignature} = require("../adblockpluscore/lib/rsa");
@@ -34,17 +33,16 @@
function match(page, url, typeMask, docDomain, sitekey)
{
let thirdParty = !!docDomain && isThirdParty(url, docDomain);
- let urlString = stringifyURL(url);
if (!docDomain)
- docDomain = getDecodedHostname(url);
+ docDomain = url.hostname;
let filter = defaultMatcher.whitelist.matchesAny(
- urlString, typeMask, docDomain, thirdParty, sitekey
+ url.href, typeMask, docDomain, thirdParty, sitekey
);
if (filter && page)
- logWhitelistedDocument(page.id, urlString, typeMask, docDomain, filter);
+ logWhitelistedDocument(page.id, url.href, typeMask, docDomain, filter);
return filter;
}
@@ -93,7 +91,7 @@
port.on("filters.whitelist", message =>
{
let page = new ext.Page(message.tab);
- let host = getDecodedHostname(page.url).replace(/^www\./, "");
+ let host = page.url.hostname.replace(/^www\./, "");
let filter = Filter.fromText("@@||" + host + "^$document");
if (filter.subscriptions.length && filter.disabled)
{
@@ -158,7 +156,7 @@
{
for (; frame; frame = frame.parent)
{
- let key = keys.get(stringifyURL(frame.url));
+ let key = keys.get(frame.url.href);
if (key)
return key;
}
@@ -169,7 +167,7 @@
{
for (let keys of sitekeys._map.values())
{
- let key = keys.get(stringifyURL(originUrl));
+ let key = keys.get(originUrl.href);
if (key)
return key;
}
@@ -203,7 +201,7 @@
keys = new Map();
sitekeys.set(page, keys);
}
- keys.set(stringifyURL(url), key);
+ keys.set(url.href, key);
}
port.on("filters.addKey", (message, sender) =>
« lib/options.js ('K') | « lib/url.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld