| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, docDomain) |
| 64 { | 64 { |
| 65 let uri = new URI(url); | 65 url = new URL(url); |
| 66 let params = [ | 66 let params = [ |
| 67 uri.path, // REQUEST_URI | 67 url.pathname + url.search, // REQUEST_URI |
| 68 uri.asciiHost + (uri.port != -1 ? ":" + uri.port : ""), // 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) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 91 let docDomain = extractHostFromURL((frame.parent || frame).url); | 91 let docDomain = extractHostFromURL((frame.parent || frame).url); |
| 92 | 92 |
| 93 if (token.indexOf("_") < 0) | 93 if (token.indexOf("_") < 0) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 let [key, signature] = token.split("_", 2); | 96 let [key, signature] = token.split("_", 2); |
| 97 key = key.replace(/=/g, ""); | 97 key = key.replace(/=/g, ""); |
| 98 if (verifyKey(key, signature, url, docDomain)) | 98 if (verifyKey(key, signature, url, docDomain)) |
| 99 recordKey(page, url, key); | 99 recordKey(page, url, key); |
| 100 }; | 100 }; |
| OLD | NEW |