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

Side by Side Diff: lib/whitelisting.js

Issue 5006868082589696: Noissue - Removed unused docDomain argument of verifyKey() (Closed)
Patch Set: Created Jan. 21, 2015, 7:57 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 for (; frame != null; frame = frame.parent) 54 for (; frame != null; frame = frame.parent)
55 { 55 {
56 if (urlsWithKey[frame.url]) 56 if (urlsWithKey[frame.url])
57 return urlsWithKey[frame.url]; 57 return urlsWithKey[frame.url];
58 } 58 }
59 59
60 return null; 60 return null;
61 } 61 }
62 62
63 let verifyKey = function(key, signature, url, docDomain) 63 let verifyKey = function(key, signature, url)
64 { 64 {
65 url = new URL(url); 65 url = new URL(url);
66 let params = [ 66 let params = [
67 url.pathname + url.search, // REQUEST_URI 67 url.pathname + url.search, // REQUEST_URI
68 url.host, // HTTP_HOST 68 url.host, // HTTP_HOST
69 window.navigator.userAgent // HTTP_USER_AGENT 69 window.navigator.userAgent // HTTP_USER_AGENT
70 ]; 70 ];
71 71
72 return verifySignature(key, signature, params.join("\0")); 72 return verifySignature(key, signature, params.join("\0"));
73 }; 73 };
74 74
75 let recordKey = function(page, url, key) 75 let recordKey = function(page, url, key)
76 { 76 {
77 let urlsWithKey = pagesWithKey.get(page); 77 let urlsWithKey = pagesWithKey.get(page);
78 78
79 if (!urlsWithKey) 79 if (!urlsWithKey)
80 { 80 {
81 urlsWithKey = {__proto__: null}; 81 urlsWithKey = {__proto__: null};
82 pagesWithKey.set(page, urlsWithKey); 82 pagesWithKey.set(page, urlsWithKey);
83 } 83 }
84 84
85 urlsWithKey[url] = key; 85 urlsWithKey[url] = key;
86 }; 86 };
87 87
88 let processKey = exports.processKey = function(token, page, frame) 88 let processKey = exports.processKey = function(token, page, frame)
89 { 89 {
90 let url = stripFragmentFromURL(frame.url); 90 let url = stripFragmentFromURL(frame.url);
91 let docDomain = extractHostFromURL((frame.parent || frame).url);
92 91
93 if (token.indexOf("_") < 0) 92 if (token.indexOf("_") < 0)
94 return; 93 return;
95 94
96 let [key, signature] = token.split("_", 2); 95 let [key, signature] = token.split("_", 2);
97 key = key.replace(/=/g, ""); 96 key = key.replace(/=/g, "");
98 if (verifyKey(key, signature, url, docDomain)) 97
98 if (verifyKey(key, signature, url))
99 recordKey(page, url, key); 99 recordKey(page, url, key);
100 }; 100 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld