mozilla / r2d2b2g

Firefox OS Simulator is a test environment for Firefox OS. Use it to test your apps in a Firefox OS-like environment that looks and feels like a mobile phone.
https://addons.mozilla.org/en-US/firefox/addon/firefox-os-simulator/
Other
392 stars 139 forks source link

load scripts via <script> tags in Simulator shell #445

Open mykmelez opened 11 years ago

mykmelez commented 11 years ago

The Simulator shell has some code that looks like this:

<!-- B2G Desktop has a weird bug that causes it not to show app content
   - if we load a script early, even if the script doesn't do anything.
   - To work around it, we wait until ContentStart to load the script. -->
<!--<script type="application/javascript" src="chrome://prosthesis/content/shell.js"/>-->
<script type="application/javascript">
  window.addEventListener("ContentStart", function() {
    Services.scriptloader.loadSubScript("chrome://prosthesis/content/shell.js");
    Services.scriptloader.loadSubScript("chrome://prosthesis/content/mutation-summary.js");
    Services.scriptloader.loadSubScript("chrome://prosthesis/content/lockscreen.js");
    Services.scriptloader.loadSubScript("chrome://prosthesis/content/window-manager.js");
  }, false);
</script>

But I bet that weird bug isn't around anymore, and we can load those scripts via regular <script> tags. We should do that.

nickdesaulniers commented 11 years ago

I just tried this but the shell was mad broke.

mykmelez commented 11 years ago

That's probably because those scripts still should load after at least some of the other scripts that we load via <script> tags. Also, some of them may assume that they are being loaded lazily (i.e. on ContentStart) and do things that can't be done before then. For those scripts, we need to tease out those parts and wrap them in ContentStart event listeners.

So I will reopen for some additional digging into this. ;-)