title: TypeError: Cannot read property 'console' of null
body: <p>Here's the guilty snippet extracted from a third party lib :</p>
  
  <pre><code>function hasConsoleLogger() {
      return window.console &amp;&amp; window.console.log;
  }
  </code></pre>
  
  <p>Nothing fancy, but it surprisingly returns :
  <code>TypeError: Cannot read property 'console' of null</code></p>
  
  <p>It's executed in a browser context (Chrome) so no Node.js non-window stuff involved.</p>
  
  <p>I've checked for potential malicious <code>delete window</code> or <code>window = null</code> without success.</p>
  
  <p>The application where this bug occurs runs with Friendly iFrames, and document.write() calls.</p>
  
  <p>Unfortunately I can't provide any demo link of the issue.</p>
  
  <p>So I guess my question is <strong>"How could the window object be nullified or unreachable by mistake in a browser?"</strong></p>