Hi blink-dev,What is the same origin policy for file:// scheme? I'm trying to figure out whether replaceState and pushState can/should be used in a file scheme, but find little definitive information on this regard:
- WHATWG living spec doesn't mention file in the origin section at all
- An old version of W3C HTML spec from 2011 says it's UA-specific
- Chrome has an exception that tream files of the same path as same-origin in the context of History API, ignoring query and fragment differences: https://codereview.chromium.org/1632513002
- Very old MDN article says Gecko used to consider all file:// URLs same origin, but tightened it in Gecko 1.9. It seems to consider two file:// URLs same origin in context of History API (same as Chrome)
- Safari made all files unique origin by default (even for two identical file:// URLs) in https://trac.webkit.org/changeset/224609/webkit, which is based on this Chromium CL. This will be released in Safari 11.1 (with iOS 11.3 and macOS 10.13.4)
It seems that over time, all browsers are trending towards treating each file document as unique origin. I'd like to learn more about the history and rationale behind this.I found a bit discussion in http://crbug.com/528681. The conclusion there seems to be that if the location only changes the ref, it's safe. That led to the Chromium exception above. My other question is, why would the exception only be applied to History.cpp instead of more broadly in SecurityOrigin.cpp?
On Thu, Feb 22, 2018 at 3:00 PM, Danyao Wang <dan...@chromium.org> wrote:Hi blink-dev,What is the same origin policy for file:// scheme? I'm trying to figure out whether replaceState and pushState can/should be used in a file scheme, but find little definitive information on this regard:It's a mess...
- WHATWG living spec doesn't mention file in the origin section at all
- An old version of W3C HTML spec from 2011 says it's UA-specific
The whatwg URL spec (https://url.spec.whatwg.org/#origin) still says it is UA-specific "is left as an exercise to the reader".
- Chrome has an exception that tream files of the same path as same-origin in the context of History API, ignoring query and fragment differences: https://codereview.chromium.org/1632513002
- Very old MDN article says Gecko used to consider all file:// URLs same origin, but tightened it in Gecko 1.9. It seems to consider two file:// URLs same origin in context of History API (same as Chrome)
- Safari made all files unique origin by default (even for two identical file:// URLs) in https://trac.webkit.org/changeset/224609/webkit, which is based on this Chromium CL. This will be released in Safari 11.1 (with iOS 11.3 and macOS 10.13.4)
It seems that over time, all browsers are trending towards treating each file document as unique origin. I'd like to learn more about the history and rationale behind this.
I found a bit discussion in http://crbug.com/528681. The conclusion there seems to be that if the location only changes the ref, it's safe. That led to the Chromium exception above. My other question is, why would the exception only be applied to History.cpp instead of more broadly in SecurityOrigin.cpp?There is some more discussion around this issue in https://crbug.com/271996, with several attempts to make file:// URLs more like unique origins...
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CA%2BOSsVYpDR2zHNZZq6g1a_q4TZmHBGCwq3TgO_bdQH6UfH%2Bd%3DA%40mail.gmail.com.