drawWindow() is a method belonging to CanvasRenderingContext2D, not HTMLCanvasElement (canvas) itself. Per the docs, "To get [the context] object, call getContext() on a canvas, supplying "2d" as the argument"
example:
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
ctx.drawWindow(...);