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

Unified Diff: messageResponder.js

Issue 29727613: Issue 6386 - Add Requests and Filters data to the Report data
Patch Set: Created April 6, 2018, 5:01 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 | « locale/en_US/issue-reporter.json ('k') | skin/issue-reporter.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -25,16 +25,17 @@
const {Prefs} = require("prefs");
const {Utils} = require("utils");
const {FilterStorage} = require("filterStorage");
const {FilterNotifier} = require("filterNotifier");
const {defaultMatcher} = require("matcher");
const {Notification: NotificationStorage} = require("notification");
const {getActiveNotification, shouldDisplay,
notificationClicked} = require("notificationHelper");
+ const {HitLogger} = require("hitLogger");
const {
Filter, ActiveFilter, BlockingFilter, RegExpFilter
} = require("filterClasses");
const {Synchronizer} = require("synchronizer");
const info = require("info");
const {
@@ -196,16 +197,50 @@
}
if (message.what == "senderId")
return sender.page.id;
return info[message.what];
});
+ port.on("app.collectHits", (message, sender) =>
+ {
+ const logRequest = (log) =>
+ {
+ let {filter, request} = log;
+ let subscriptions = [];
+ if (filter)
+ {
+ for (const soubscription of FilterStorage.subscriptions)
+ {
+ for (const text of soubscription.filters)
+ {
+ if (text == filter.text)
+ subscriptions.push(soubscription.url);
+ }
+ }
+ filter = convertObject(["text", "subscription"], filter);
+ }
+ request = convertObject(["url", "type", "docDomain", "thirdParty"],
+ request);
+ sendMessage("app", "devLog", request, filter, subscriptions);
+ };
+ const removeTabListeners = (tabId) =>
+ {
+ if (tabId == message.tab.id || tabId == sender.page.id)
+ {
+ HitLogger.off(message.tab.id, logRequest);
+ browser.tabs.onRemoved.removeListener(removeTabListeners);
+ }
+ };
+ HitLogger.on(message.tab.id, logRequest);
+ browser.tabs.onRemoved.addListener(removeTabListeners);
+ });
+
port.on("app.open", (message, sender) =>
{
if (message.what == "options")
{
showOptions(() =>
{
if (!message.action)
return;
« no previous file with comments | « locale/en_US/issue-reporter.json ('k') | skin/issue-reporter.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld