whatwg / url

URL Standard
https://url.spec.whatwg.org/
Other
532 stars 140 forks source link

The origin of "blob:" URL containing inner "blob:" URL #770

Closed rmisev closed 1 year ago

rmisev commented 1 year ago

Different browsers return different origin values for such URLs. For example, the results of parsing blob:blob:http://host:123/path are:

Browser or standard origin
URL standard http://host:123
Chromium null
Firefox http://host:123
Safari blob://

I would prefer Chromium's behavior, even though it differs from the URL standard. There are two reasons for this:

  1. Using the recursive origin's algorithm of the URL standard, it is easy to cause out of memory error by, for example, providing a URL with millions of blob: in it: blob:blob:blob: ... blob:http://host:123/path
  2. Maybe I am wrong, but I think that a URL with many embedded blob: has no practical use.

If you agree, I can prepare PR and tests.

annevk commented 1 year ago

I think you are correct. In fact, we should probably only do recursion when the scheme is an HTTP(S) scheme.