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

Delta Between Two Patch Sets: lib/whitelisting.js

Issue 6292212006518784: Noissue - Added documentation for exported functions to the "whitelisting" module (Closed)
Left Patch Set: Created Feb. 28, 2015, 5:25 p.m.
Right Patch Set: Fixed typo Created March 2, 2015, 5:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (!urlsWithKey) 115 if (!urlsWithKey)
116 { 116 {
117 urlsWithKey = Object.create(null); 117 urlsWithKey = Object.create(null);
118 pagesWithKey.set(page, urlsWithKey); 118 pagesWithKey.set(page, urlsWithKey);
119 } 119 }
120 120
121 urlsWithKey[stringifyURL(url)] = key; 121 urlsWithKey[stringifyURL(url)] = key;
122 } 122 }
123 123
124 /** 124 /**
125 * Validates signatures given by the "X-Adblock-Key" request 125 * Validates signatures given by the "X-Adblock-Key" response
126 * header or the "data-adblockkey" attribute of the document 126 * header or the "data-adblockkey" attribute of the document
127 * element. If the signature is valid, the public key will be 127 * element. If the signature is valid, the public key will be
128 * recorded and considered for the $sitekey filter option. 128 * recorded and considered for the $sitekey filter option.
129 * 129 *
130 * @param {string} token The base64-encoded public key and 130 * @param {string} token The base64-encoded public key and
131 * signature separated by an underscrore. 131 * signature separated by an underscrore.
132 * @param {Page} page 132 * @param {Page} page
133 * @param {Frame} frame 133 * @param {Frame} frame
134 */ 134 */
135 function processKey(token, page, frame) 135 function processKey(token, page, frame)
136 { 136 {
137 if (token.indexOf("_") < 0) 137 if (token.indexOf("_") < 0)
138 return; 138 return;
139 139
140 let [key, signature] = token.split("_", 2); 140 let [key, signature] = token.split("_", 2);
141 key = key.replace(/=/g, ""); 141 key = key.replace(/=/g, "");
142 142
143 if (verifyKey(key, signature, frame.url)) 143 if (verifyKey(key, signature, frame.url))
144 recordKey(page, frame.url, key); 144 recordKey(page, frame.url, key);
145 } 145 }
146 exports.processKey = processKey; 146 exports.processKey = processKey;
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld