URI.toAbsolute used incomplete same-origin logic.

There's a new method on URI that does more complete same-origin logic,
and toAbsolute now uses that.
Reformatted isSameOrigin patch, added unit tests and credits to changelog.txt