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

Unified Diff: lib/whitelisting.js

Issue 29338491: Issue 3823 - Split up message responder code (Closed)
Patch Set: Implement getPort() Created March 21, 2016, 3:25 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
Index: lib/whitelisting.js
===================================================================
--- a/lib/whitelisting.js
+++ b/lib/whitelisting.js
@@ -22,6 +22,7 @@
let {defaultMatcher} = require("matcher");
let {RegExpFilter} = require("filterClasses");
let {stringifyURL, getDecodedHostname, extractHostFromFrame, isThirdParty} = require("url");
+let {port} = require("messaging");
let devtools = require("devtools");
let pagesWithKey = new ext.PageMap();
@@ -129,6 +130,7 @@
urlsWithKey[stringifyURL(url)] = key;
}
+let processKey =
/**
* Validates signatures given by the "X-Adblock-Key" response
* header or the "data-adblockkey" attribute of the document
@@ -151,3 +153,8 @@
if (verifyKey(key, signature, frame.url))
recordKey(page, frame.url, key);
};
+
+port.on("filters.addKey", (message, sender) =>
+{
+ processKey(message.token, sender.page, sender.frame);
+});

Powered by Google App Engine
This is Rietveld