Testing this out using the JSDom implementation:
> var url = new whatwgURL.URL("foo:/hello/world?someQuery")
> url.href
"foo:/hello/world?someQuery"
> url.pathname = ""
> url.href
"foo:?someQuery"
> url.pathname = "test"
> url.href
"foo:/test?someQuery"
> var url = new whatwgURL.URL("foo:?someQuery")
> url.pathname = "test"
> url.href
"foo:?someQuery"
When setting pathname to the empty string, we create a cannot-be-a-base URL ("foo:?someQuery"), but it is not flagged as such because the parser won't set this flag after "path start" state, which is where the setter begins. Therefore we can continue to set the pathname to something else. But if we parse that same string again, the cannot-be-a-base flag is correctly set and the subsequent pathname setter has no effect.