Choose ports dynamically

ran grunt test.

This change is for chrome and shared (chrome + firefox) code, but not firefox. Dynamically choosing ports still needs to be done in firefox!