Auto-install unit tests

This adds unit tests for auto-installing extensions
* actually only 1 "test" to Extension Manager tests
* refactored code to facilitate testing
* added jsdoc annotations
* minor code cleanup
* fixes #9576

cc @dangoor 

It's unfortunate that any failure would be completely silent. If there was a problem with the installation, we couldn't even have the user check the log. Ideally, we'd bubble the error out from here and have the outer code decide what to do, but it seems fair at this point to log errors in the code above.

What do you think?