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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « locale/en_US/issue-reporter.json ('k') | skin/issue-reporter.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 12 matching lines...) Expand all
23 { 23 {
24 const {port} = require("messaging"); 24 const {port} = require("messaging");
25 const {Prefs} = require("prefs"); 25 const {Prefs} = require("prefs");
26 const {Utils} = require("utils"); 26 const {Utils} = require("utils");
27 const {FilterStorage} = require("filterStorage"); 27 const {FilterStorage} = require("filterStorage");
28 const {FilterNotifier} = require("filterNotifier"); 28 const {FilterNotifier} = require("filterNotifier");
29 const {defaultMatcher} = require("matcher"); 29 const {defaultMatcher} = require("matcher");
30 const {Notification: NotificationStorage} = require("notification"); 30 const {Notification: NotificationStorage} = require("notification");
31 const {getActiveNotification, shouldDisplay, 31 const {getActiveNotification, shouldDisplay,
32 notificationClicked} = require("notificationHelper"); 32 notificationClicked} = require("notificationHelper");
33 const {HitLogger} = require("hitLogger");
33 34
34 const { 35 const {
35 Filter, ActiveFilter, BlockingFilter, RegExpFilter 36 Filter, ActiveFilter, BlockingFilter, RegExpFilter
36 } = require("filterClasses"); 37 } = require("filterClasses");
37 const {Synchronizer} = require("synchronizer"); 38 const {Synchronizer} = require("synchronizer");
38 39
39 const info = require("info"); 40 const info = require("info");
40 const { 41 const {
41 Subscription, 42 Subscription,
42 DownloadableSubscription, 43 DownloadableSubscription,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 parseInt(info.applicationVersion, 10) >= 54 195 parseInt(info.applicationVersion, 10) >= 54
195 }; 196 };
196 } 197 }
197 198
198 if (message.what == "senderId") 199 if (message.what == "senderId")
199 return sender.page.id; 200 return sender.page.id;
200 201
201 return info[message.what]; 202 return info[message.what];
202 }); 203 });
203 204
205 port.on("app.collectHits", (message, sender) =>
206 {
207 const logRequest = (log) =>
208 {
209 let {filter, request} = log;
210 let subscriptions = [];
211 if (filter)
212 {
213 for (const soubscription of FilterStorage.subscriptions)
214 {
215 for (const text of soubscription.filters)
216 {
217 if (text == filter.text)
218 subscriptions.push(soubscription.url);
219 }
220 }
221 filter = convertObject(["text", "subscription"], filter);
222 }
223 request = convertObject(["url", "type", "docDomain", "thirdParty"],
224 request);
225 sendMessage("app", "devLog", request, filter, subscriptions);
226 };
227 const removeTabListeners = (tabId) =>
228 {
229 if (tabId == message.tab.id || tabId == sender.page.id)
230 {
231 HitLogger.off(message.tab.id, logRequest);
232 browser.tabs.onRemoved.removeListener(removeTabListeners);
233 }
234 };
235 HitLogger.on(message.tab.id, logRequest);
236 browser.tabs.onRemoved.addListener(removeTabListeners);
237 });
238
204 port.on("app.open", (message, sender) => 239 port.on("app.open", (message, sender) =>
205 { 240 {
206 if (message.what == "options") 241 if (message.what == "options")
207 { 242 {
208 showOptions(() => 243 showOptions(() =>
209 { 244 {
210 if (!message.action) 245 if (!message.action)
211 return; 246 return;
212 247
213 sendMessage("app", message.action, ...message.args); 248 sendMessage("app", message.action, ...message.args);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // "*.listen" messages to tackle #6440 511 // "*.listen" messages to tackle #6440
477 if (action == "listen") 512 if (action == "listen")
478 { 513 {
479 listen(type, filters, message.filter); 514 listen(type, filters, message.filter);
480 } 515 }
481 }); 516 });
482 } 517 }
483 518
484 browser.runtime.onConnect.addListener(onConnect); 519 browser.runtime.onConnect.addListener(onConnect);
485 })(this); 520 })(this);
OLDNEW
« 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