LEFT | RIGHT |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 }; | 71 }; |
72 | 72 |
73 /** | 73 /** |
74 * Gets the public key, previously recorded for the given page | 74 * Gets the public key, previously recorded for the given page |
75 * and frame, to be considered for the $sitekey filter option. | 75 * and frame, to be considered for the $sitekey filter option. |
76 * | 76 * |
77 * @param {Page} page | 77 * @param {Page} page |
78 * @param {Frame} frame | 78 * @param {Frame} frame |
79 * @return {string} | 79 * @return {string} |
80 */ | 80 */ |
81 exports.getKey(page, frame) | 81 exports.getKey = function(page, frame) |
82 { | 82 { |
83 let urlsWithKey = pagesWithKey.get(page); | 83 let urlsWithKey = pagesWithKey.get(page); |
84 if (!urlsWithKey) | 84 if (!urlsWithKey) |
85 return null; | 85 return null; |
86 | 86 |
87 for (; frame != null; frame = frame.parent) | 87 for (; frame != null; frame = frame.parent) |
88 { | 88 { |
89 let key = urlsWithKey[stringifyURL(frame.url)]; | 89 let key = urlsWithKey[stringifyURL(frame.url)]; |
90 if (key) | 90 if (key) |
91 return key; | 91 return key; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 { | 133 { |
134 if (token.indexOf("_") < 0) | 134 if (token.indexOf("_") < 0) |
135 return; | 135 return; |
136 | 136 |
137 let [key, signature] = token.split("_", 2); | 137 let [key, signature] = token.split("_", 2); |
138 key = key.replace(/=/g, ""); | 138 key = key.replace(/=/g, ""); |
139 | 139 |
140 if (verifyKey(key, signature, frame.url)) | 140 if (verifyKey(key, signature, frame.url)) |
141 recordKey(page, frame.url, key); | 141 recordKey(page, frame.url, key); |
142 }; | 142 }; |
LEFT | RIGHT |