title: Execute JS from Firefox extension
body: <p>I'm trying to execute custom JS code from a Firefox extension using:</p>
  
  <pre><code>function executeJS(document, script) {
      var script = document.createElement('script');
      script.setAttribute('type', 'text/javascript');
      script.appendChild(document.createTextNode(script));
      document.getElementsByTagName('head')[0].appendChild(script);
  }
  </code></pre>
  
  <p>The method call looks like:</p>
  
  <pre><code>executeJS(content.document, "$('#" + this.id + "').jixedbar({showOnTop:true});");
  </code></pre>
  
  <p>And this is the result that I get:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      [object XPCNativeWrapper [object HTMLScriptElement]]
  &lt;/script&gt;
  </code></pre>
  
  <p>What's wrong with my code?
  What's the proper way of execution arbitrary JS script from Firefox extension?</p>