| LEFT | RIGHT |
| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 responseID, | 270 responseID, |
| 271 size | 271 size |
| 272 }); | 272 }); |
| 273 } | 273 } |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 /** | 276 /** |
| 277 * Attaches request data to a DOM node. | 277 * Attaches request data to a DOM node. |
| 278 * @param {Node} node node to attach data to | 278 * @param {Node} node node to attach data to |
| 279 * @param {Window} topWnd top-level window the node belongs to | 279 * @param {Window} topWnd top-level window the node belongs to |
| 280 * @param {String} contentType request type, e.g. "IMAGE" | 280 * @param {Object} hitData |
| 281 * @param {String} docDomain domain of the document that initiated the request | 281 * @param {String} hitData.contentType request type, e.g. "IMAGE" |
| 282 * @param {Boolean} thirdParty will be true if a third-party server has been re
quested | 282 * @param {String} hitData.docDomain domain of the document that initiated the
request |
| 283 * @param {String} location the address that has been requested | 283 * @param {Boolean} hitData.thirdParty will be true if a third-party server has
been requested |
| 284 * @param {Filter} filter filter applied to the request or null if none | 284 * @param {String} hitData.location the address that has been requested |
| 285 */ | 285 * @param {String} hitData.filter filter applied to the request or null if non
e |
| 286 RequestNotifier.addNodeData = function(node, topWnd, contentType, docDomain, thi
rdParty, location, filter) | 286 * @param {String} hitData.filterType type of filter applied to the request |
| 287 */ |
| 288 RequestNotifier.addNodeData = function(node, topWnd, {contentType, docDomain, th
irdParty, location, filter, filterType}) |
| 287 { | 289 { |
| 288 let entry = { | 290 let entry = { |
| 289 id: ++requestEntryMaxId, | 291 id: ++requestEntryMaxId, |
| 290 type: contentType, | 292 type: contentType, |
| 291 docDomain, thirdParty, location, filter | 293 docDomain, thirdParty, location, filter |
| 292 }; | 294 }; |
| 293 | 295 |
| 294 let existingData = nodeData.get(node); | 296 let existingData = nodeData.get(node); |
| 295 if (typeof existingData == "undefined") | 297 if (typeof existingData == "undefined") |
| 296 { | 298 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 307 windowStats.set(topWnd.document, { | 309 windowStats.set(topWnd.document, { |
| 308 items: 0, | 310 items: 0, |
| 309 hidden: 0, | 311 hidden: 0, |
| 310 blocked: 0, | 312 blocked: 0, |
| 311 whitelisted: 0, | 313 whitelisted: 0, |
| 312 filters: {} | 314 filters: {} |
| 313 }); | 315 }); |
| 314 } | 316 } |
| 315 | 317 |
| 316 let stats = windowStats.get(topWnd.document); | 318 let stats = windowStats.get(topWnd.document); |
| 317 let filterType = (filter ? filter.type : null); | |
| 318 if (filterType != "elemhide" && filterType != "elemhideexception" && filterTyp
e != "cssproperty") | 319 if (filterType != "elemhide" && filterType != "elemhideexception" && filterTyp
e != "cssproperty") |
| 319 stats.items++; | 320 stats.items++; |
| 320 if (filter) | 321 if (filter) |
| 321 { | 322 { |
| 322 if (filterType == "blocking") | 323 if (filterType == "blocking") |
| 323 stats.blocked++; | 324 stats.blocked++; |
| 324 else if (filterType == "whitelist" || filterType == "elemhideexception") | 325 else if (filterType == "whitelist" || filterType == "elemhideexception") |
| 325 stats.whitelisted++; | 326 stats.whitelisted++; |
| 326 else if (filterType == "elemhide" || filterType == "cssproperty") | 327 else if (filterType == "elemhide" || filterType == "cssproperty") |
| 327 stats.hidden++; | 328 stats.hidden++; |
| 328 | 329 |
| 329 if (filter.text in stats.filters) | 330 if (filter in stats.filters) |
| 330 stats.filters[filter.text]++; | 331 stats.filters[filter]++; |
| 331 else | 332 else |
| 332 stats.filters[filter.text] = 1; | 333 stats.filters[filter] = 1; |
| 333 } | 334 } |
| 334 | 335 |
| 335 // Notify listeners | 336 // Notify listeners |
| 336 for (let notifier of notifiers.values()) | 337 for (let notifier of notifiers.values()) |
| 337 if (!notifier.window || notifier.window == topWnd) | 338 if (!notifier.window || notifier.window == topWnd) |
| 338 notifier.notifyListener(node, entry); | 339 notifier.notifyListener(node, entry); |
| 339 } | 340 } |
| LEFT | RIGHT |