See https://github.com/mozilla-b2g/gaia/blob/master/shared/js/lazy_loader.js#L22 for a better way to ensure files are loaded