This is already done by some xpconnect test, but makes sense refactoring it into head.js to make it available to anyone. So it will be possible for example to add a module in test folder and import it.
Created attachment 425202 [details] [diff] [review] patch v1.0
i was thinking that maybe would be more useful having it point to the parent folder, usually tests are organized like: test/unit test/other test/somethingother maybe could be cool to put jsm files in test/ and be able to share it across all folders as resource://test/module.jsm. And use resource://test/unit/module.jsm if it's in a subfolder. Thoughts?
We don't really have a good story for sharing resources among test directories. I think I made do_get_file("../foo") work because there were tests using that to work around it. However, I'm pretty sure most areas in the codebase using xpcshell tests have only one test directory, so making it work as you propose might be confusing.
Comment on attachment 425202 [details] [diff] [review] patch v1.0 Looks good. If you can figure out a better way to share this stuff between dirs that isn't confusing in the common case, I'm open to ideas.