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 * @fileOverview Collects some data for a content window, to be attached to | 19 * @fileOverview Collects some data for a content window, to be attached to |
20 * issue reports. | 20 * issue reports. |
21 */ | 21 */ |
22 | 22 |
23 "use strict"; | 23 "use strict"; |
24 | 24 |
25 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | 25 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
26 let {Task} = Cu.import("resource://gre/modules/Task.jsm", {}); | 26 let {Task} = Cu.import("resource://gre/modules/Task.jsm", {}); |
| 27 let {PrivateBrowsingUtils} = Cu.import("resource://gre/modules/PrivateBrowsingUt
ils.jsm", {}); |
27 | 28 |
28 let {Utils} = require("utils"); | 29 let {Utils} = require("utils"); |
29 | 30 |
30 addMessageListener("AdblockPlus:CollectData", onCollectData); | 31 addMessageListener("AdblockPlus:CollectData", onCollectData); |
31 onShutdown.add(() => { | 32 onShutdown.add(() => { |
32 removeMessageListener("AdblockPlus:CollectData", onCollectData); | 33 removeMessageListener("AdblockPlus:CollectData", onCollectData); |
33 }); | 34 }); |
34 | 35 |
35 function onCollectData(message) | 36 function onCollectData(message) |
36 { | 37 { |
(...skipping 15 matching lines...) Expand all Loading... |
52 data: null | 53 data: null |
53 }); | 54 }); |
54 } | 55 } |
55 | 56 |
56 let window = Services.wm.getOuterWindowWithId(outerWindowID); | 57 let window = Services.wm.getOuterWindowWithId(outerWindowID); |
57 if (window) | 58 if (window) |
58 { | 59 { |
59 Task.spawn(function*() | 60 Task.spawn(function*() |
60 { | 61 { |
61 let data = {}; | 62 let data = {}; |
| 63 data.isPrivate = PrivateBrowsingUtils.isContentWindowPrivate(window); |
62 data.opener = window.opener ? window.opener.location.href : null; | 64 data.opener = window.opener ? window.opener.location.href : null; |
63 data.referrer = window.document.referrer; | 65 data.referrer = window.document.referrer; |
64 data.frames = yield scanFrames(window); | 66 data.frames = yield scanFrames(window); |
65 data.screenshot = yield createScreenshot(window, screenshotWidth); | 67 data.screenshot = yield createScreenshot(window, screenshotWidth); |
66 return data; | 68 return data; |
67 }).then(success, error); | 69 }).then(success, error); |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 function scanFrames(window) | 73 function scanFrames(window) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 { | 122 { |
121 // Take a break every 5000 bytes to prevent browser hangs | 123 // Take a break every 5000 bytes to prevent browser hangs |
122 yield new Promise((resolve, reject) => Utils.runAsync(resolve)); | 124 yield new Promise((resolve, reject) => Utils.runAsync(resolve)); |
123 } | 125 } |
124 } | 126 } |
125 | 127 |
126 // Convert the data into an image URL | 128 // Convert the data into an image URL |
127 context.putImageData(pixelData, 0, 0); | 129 context.putImageData(pixelData, 0, 0); |
128 return canvas.toDataURL("image/png"); | 130 return canvas.toDataURL("image/png"); |
129 } | 131 } |
OLD | NEW |