Created
October 9, 2020 17:50
-
-
Save jasonLaster/e96a112727858ec167fc1fc0fd049790 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/devtools/server/actors/replay/module.js b/devtools/server/actors/replay/module.js | |
| index 67b5a6639d07..eb83b8dae475 100644 | |
| --- a/devtools/server/actors/replay/module.js | |
| +++ b/devtools/server/actors/replay/module.js | |
| @@ -358,6 +358,25 @@ function eventListener(info) { | |
| RecordReplayControl.onEvent(event, info.phase == "pre"); | |
| } | |
| } | |
| +function getWindowAsImageData(win) { | |
| + const canvas = win.document.createElementNS( | |
| + "http://www.w3.org/1999/xhtml", | |
| + "canvas" | |
| + ); | |
| + const scale = getCurrentZoom(win); | |
| + const width = win.innerWidth; | |
| + const height = win.innerHeight; | |
| + canvas.width = width * scale; | |
| + canvas.height = height * scale; | |
| + canvas.mozOpaque = true; | |
| + | |
| + const ctx = canvas.getContext("2d"); | |
| + | |
| + ctx.scale(scale, scale); | |
| + ctx.drawWindow(win, win.scrollX, win.scrollY, width, height, "#fff"); | |
| + | |
| + return ctx.getImageData(0, 0, canvas.width, canvas.height); | |
| +} | |
| function SendRecordingFinished(recordingId) { | |
| const document = getWindow().document; | |
| @@ -366,6 +385,8 @@ function SendRecordingFinished(recordingId) { | |
| url: document.URL, | |
| title: document.title, | |
| duration: new Date() - startTime, | |
| + lastScreenData: getWindowAsImageData(getWindow()), | |
| + lastScreenMimeType: "jpeg", | |
| }; | |
| Services.cpmm.sendAsyncMessage("RecordingFinished", data); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment