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

Unified Diff: lib/csp.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
« no previous file with comments | « .eslintignore ('k') | lib/filterComposer.js » ('j') | lib/options.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/csp.js
===================================================================
--- a/lib/csp.js
+++ b/lib/csp.js
@@ -20,8 +20,7 @@
const {defaultMatcher} = require("../adblockpluscore/lib/matcher");
const {RegExpFilter, WhitelistFilter} =
require("../adblockpluscore/lib/filterClasses");
-const {extractHostFromFrame, getDecodedHostname,
- isThirdParty, stringifyURL} = require("./url");
+const {extractHostFromFrame, isThirdParty} = require("./url");
const {checkWhitelisted} = require("./whitelisting");
const {FilterNotifier} = require("filterNotifier");
const devtools = require("./devtools");
@@ -31,12 +30,11 @@
browser.webRequest.onHeadersReceived.addListener(details =>
{
let url = new URL(details.url);
- let urlString = stringifyURL(url);
let parentFrame = ext.getFrame(details.tabId, details.parentFrameId);
- let hostname = extractHostFromFrame(parentFrame) || getDecodedHostname(url);
+ let hostname = extractHostFromFrame(parentFrame) || url.hostname;
let thirdParty = isThirdParty(url, hostname);
- let cspMatch = defaultMatcher.matchesAny(urlString, typeMap.CSP, hostname,
+ let cspMatch = defaultMatcher.matchesAny(details.url, typeMap.CSP, hostname,
Manish Jethani 2018/05/06 18:37:13 For a URL like https://user:pass@example.com:8080/
Sebastian Noack 2018/05/06 18:47:40 IIRC, the webRequest API is agnostic of any hash g
Manish Jethani 2018/05/07 17:03:45 At least on Chrome 67 (Canary), if you have a docu
Sebastian Noack 2018/05/08 06:51:30 That is interesting.
Manish Jethani 2018/05/08 12:23:31 Acknowledged.
thirdParty, null, false);
if (cspMatch)
{
@@ -54,13 +52,13 @@
typeMap.GENERICBLOCK);
if (specificOnly)
{
- cspMatch = defaultMatcher.matchesAny(urlString, typeMap.CSP, hostname,
+ cspMatch = defaultMatcher.matchesAny(details.url, typeMap.CSP, hostname,
thirdParty, null, specificOnly);
if (!cspMatch)
return;
}
- devtools.logRequest([details.tabId], urlString, "CSP", hostname,
+ devtools.logRequest([details.tabId], details.url, "CSP", hostname,
thirdParty, null, specificOnly, cspMatch);
FilterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]);
« no previous file with comments | « .eslintignore ('k') | lib/filterComposer.js » ('j') | lib/options.js » ('J')

Powered by Google App Engine
This is Rietveld