| OLD | NEW |
| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 // | 18 // |
| 19 // Report data template, more data will be added during data collection | 19 // Report data template, more data will be added during data collection |
| 20 // | 20 // |
| 21 | 21 |
| 22 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | 22 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
| 23 let {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", {}); | 23 let {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", {}); |
| 24 let {PrivateBrowsingUtils} = Cu.import("resource://gre/modules/PrivateBrowsingUt
ils.jsm", {}); | |
| 25 | 24 |
| 26 const MILLISECONDS_IN_SECOND = 1000; | 25 const MILLISECONDS_IN_SECOND = 1000; |
| 27 const SECONDS_IN_MINUTE = 60; | 26 const SECONDS_IN_MINUTE = 60; |
| 28 const SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE; | 27 const SECONDS_IN_HOUR = 60 * SECONDS_IN_MINUTE; |
| 29 const SECONDS_IN_DAY = 24 * SECONDS_IN_HOUR; | 28 const SECONDS_IN_DAY = 24 * SECONDS_IN_HOUR; |
| 30 | 29 |
| 31 let contentWindow = window.arguments[0]; | 30 let contentWindow = window.arguments[0]; |
| 32 let windowURI = window.arguments[1]; | 31 let windowURI = window.arguments[1]; |
| 33 if (typeof windowURI == "string") | 32 if (typeof windowURI == "string") |
| 34 windowURI = Services.newURI(windowURI, null, null); | 33 windowURI = Services.newURI(windowURI, null, null); |
| 35 let browser = window.arguments[2]; | 34 let browser = window.arguments[2]; |
| 35 let isPrivate = false; |
| 36 | 36 |
| 37 let reportData = new DOMParser().parseFromString("<report></report>", "text/xml"
); | 37 let reportData = new DOMParser().parseFromString("<report></report>", "text/xml"
); |
| 38 | 38 |
| 39 // Some helper functions to work with the report data | 39 // Some helper functions to work with the report data |
| 40 function reportElement(tag) | 40 function reportElement(tag) |
| 41 { | 41 { |
| 42 for (let child = reportData.documentElement.firstChild; child; child = child.n
extSibling) | 42 for (let child = reportData.documentElement.firstChild; child; child = child.n
extSibling) |
| 43 if (child.nodeType == Node.ELEMENT_NODE && child.tagName == tag) | 43 if (child.nodeType == Node.ELEMENT_NODE && child.tagName == tag) |
| 44 return child; | 44 return child; |
| 45 let element = reportData.createElement(tag); | 45 let element = reportData.createElement(tag); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 let element = reportElement("platform"); | 91 let element = reportElement("platform"); |
| 92 element.setAttribute("name", "Gecko"); | 92 element.setAttribute("name", "Gecko"); |
| 93 element.setAttribute("version", Services.appinfo.platformVersion); | 93 element.setAttribute("version", Services.appinfo.platformVersion); |
| 94 element.setAttribute("build", Services.appinfo.platformBuildID); | 94 element.setAttribute("build", Services.appinfo.platformBuildID); |
| 95 }; | 95 }; |
| 96 { | 96 { |
| 97 let element = reportElement("options"); | 97 let element = reportElement("options"); |
| 98 appendElement(element, "option", {id: "enabled"}, Prefs.enabled); | 98 appendElement(element, "option", {id: "enabled"}, Prefs.enabled); |
| 99 appendElement(element, "option", {id: "objecttabs"}, Prefs.frameobjects); | 99 appendElement(element, "option", {id: "objecttabs"}, Prefs.frameobjects); |
| 100 appendElement(element, "option", {id: "collapse"}, !Prefs.fastcollapse); | 100 appendElement(element, "option", {id: "collapse"}, !Prefs.fastcollapse); |
| 101 appendElement(element, "option", {id: "privateBrowsing"}, PrivateBrowsingUtils
.isContentWindowPrivate(contentWindow)); | |
| 102 appendElement(element, "option", {id: "subscriptionsAutoUpdate"}, Prefs.subscr
iptions_autoupdate); | 101 appendElement(element, "option", {id: "subscriptionsAutoUpdate"}, Prefs.subscr
iptions_autoupdate); |
| 103 appendElement(element, "option", {id: "javascript"}, Services.prefs.getBoolPre
f("javascript.enabled")); | 102 appendElement(element, "option", {id: "javascript"}, Services.prefs.getBoolPre
f("javascript.enabled")); |
| 104 appendElement(element, "option", {id: "cookieBehavior"}, Services.prefs.getInt
Pref("network.cookie.cookieBehavior")); | 103 appendElement(element, "option", {id: "cookieBehavior"}, Services.prefs.getInt
Pref("network.cookie.cookieBehavior")); |
| 105 }; | 104 }; |
| 106 | 105 |
| 107 // | 106 // |
| 108 // Data collectors | 107 // Data collectors |
| 109 // | 108 // |
| 110 | 109 |
| 111 var reportsListDataSource = | 110 var reportsListDataSource = |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 collectData: function(wnd, windowURI, browser, callback) | 324 collectData: function(wnd, windowURI, browser, callback) |
| 326 { | 325 { |
| 327 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) | 326 let outerWindowID = wnd.QueryInterface(Ci.nsIInterfaceRequestor) |
| 328 .getInterface(Ci.nsIDOMWindowUtils) | 327 .getInterface(Ci.nsIDOMWindowUtils) |
| 329 .outerWindowID; | 328 .outerWindowID; |
| 330 let dataCollector = require("dataCollector"); | 329 let dataCollector = require("dataCollector"); |
| 331 let screenshotWidth = screenshotDataSource.getWidth(); | 330 let screenshotWidth = screenshotDataSource.getWidth(); |
| 332 dataCollector.collectData(outerWindowID, screenshotWidth, data => { | 331 dataCollector.collectData(outerWindowID, screenshotWidth, data => { |
| 333 screenshotDataSource.setData(data && data.screenshot); | 332 screenshotDataSource.setData(data && data.screenshot); |
| 334 framesDataSource.setData(windowURI, data && data.opener, data && data.refe
rrer, data && data.frames); | 333 framesDataSource.setData(windowURI, data && data.opener, data && data.refe
rrer, data && data.frames); |
| 334 |
| 335 if (data && data.isPrivate) |
| 336 isPrivate = true; |
| 337 let element = reportElement("options"); |
| 338 appendElement(element, "option", {id: "privateBrowsing"}, isPrivate); |
| 339 |
| 335 callback(); | 340 callback(); |
| 336 }); | 341 }); |
| 337 } | 342 } |
| 338 } | 343 } |
| 339 | 344 |
| 340 var screenshotDataSource = | 345 var screenshotDataSource = |
| 341 { | 346 { |
| 342 imageOffset: 10, | 347 imageOffset: 10, |
| 343 | 348 |
| 344 // Fields used for user interaction | 349 // Fields used for user interaction |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 | 1516 |
| 1512 if (success) | 1517 if (success) |
| 1513 { | 1518 { |
| 1514 try | 1519 try |
| 1515 { | 1520 { |
| 1516 let link = request.responseXML.getElementById("link").getAttribute("href")
; | 1521 let link = request.responseXML.getElementById("link").getAttribute("href")
; |
| 1517 let button = E("copyLink"); | 1522 let button = E("copyLink"); |
| 1518 button.setAttribute("url", link); | 1523 button.setAttribute("url", link); |
| 1519 button.removeAttribute("disabled"); | 1524 button.removeAttribute("disabled"); |
| 1520 | 1525 |
| 1521 if (!PrivateBrowsingUtils.isContentWindowPrivate(contentWindow)) | 1526 if (!isPrivate) |
| 1522 reportsListDataSource.addReport(framesDataSource.site, link); | 1527 reportsListDataSource.addReport(framesDataSource.site, link); |
| 1523 } catch (e) {} | 1528 } catch (e) {} |
| 1524 E("copyLinkBox").hidden = false; | 1529 E("copyLinkBox").hidden = false; |
| 1525 | 1530 |
| 1526 document.documentElement.getButton("finish").disabled = false; | 1531 document.documentElement.getButton("finish").disabled = false; |
| 1527 document.documentElement.getButton("cancel").disabled = true; | 1532 document.documentElement.getButton("cancel").disabled = true; |
| 1528 E("progressBar").activeItemComplete = true; | 1533 E("progressBar").activeItemComplete = true; |
| 1529 } | 1534 } |
| 1530 } | 1535 } |
| 1531 | 1536 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1551 | 1556 |
| 1552 function censorURL(url) | 1557 function censorURL(url) |
| 1553 { | 1558 { |
| 1554 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); | 1559 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); |
| 1555 } | 1560 } |
| 1556 | 1561 |
| 1557 function encodeHTML(str) | 1562 function encodeHTML(str) |
| 1558 { | 1563 { |
| 1559 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); | 1564 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); |
| 1560 } | 1565 } |
| OLD | NEW |