OLD | NEW |
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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // Gecko 19 this function returns the result, before that it wrote to a | 623 // Gecko 19 this function returns the result, before that it wrote to a |
624 // parameter. | 624 // parameter. |
625 let outparam = {}; | 625 let outparam = {}; |
626 let messages = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleS
ervice).getMessageArray(outparam, {}); | 626 let messages = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleS
ervice).getMessageArray(outparam, {}); |
627 messages = messages || outparam.value || []; | 627 messages = messages || outparam.value || []; |
628 messages = messages.filter(function(message) | 628 messages = messages.filter(function(message) |
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.inde
xOf(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 = {__proto__: 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]; |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); | 1570 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); |
1571 } | 1571 } |
OLD | NEW |