OLD | NEW |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 return verifySignature(key, signature, params.join("\0")); | 75 return verifySignature(key, signature, params.join("\0")); |
76 } | 76 } |
77 | 77 |
78 function recordKey(page, url, key) | 78 function recordKey(page, url, key) |
79 { | 79 { |
80 let urlsWithKey = pagesWithKey.get(page); | 80 let urlsWithKey = pagesWithKey.get(page); |
81 | 81 |
82 if (!urlsWithKey) | 82 if (!urlsWithKey) |
83 { | 83 { |
84 urlsWithKey = {__proto__: null}; | 84 urlsWithKey = Object.create(null); |
85 pagesWithKey.set(page, urlsWithKey); | 85 pagesWithKey.set(page, urlsWithKey); |
86 } | 86 } |
87 | 87 |
88 urlsWithKey[url] = key; | 88 urlsWithKey[url] = key; |
89 } | 89 } |
90 | 90 |
91 function processKey(token, page, frame) | 91 function processKey(token, page, frame) |
92 { | 92 { |
93 let url = stripFragmentFromURL(frame.url); | 93 let url = stripFragmentFromURL(frame.url); |
94 | 94 |
95 if (token.indexOf("_") < 0) | 95 if (token.indexOf("_") < 0) |
96 return; | 96 return; |
97 | 97 |
98 let [key, signature] = token.split("_", 2); | 98 let [key, signature] = token.split("_", 2); |
99 key = key.replace(/=/g, ""); | 99 key = key.replace(/=/g, ""); |
100 | 100 |
101 if (verifyKey(key, signature, url)) | 101 if (verifyKey(key, signature, url)) |
102 recordKey(page, url, key); | 102 recordKey(page, url, key); |
103 } | 103 } |
104 exports.processKey = processKey; | 104 exports.processKey = processKey; |
OLD | NEW |