     patchImage : (window) ->
         # TODO MEM
         self = this
-        # Thanks Zombie for Image code 
+        # Thanks Zombie for Image code
         window.Image = (width, height) ->
             img = new self.jsdom
                       .dom

        # window.setTimeout and setInterval piggyback off of Node's functions,
        # but emit events before/after calling the supplied function.
        ['setTimeout', 'setInterval'].forEach (timer) ->
            # FIXME: using native node's implement temporarily, there is a memory leak in jsdom's implementation 
            old = global[timer]
            window[timer] = (fn, interval, args...) ->
                old () ->
                    self.logger("trigger #{timer}")
                    self.browser.emit('EnteredTimer')
                    fn.apply(window, args)
                    self.browser.emit('ExitedTimer')
                , interval
        # expose setImmediate
        window.setImmediate = (fn, args...)->
            setImmediate(()->

            img.width = width
            img.height = height
            img

    patchNavigator : (window) ->
        window.navigator.javaEnabled = false
        window.navigator.language = 'en-US'
