title: How do I prevent Firefox SDK content scripts from loading multiple times?
body: <p>How do I prevent Firefox SDK content scripts from loading multiple times? The docs and a bug report I found suggest the <code>contentScriptWhen</code> property should limit the number of times my content scripts are executed, yet I see them running anywhere from twice to 15 times in a page load.</p>
  
  <p>Here's what's in my main.js:</p>
  
  <pre><code>var data = require("sdk/self").data;
  var tabs = require('sdk/tabs');
  
  var pageMod = require('sdk/page-mod');
  pageMod.PageMod({
      include: ['*'],
      contentScriptWhen: "ready",
      contentScriptFile: [data.url("extBootstrapper.js"), data.url("extContent.js")],
      onAttach: function(worker) {
         //handlers for AJAX and changing preferences, etc
         ...
  });
  </code></pre>
  
  <p>I've tried controlling this behavior with the <code>contentScriptWhen</code> property, as well as by having an 'isLoaded' flag on each script - neither prevents the scripts from executing multiple times. </p>