| Index: lib/child/dataCollector.js |
| =================================================================== |
| --- a/lib/child/dataCollector.js |
| +++ b/lib/child/dataCollector.js |
| @@ -54,22 +54,39 @@ function onCollectData(message) |
| } |
| let window = Services.wm.getOuterWindowWithId(outerWindowID); |
| if (window) |
| { |
| Task.spawn(function*() |
| { |
| let data = {}; |
| + data.opener = window.opener ? window.opener.location.href : null; |
| + data.referrer = window.document.referrer; |
| + data.frames = yield scanFrames(window); |
| data.screenshot = yield createScreenshot(window, screenshotWidth); |
| return data; |
| }).then(success, error); |
| } |
| } |
| +function scanFrames(window) |
| +{ |
| + let frames = []; |
| + for (let i = 0; i < window.frames.length; i++) |
| + { |
| + let frame = window.frames[i]; |
| + frames.push({ |
| + url: frame.location.href, |
| + frames: scanFrames(frame) |
| + }); |
| + } |
| + return frames; |
| +} |
| + |
| function* createScreenshot(window, screenshotWidth) |
| { |
| let canvas = window.document.createElement("canvas"); |
| canvas.width = screenshotWidth; |
| let context = canvas.getContext("2d"); |
| let wndWidth = window.document.documentElement.scrollWidth; |
| let wndHeight = window.document.documentElement.scrollHeight; |