       log: (args...) =>
         @emit 'console-log', args...
 
-    @__defineGetter__ 'document', ->
-      new MockDocument
-
-    @__defineGetter__ 'location', ->
-      new MockLocation
+    @document = new MockDocument
+    @location = new MockLocation
 
   postMessage: (data, origin) ->
     @emit 'message',

  constructor: (@type) ->
    super

    if @type && @type.toLowerCase() == 'iframe'
      @__defineGetter__ 'contentWindow', ->
        new MockWindow

  addEventListener: (event, listener) ->
    @on(event, listener)


      @emit 'cookie', key, value, {path, domain} = cookies[key]

    @body = new MockNode('body')

class MockWindow extends MockNode
  constructor: ->
