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

Unified Diff: lib/whitelisting.js

Issue 6292212006518784: Noissue - Added documentation for exported functions to the "whitelisting" module (Closed)
Patch Set: Fixed typo Created March 2, 2015, 5:13 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/whitelisting.js
===================================================================
--- a/lib/whitelisting.js
+++ b/lib/whitelisting.js
@@ -21,6 +21,12 @@
let pagesWithKey = new ext.PageMap();
+/**
+ * Checks whether a page is whitelisted.
+ *
+ * @param {Page} page
+ * @return {WhitelistFilter} The active filter whitelisting this page or null
+ */
function isPageWhitelisted(page)
{
let url = page.url;
@@ -33,6 +39,15 @@
}
exports.isPageWhitelisted = isPageWhitelisted;
+/**
+ * Checks whether a frame is whitelisted.
+ *
+ * @param {Page} page
+ * @param {Frame} frame
+ * @param {string} [type=DOCUMENT] The request type to check whether
+ * the frame is whitelisted for.
+ * @return {Boolean}
+ */
function isFrameWhitelisted(page, frame, type)
{
while (frame)
@@ -57,6 +72,14 @@
}
exports.isFrameWhitelisted = isFrameWhitelisted;
+/**
+ * Gets the public key, previously recorded for the given page
+ * and frame, to be considered for the $sitekey filter option.
+ *
+ * @param {Page} page
+ * @param {Frame} frame
+ * @return {string}
+ */
function getKey(page, frame)
{
let urlsWithKey = pagesWithKey.get(page);
@@ -98,6 +121,17 @@
urlsWithKey[stringifyURL(url)] = key;
}
+/**
+ * Validates signatures given by the "X-Adblock-Key" response
+ * header or the "data-adblockkey" attribute of the document
+ * element. If the signature is valid, the public key will be
+ * recorded and considered for the $sitekey filter option.
+ *
+ * @param {string} token The base64-encoded public key and
+ * signature separated by an underscrore.
+ * @param {Page} page
+ * @param {Frame} frame
+ */
function processKey(token, page, frame)
{
if (token.indexOf("_") < 0)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld