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

Side by Side Diff: chrome/content/ui/sendReport.js

Issue 29329479: Issue 3222 - Get rid of RequestEntry.typeDescr property (Closed)
Patch Set: Created Oct. 29, 2015, 1:57 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 | « chrome/content/ui/composer.js ('k') | chrome/content/ui/sidebar.js » ('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-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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 collectData: function(wnd, windowURI, callback) 194 collectData: function(wnd, windowURI, callback)
195 { 195 {
196 this.callback = callback; 196 this.callback = callback;
197 this.requestNotifier = new RequestNotifier(wnd, this.onRequestFound, this); 197 this.requestNotifier = new RequestNotifier(wnd, this.onRequestFound, this);
198 }, 198 },
199 199
200 onRequestFound: function(frame, node, entry, scanComplete) 200 onRequestFound: function(frame, node, entry, scanComplete)
201 { 201 {
202 if (entry) 202 if (entry)
203 { 203 {
204 let key = entry.location + " " + entry.typeDescr + " " + entry.docDomain; 204 let key = entry.location + " " + entry.type + " " + entry.docDomain;
205 let requestXML; 205 let requestXML;
206 if (key in this.nodeByKey) 206 if (key in this.nodeByKey)
207 { 207 {
208 requestXML = this.nodeByKey[key]; 208 requestXML = this.nodeByKey[key];
209 requestXML.setAttribute("count", parseInt(requestXML.getAttribute("count "), 10) + 1); 209 requestXML.setAttribute("count", parseInt(requestXML.getAttribute("count "), 10) + 1);
210 } 210 }
211 else 211 else
212 { 212 {
213 requestXML = this.nodeByKey[key] = appendElement(this.requests, "request ", { 213 requestXML = this.nodeByKey[key] = appendElement(this.requests, "request ", {
214 location: censorURL(entry.location), 214 location: censorURL(entry.location),
215 type: entry.typeDescr, 215 type: entry.type,
216 docDomain: entry.docDomain, 216 docDomain: entry.docDomain,
217 thirdParty: entry.thirdParty, 217 thirdParty: entry.thirdParty,
218 count: 1 218 count: 1
219 }); 219 });
220 } 220 }
221 221
222 // Location is meaningless for element hiding hits 222 // Location is meaningless for element hiding hits
223 if (entry.filter && entry.filter instanceof ElemHideBase) 223 if (entry.filter && entry.filter instanceof ElemHideBase)
224 requestXML.removeAttribute("location"); 224 requestXML.removeAttribute("location");
225 225
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 if (filter instanceof BlockingFilter && filter.disabled) 920 if (filter instanceof BlockingFilter && filter.disabled)
921 disabledMatcher.add(filter); 921 disabledMatcher.add(filter);
922 } 922 }
923 923
924 let seenFilters = Object.create(null); 924 let seenFilters = Object.create(null);
925 for (let request of requestsDataSource.origRequests) 925 for (let request of requestsDataSource.origRequests)
926 { 926 {
927 if (request.filter) 927 if (request.filter)
928 continue; 928 continue;
929 929
930 let filter = disabledMatcher.matchesAny(request.location, RegExpFilter.t ypeMap[request.typeDescr], request.docDomain, request.thirdParty); 930 let filter = disabledMatcher.matchesAny(request.location, RegExpFilter.t ypeMap[request.type], request.docDomain, request.thirdParty);
931 if (filter && !(filter.text in seenFilters)) 931 if (filter && !(filter.text in seenFilters))
932 { 932 {
933 this.disabledFilters.push(filter); 933 this.disabledFilters.push(filter);
934 seenFilters[filter.text] = true; 934 seenFilters[filter.text] = true;
935 } 935 }
936 } 936 }
937 937
938 // Find disabled subscriptions with filters matching any of the requests 938 // Find disabled subscriptions with filters matching any of the requests
939 let seenSubscriptions = Object.create(null); 939 let seenSubscriptions = Object.create(null);
940 for (let subscription of FilterStorage.subscriptions) 940 for (let subscription of FilterStorage.subscriptions)
941 { 941 {
942 if (!subscription.disabled) 942 if (!subscription.disabled)
943 continue; 943 continue;
944 944
945 disabledMatcher.clear(); 945 disabledMatcher.clear();
946 for (let filter of subscription.filters) 946 for (let filter of subscription.filters)
947 if (filter instanceof BlockingFilter) 947 if (filter instanceof BlockingFilter)
948 disabledMatcher.add(filter); 948 disabledMatcher.add(filter);
949 949
950 for (let request of requestsDataSource.origRequests) 950 for (let request of requestsDataSource.origRequests)
951 { 951 {
952 if (request.filter) 952 if (request.filter)
953 continue; 953 continue;
954 954
955 let filter = disabledMatcher.matchesAny(request.location, RegExpFilter .typeMap[request.typeDescr], request.docDomain, request.thirdParty); 955 let filter = disabledMatcher.matchesAny(request.location, RegExpFilter .typeMap[request.type], request.docDomain, request.thirdParty);
956 if (filter && !(subscription.url in seenSubscriptions)) 956 if (filter && !(subscription.url in seenSubscriptions))
957 { 957 {
958 this.disabledSubscriptions.push(subscription); 958 this.disabledSubscriptions.push(subscription);
959 seenSubscriptions[subscription.text] = true; 959 seenSubscriptions[subscription.text] = true;
960 break; 960 break;
961 } 961 }
962 } 962 }
963 } 963 }
964 964
965 this.numSubscriptions = FilterStorage.subscriptions.filter(this.subscripti onFilter).length; 965 this.numSubscriptions = FilterStorage.subscriptions.filter(this.subscripti onFilter).length;
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1577
1578 function censorURL(url) 1578 function censorURL(url)
1579 { 1579 {
1580 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1580 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1581 } 1581 }
1582 1582
1583 function encodeHTML(str) 1583 function encodeHTML(str)
1584 { 1584 {
1585 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1585 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1586 } 1586 }
OLDNEW
« no previous file with comments | « chrome/content/ui/composer.js ('k') | chrome/content/ui/sidebar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld