Created
May 30, 2016 22:13
-
-
Save juliandescottes/98624ca22d3bde725dbfe050e7fd74b5 to your computer and use it in GitHub Desktop.
screenshot mochitest
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
function screenshot(win) { | |
let canvas = win.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); | |
let width = win.innerWidth; | |
let height = win.innerHeight; | |
canvas.mozOpaque = true; | |
canvas.width = width; | |
canvas.height = height; | |
let ctx = canvas.getContext("2d"); | |
ctx.drawWindow(win, win.scrollX, win.scrollY, width, height, "#fff"); | |
info("Screenshot:" + canvas.toDataURL()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment