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

Unified Diff: lib/child/requestNotifier.js

Issue 29329810: Issue 3274 - Unbreak collecting window stats (Closed)
Patch Set: Rebased and improved JSDoc comments Created Nov. 12, 2015, 3:08 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 | « lib/child/contentPolicy.js ('k') | lib/contentPolicy.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/child/requestNotifier.js
===================================================================
--- a/lib/child/requestNotifier.js
+++ b/lib/child/requestNotifier.js
@@ -272,23 +272,25 @@ RequestNotifier.prototype =
});
}
};
/**
* Attaches request data to a DOM node.
* @param {Node} node node to attach data to
* @param {Window} topWnd top-level window the node belongs to
- * @param {String} contentType request type, e.g. "IMAGE"
- * @param {String} docDomain domain of the document that initiated the request
- * @param {Boolean} thirdParty will be true if a third-party server has been requested
- * @param {String} location the address that has been requested
- * @param {Filter} filter filter applied to the request or null if none
+ * @param {Object} hitData
+ * @param {String} hitData.contentType request type, e.g. "IMAGE"
+ * @param {String} hitData.docDomain domain of the document that initiated the request
+ * @param {Boolean} hitData.thirdParty will be true if a third-party server has been requested
+ * @param {String} hitData.location the address that has been requested
+ * @param {String} hitData.filter filter applied to the request or null if none
+ * @param {String} hitData.filterType type of filter applied to the request
*/
-RequestNotifier.addNodeData = function(node, topWnd, contentType, docDomain, thirdParty, location, filter)
+RequestNotifier.addNodeData = function(node, topWnd, {contentType, docDomain, thirdParty, location, filter, filterType})
{
let entry = {
id: ++requestEntryMaxId,
type: contentType,
docDomain, thirdParty, location, filter
};
let existingData = nodeData.get(node);
@@ -309,31 +311,30 @@ RequestNotifier.addNodeData = function(n
hidden: 0,
blocked: 0,
whitelisted: 0,
filters: {}
});
}
let stats = windowStats.get(topWnd.document);
- let filterType = (filter ? filter.type : null);
if (filterType != "elemhide" && filterType != "elemhideexception" && filterType != "cssproperty")
stats.items++;
if (filter)
{
if (filterType == "blocking")
stats.blocked++;
else if (filterType == "whitelist" || filterType == "elemhideexception")
stats.whitelisted++;
else if (filterType == "elemhide" || filterType == "cssproperty")
stats.hidden++;
- if (filter.text in stats.filters)
- stats.filters[filter.text]++;
+ if (filter in stats.filters)
+ stats.filters[filter]++;
else
- stats.filters[filter.text] = 1;
+ stats.filters[filter] = 1;
}
// Notify listeners
for (let notifier of notifiers.values())
if (!notifier.window || notifier.window == topWnd)
notifier.notifyListener(node, entry);
}
« no previous file with comments | « lib/child/contentPolicy.js ('k') | lib/contentPolicy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld