title: casperjs uncaught Error: TypeError: Attempted to assign to readOnly property
body: <p>Anyone know how I can find out the cause of this error in casperjs? The test script I am trying to run when getting this is:</p>
  
  <pre><code>var errors = [];
  casper.on("page.error", function(msg, trace) {
    this.echo("Error:    " + msg, "ERROR");
    this.echo("file:     " + trace[0].file, "WARNING");
    this.echo("line:     " + trace[0].line, "WARNING");
    this.echo("function: " + trace[0]["function"], "WARNING");
    errors.push(msg);
  });
  
  casper.on('resource.received', function(resource) {
      var status = resource.status;
      if(status &gt;= 400) {
          casper.log('Resource ' + resource.url + ' failed to load (' + status + ')', 'error');
  
          errors.push({
              url: resource.url,
              status: resource.status
          });
      }
  });
  
  
  
  casper.test.begin('Are we online?', 3, function suite(test) {
      casper.start("http://www.google.com/", function() {
          test.assertTitle("Google", "Connected to google, internet connection probably ok");
      });
  
      casper.thenOpen("https://mysite", function() {
          test.assertTitle("Log On", "Connected to mysite, server is up");
          this.fill('form#logonForm', {
              'Name':    'user',
              'Password':    'pass',
          }, true);
      });
  
      casper.thenOpen("https://mysite/somepage", function() {    
          casper.test.assert(errors.length==0,'No js errors'); //THIS LINE SEEMS TO BE CAUSING THIS ERROR, NOT SURE WHY?
      });
  
      casper.run(function () {
          test.done();
      });
  });
  </code></pre>
  
  <p>The full, complete error message is:</p>
  
  <p>Details for 1 failed test:
  In connect-to-production.js: 1968      (there is no such line, my js file has only the lines I pasted above in it, nowhere near 2000 lines)</p>
  
  <p>Are we online? (my test name)
   uncaughtError: TypeError: Attempted to Assign to readOnly property.</p>
  
  <p>Above this it does not behave like a normal error and says NO STACK TRACE.</p>