Chrome and Firefox both ship with a native URL constructor (https://url.spec.whatwg.org/).
There is a polyfill implemented at https://github.com/webcomponents/URL.
This seems to be a more stable implementation than whatever we came up with. It has solved bugs such as T68617.