Fix a whole bunch of bugs related to the URL class.

Also add tests for this class in jsrt,
so similar bugs don't creep up on us again.