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

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

Issue 29333147: Issue 3464 - Make variables accessed from XUL truly global in Issue Reporter (Closed)
Patch Set: Created Jan. 4, 2016, 5:40 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 | « no previous file | no next file » | 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 appendElement(element, "option", {id: "privateBrowsing"}, PrivateBrowsingUtils .isContentWindowPrivate(contentWindow)); 98 appendElement(element, "option", {id: "privateBrowsing"}, PrivateBrowsingUtils .isContentWindowPrivate(contentWindow));
99 appendElement(element, "option", {id: "subscriptionsAutoUpdate"}, Prefs.subscr iptions_autoupdate); 99 appendElement(element, "option", {id: "subscriptionsAutoUpdate"}, Prefs.subscr iptions_autoupdate);
100 appendElement(element, "option", {id: "javascript"}, Services.prefs.getBoolPre f("javascript.enabled")); 100 appendElement(element, "option", {id: "javascript"}, Services.prefs.getBoolPre f("javascript.enabled"));
101 appendElement(element, "option", {id: "cookieBehavior"}, Services.prefs.getInt Pref("network.cookie.cookieBehavior")); 101 appendElement(element, "option", {id: "cookieBehavior"}, Services.prefs.getInt Pref("network.cookie.cookieBehavior"));
102 }; 102 };
103 103
104 // 104 //
105 // Data collectors 105 // Data collectors
106 // 106 //
107 107
108 let reportsListDataSource = 108 var reportsListDataSource =
109 { 109 {
110 list: [], 110 list: [],
111 111
112 collectData: function(wnd, windowURI, callback) 112 collectData: function(wnd, windowURI, callback)
113 { 113 {
114 let data = Prefs.recentReports; 114 let data = Prefs.recentReports;
115 if (data && "length" in data) 115 if (data && "length" in data)
116 { 116 {
117 for (let i = 0; i < data.length; i++) 117 for (let i = 0; i < data.length; i++)
118 { 118 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 handleClick: function(event) 178 handleClick: function(event)
179 { 179 {
180 if (event.button != 0 || !event.target || !event.target.hasAttribute("url")) 180 if (event.button != 0 || !event.target || !event.target.hasAttribute("url"))
181 return; 181 return;
182 182
183 UI.loadInBrowser(event.target.getAttribute("url")); 183 UI.loadInBrowser(event.target.getAttribute("url"));
184 } 184 }
185 }; 185 };
186 186
187 let requestsDataSource = 187 var requestsDataSource =
188 { 188 {
189 requests: reportElement("requests"), 189 requests: reportElement("requests"),
190 origRequests: [], 190 origRequests: [],
191 requestNotifier: null, 191 requestNotifier: null,
192 callback: null, 192 callback: null,
193 nodeByKey: Object.create(null), 193 nodeByKey: Object.create(null),
194 194
195 collectData: function(wnd, windowURI, callback) 195 collectData: function(wnd, windowURI, callback)
196 { 196 {
197 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) 197 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 if (scanComplete) 236 if (scanComplete)
237 { 237 {
238 this.requestNotifier.shutdown(); 238 this.requestNotifier.shutdown();
239 this.requestNotifier = null; 239 this.requestNotifier = null;
240 this.callback(); 240 this.callback();
241 } 241 }
242 } 242 }
243 }; 243 };
244 244
245 let filtersDataSource = 245 var filtersDataSource =
246 { 246 {
247 origFilters: [], 247 origFilters: [],
248 248
249 collectData: function(wnd, windowURI, callback) 249 collectData: function(wnd, windowURI, callback)
250 { 250 {
251 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) 251 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor)
252 .getInterface(Ci.nsIDOMWindowUtils) 252 .getInterface(Ci.nsIDOMWindowUtils)
253 .outerWindowID; 253 .outerWindowID;
254 RequestNotifier.getWindowStatistics(outerWindowID, (wndStats) => 254 RequestNotifier.getWindowStatistics(outerWindowID, (wndStats) =>
255 { 255 {
(...skipping 10 matching lines...) Expand all
266 hitCount: hitCount 266 hitCount: hitCount
267 }); 267 });
268 this.origFilters.push(filter); 268 this.origFilters.push(filter);
269 } 269 }
270 } 270 }
271 callback(); 271 callback();
272 }); 272 });
273 } 273 }
274 }; 274 };
275 275
276 let subscriptionsDataSource = 276 var subscriptionsDataSource =
277 { 277 {
278 subscriptionFilter: function(s) 278 subscriptionFilter: function(s)
279 { 279 {
280 if (s.disabled || !(s instanceof RegularSubscription)) 280 if (s.disabled || !(s instanceof RegularSubscription))
281 return false; 281 return false;
282 if (s instanceof DownloadableSubscription && !/^(http|https|ftp):/i.test(s.u rl)) 282 if (s instanceof DownloadableSubscription && !/^(http|https|ftp):/i.test(s.u rl))
283 return false; 283 return false;
284 return true; 284 return true;
285 }, 285 },
286 286
(...skipping 23 matching lines...) Expand all
310 subscriptionXML.setAttribute("softExpiration", subscription.softExpira tion - now); 310 subscriptionXML.setAttribute("softExpiration", subscription.softExpira tion - now);
311 if (subscription.expires) 311 if (subscription.expires)
312 subscriptionXML.setAttribute("hardExpiration", subscription.expires - now); 312 subscriptionXML.setAttribute("hardExpiration", subscription.expires - now);
313 subscriptionXML.setAttribute("downloadStatus", subscription.downloadStat us); 313 subscriptionXML.setAttribute("downloadStatus", subscription.downloadStat us);
314 } 314 }
315 } 315 }
316 callback(); 316 callback();
317 } 317 }
318 }; 318 };
319 319
320 let screenshotDataSource = 320 var screenshotDataSource =
321 { 321 {
322 imageOffset: 10, 322 imageOffset: 10,
323 323
324 // Fields used for color reduction 324 // Fields used for color reduction
325 _mapping: [0x00, 0x55, 0xAA, 0xFF], 325 _mapping: [0x00, 0x55, 0xAA, 0xFF],
326 _i: null, 326 _i: null,
327 _max: null, 327 _max: null,
328 _pixelData: null, 328 _pixelData: null,
329 _callback: null, 329 _callback: null,
330 330
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 this._context.putImageData(op.data, 564 this._context.putImageData(op.data,
565 Math.min(op.anchorX, op.currentX), 565 Math.min(op.anchorX, op.currentX),
566 Math.min(op.anchorY, op.currentY)); 566 Math.min(op.anchorY, op.currentY));
567 567
568 if (!this._undoQueue.length) 568 if (!this._undoQueue.length)
569 E("screenshotUndoButton").disabled = true; 569 E("screenshotUndoButton").disabled = true;
570 } 570 }
571 }; 571 };
572 572
573 let framesDataSource = 573 var framesDataSource =
574 { 574 {
575 site: null, 575 site: null,
576 576
577 collectData: function(wnd, windowURI, callback) 577 collectData: function(wnd, windowURI, callback)
578 { 578 {
579 try 579 try
580 { 580 {
581 this.site = windowURI.host; 581 this.site = windowURI.host;
582 if (this.site) 582 if (this.site)
583 document.title += " (" + this.site + ")"; 583 document.title += " (" + this.site + ")";
(...skipping 28 matching lines...) Expand all
612 } 612 }
613 } 613 }
614 catch (e) 614 catch (e)
615 { 615 {
616 // Don't break if something goes wrong 616 // Don't break if something goes wrong
617 Cu.reportError(e); 617 Cu.reportError(e);
618 } 618 }
619 } 619 }
620 }; 620 };
621 621
622 let errorsDataSource = 622 var errorsDataSource =
623 { 623 {
624 collectData: function(wnd, windowURI, callback) 624 collectData: function(wnd, windowURI, callback)
625 { 625 {
626 let {addonID} = require("info"); 626 let {addonID} = require("info");
627 addonID = addonID.replace(/[\{\}]/g, ""); 627 addonID = addonID.replace(/[\{\}]/g, "");
628 628
629 // See https://bugzilla.mozilla.org/show_bug.cgi?id=664695 - starting with 629 // See https://bugzilla.mozilla.org/show_bug.cgi?id=664695 - starting with
630 // Gecko 19 this function returns the result, before that it wrote to a 630 // Gecko 19 this function returns the result, before that it wrote to a
631 // parameter. 631 // parameter.
632 let outparam = {}; 632 let outparam = {};
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 line: message.lineNumber, 685 line: message.lineNumber,
686 column: message.columnNumber, 686 column: message.columnNumber,
687 sourceLine: sourceLine 687 sourceLine: sourceLine
688 }); 688 });
689 } 689 }
690 690
691 callback(); 691 callback();
692 } 692 }
693 }; 693 };
694 694
695 let extensionsDataSource = 695 var extensionsDataSource =
696 { 696 {
697 data: reportData.createElement("extensions"), 697 data: reportData.createElement("extensions"),
698 698
699 collectData: function(wnd, windowURI, callback) 699 collectData: function(wnd, windowURI, callback)
700 { 700 {
701 try 701 try
702 { 702 {
703 let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm", nu ll).AddonManager; 703 let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm", nu ll).AddonManager;
704 AddonManager.getAddonsByTypes(["extension", "plugin"], function(items) 704 AddonManager.getAddonsByTypes(["extension", "plugin"], function(items)
705 { 705 {
(...skipping 21 matching lines...) Expand all
727 727
728 exportData: function(doExport) 728 exportData: function(doExport)
729 { 729 {
730 if (doExport) 730 if (doExport)
731 reportData.documentElement.appendChild(this.data); 731 reportData.documentElement.appendChild(this.data);
732 else if (this.data.parentNode) 732 else if (this.data.parentNode)
733 this.data.parentNode.removeChild(this.data); 733 this.data.parentNode.removeChild(this.data);
734 } 734 }
735 }; 735 };
736 736
737 let subscriptionUpdateDataSource = 737 var subscriptionUpdateDataSource =
738 { 738 {
739 contentWnd: null, 739 contentWnd: null,
740 type: null, 740 type: null,
741 outdated: null, 741 outdated: null,
742 needUpdate: null, 742 needUpdate: null,
743 743
744 subscriptionFilter: function(s) 744 subscriptionFilter: function(s)
745 { 745 {
746 if (s instanceof DownloadableSubscription) 746 if (s instanceof DownloadableSubscription)
747 return subscriptionsDataSource.subscriptionFilter(s); 747 return subscriptionsDataSource.subscriptionFilter(s);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 879 }
880 }, 880 },
881 881
882 updateOutdated: function() 882 updateOutdated: function()
883 { 883 {
884 for (let i = 0; i < this.outdated.length; i++) 884 for (let i = 0; i < this.outdated.length; i++)
885 Synchronizer.execute(this.outdated[i], true); 885 Synchronizer.execute(this.outdated[i], true);
886 } 886 }
887 } 887 }
888 888
889 let issuesDataSource = 889 var issuesDataSource =
890 { 890 {
891 contentWnd: null, 891 contentWnd: null,
892 isEnabled: Prefs.enabled, 892 isEnabled: Prefs.enabled,
893 whitelistFilter: null, 893 whitelistFilter: null,
894 disabledFilters: [], 894 disabledFilters: [],
895 disabledSubscriptions: [], 895 disabledSubscriptions: [],
896 ownFilters: [], 896 ownFilters: [],
897 numSubscriptions: 0, 897 numSubscriptions: 0,
898 numAppliedFilters: Infinity, 898 numAppliedFilters: Infinity,
899 899
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 1584
1585 function censorURL(url) 1585 function censorURL(url)
1586 { 1586 {
1587 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1587 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1588 } 1588 }
1589 1589
1590 function encodeHTML(str) 1590 function encodeHTML(str)
1591 { 1591 {
1592 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1592 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1593 } 1593 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld