- From: Timothy Gu <notifications@github.com>
- Date: Mon, 29 Nov 2021 21:01:18 -0800
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 30 November 2021 05:01:31 UTC
I like the idea of ensuring the parts don't get reinterpreted too much before allowing a non-special URL to switch to a special scheme. As an example, to allow switching to `file`, I think it's reasonable to require that:
* The source URL must not have an opaque path.
To switch to `http`, we should additionally require:
* The source URL must have a host. (Technically this implies the first requirement.)
As an additional example, Firefox and Safari currently have the following behavior:
```js
u = new URL('javascript:!!notahost()');
u.protocol = 'http:';
console.assert(u.href, 'http://!!notahost()/');
// console.assert(u.href, 'http://%21%21notahost%28%29/'); // Chrome
```
which I don't think is useful or worth keeping.
----
It also sounds like escaping `\` would be quite useful for this proposal. I filed #675 to track this.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/674#issuecomment-982287021
Received on Tuesday, 30 November 2021 05:01:31 UTC