title: Why is script.onload not working in a Chrome userscript?
body: <p>I want to load another script file, in a site, using a userscript. 
  But, the <code>js.onload</code> event doesn't work correctly.</p>
  
  <p>The userscript file:</p>
  
  <pre><code>// ==UserScript==
  // @name           Code highlight
  // @description    Test
  // @include        http://localhost/*
  // @version        1.0
  // ==/UserScript==
  
  var js = document.createElement('script');
      js.src = "http://localhost/test/js/load.js";
      document.getElementsByTagName("head")[0].appendChild(js);
      js.onload = function(){
          console.log(A)
      }
  </code></pre>
  
  <p>the load.js file:</p>
  
  <pre><code>var A = {
      name:'aa'
  }
  </code></pre>
  
  <p><br>
  In Chrome, the console outputs "undefined", but the load.js has loaded completely.</p>
  
  <p>I tested it in Firefox, and it outputs <code>A</code> correctly.</p>