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

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

Issue 5636077285015552: Issue 656 - Replace some __proto__ with Object.create (Closed)
Patch Set: Created June 23, 2014, 8:46 a.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/filters-subscriptionview.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 UI.loadInBrowser(event.target.getAttribute("url")); 182 UI.loadInBrowser(event.target.getAttribute("url"));
183 } 183 }
184 }; 184 };
185 185
186 let requestsDataSource = 186 let requestsDataSource =
187 { 187 {
188 requests: reportElement("requests"), 188 requests: reportElement("requests"),
189 origRequests: [], 189 origRequests: [],
190 requestNotifier: null, 190 requestNotifier: null,
191 callback: null, 191 callback: null,
192 nodeByKey: {__proto__: null}, 192 nodeByKey: Object.create(null),
193 193
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)
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 { 629 {
630 return (message instanceof Ci.nsIScriptError && 630 return (message instanceof Ci.nsIScriptError &&
631 !/^https?:/i.test(message.sourceName) && 631 !/^https?:/i.test(message.sourceName) &&
632 (/adblock/i.test(message.errorMessage) || /adblock/i.test(message.sour ceName) || 632 (/adblock/i.test(message.errorMessage) || /adblock/i.test(message.sour ceName) ||
633 message.errorMessage.indexOf(addonID) >= 0 || message.sourceName && m essage.sourceName.indexOf(addonID) >= 0)); 633 message.errorMessage.indexOf(addonID) >= 0 || message.sourceName && m essage.sourceName.indexOf(addonID) >= 0));
634 }); 634 });
635 if (messages.length > 10) // Only the last 10 messages 635 if (messages.length > 10) // Only the last 10 messages
636 messages = messages.slice(messages.length - 10, messages.length); 636 messages = messages.slice(messages.length - 10, messages.length);
637 637
638 // Censor app and profile paths in error messages 638 // Censor app and profile paths in error messages
639 let censored = {__proto__: null}; 639 let censored = Object.create(null);
640 let pathList = [["ProfD", "%PROFILE%"], ["GreD", "%GRE%"], ["CurProcD", "%AP P%"]]; 640 let pathList = [["ProfD", "%PROFILE%"], ["GreD", "%GRE%"], ["CurProcD", "%AP P%"]];
641 for (let i = 0; i < pathList.length; i++) 641 for (let i = 0; i < pathList.length; i++)
642 { 642 {
643 let [pathID, placeholder] = pathList[i]; 643 let [pathID, placeholder] = pathList[i];
644 try 644 try
645 { 645 {
646 let file = FileUtils.getDir(pathID, [], false); 646 let file = FileUtils.getDir(pathID, [], false);
647 censored[file.path.replace(/[\\\/]+$/, '')] = placeholder; 647 censored[file.path.replace(/[\\\/]+$/, '')] = placeholder;
648 let uri = Utils.ioService.newFileURI(file); 648 let uri = Utils.ioService.newFileURI(file);
649 censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder; 649 censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 for each (let subscription in FilterStorage.subscriptions) 902 for each (let subscription in FilterStorage.subscriptions)
903 { 903 {
904 if (subscription.disabled) 904 if (subscription.disabled)
905 continue; 905 continue;
906 906
907 for each (let filter in subscription.filters) 907 for each (let filter in subscription.filters)
908 if (filter instanceof BlockingFilter && filter.disabled) 908 if (filter instanceof BlockingFilter && filter.disabled)
909 disabledMatcher.add(filter); 909 disabledMatcher.add(filter);
910 } 910 }
911 911
912 let seenFilters = {__proto__: null}; 912 let seenFilters = Object.create(null);
913 for each (let request in requestsDataSource.origRequests) 913 for each (let request in requestsDataSource.origRequests)
914 { 914 {
915 if (request.filter) 915 if (request.filter)
916 continue; 916 continue;
917 917
918 let filter = disabledMatcher.matchesAny(request.location, request.typeDe scr, request.docDomain, request.thirdParty); 918 let filter = disabledMatcher.matchesAny(request.location, request.typeDe scr, request.docDomain, request.thirdParty);
919 if (filter && !(filter.text in seenFilters)) 919 if (filter && !(filter.text in seenFilters))
920 { 920 {
921 this.disabledFilters.push(filter); 921 this.disabledFilters.push(filter);
922 seenFilters[filter.text] = true; 922 seenFilters[filter.text] = true;
923 } 923 }
924 } 924 }
925 925
926 // Find disabled subscriptions with filters matching any of the requests 926 // Find disabled subscriptions with filters matching any of the requests
927 let seenSubscriptions = {__proto__: null}; 927 let seenSubscriptions = Object.create(null);
928 for each (let subscription in FilterStorage.subscriptions) 928 for each (let subscription in FilterStorage.subscriptions)
929 { 929 {
930 if (!subscription.disabled) 930 if (!subscription.disabled)
931 continue; 931 continue;
932 932
933 disabledMatcher.clear(); 933 disabledMatcher.clear();
934 for each (let filter in subscription.filters) 934 for each (let filter in subscription.filters)
935 if (filter instanceof BlockingFilter) 935 if (filter instanceof BlockingFilter)
936 disabledMatcher.add(filter); 936 disabledMatcher.add(filter);
937 937
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1562
1563 function censorURL(url) 1563 function censorURL(url)
1564 { 1564 {
1565 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1565 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1566 } 1566 }
1567 1567
1568 function encodeHTML(str) 1568 function encodeHTML(str)
1569 { 1569 {
1570 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1570 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1571 } 1571 }
OLDNEW
« no previous file with comments | « chrome/content/ui/filters-subscriptionview.js ('k') | chrome/content/ui/sidebar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld