   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)

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

    @__defineGetter__ 'document', ->
      new MockDocument

    @__defineGetter__ 'location', ->
      new MockLocation

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


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

    @body = new MockNode('body')

class MockWindow extends MockNode
  constructor: ->
