title: NaCl is supposed to be enabled by default in unpacked extensions, yet I can't use it from one
body: <p>"NaCl is currently only turned on by default for applications/extensions from the Chrome Webstore, or unpacked extensions for development purposes." - the Internet</p>
  
  <p>Yet I can't seem to be able to use NaCl from an unpacked extension. (I did not try the Web Store.)</p>
  
  <p>I have a really simple test extension which has the following in its background.js:</p>
  
  <pre><code>function clicked() {
      var testNaclElement = document.createElement("embed");
      testNaclElement.setAttribute("type","application/x-nacl");
      testNaclElement.setAttribute("width",0);
      testNaclElement.setAttribute("height",0);
      document.body.appendChild(testNaclElement);
      alert(testNaclElement.postMessage?true:false);
      document.body.removeChild(testNaclElement);
  }
  
  chrome.browserAction.onClicked.addListener(updateIcon);
  updateIcon();
  </code></pre>
  
  <p>This extension reports true when the NaCl is enabled in chrome://flags, but when NaCl is disabled in chrome://flags (which is the default) it reports false.</p>
  
  <p>I expected it to report true.</p>
  
  <p>What am I missing?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>It seems that inventing my own detection code not such a good idea after all.
  If I create and install an unpacked chrome webapp that points to url X, then NaCl will work on that page, but this detection code will still report false, while the very same code reports true when on a normal webpage with NaCl enabled in chrome://flags.</p>
  
  <p>BUT if create an extension (not a chrome webapp) that uses NaCl in an iFrame which points to url X, then NaCl will not work in it.</p>
  
  <p>BUT if I create a webapp that points to url X and an extension that uses url X in an iFrame, then both will work if installed at the same time.</p>
  
  <p><strong>Update2:</strong>
  If I actually include the nmf and nexe in the extension, then it works.</p>
  
  <p><strong>Update3:</strong>
  nexe needn't be included in the extension.</p>