   constructor: (@type) ->
     super
 
-    if @type && @type.toLowerCase() == 'iframe'
-      @__defineGetter__ 'contentWindow', ->
-        new MockWindow
+    if @type?.toLowerCase() == 'iframe'
+      @contentWindow = new MockWindow
 
   addEventListener: (event, listener) ->
     @on(event, listener)


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

    @__defineGetter__ 'body', ->
      new MockNode

class MockWindow extends MockNode
  constructor: ->

      log: (args...) =>
        @emit 'console-log', args...

    @document = new MockDocument
    @location = new MockLocation

  postMessage: (data, origin) ->
    @emit 'message',
