-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring environment origin, top-level site, etc into policy container #8302
Comments
For cross-origin cases there is no inheritance so we'd have to copy (or set up something new) regardless. Policy container helps with certain same origin cases (such as about:blank and history). Creating the policy container earlier on seems feasible (and having environment own it until a document comes alive), but we probably don't want to move ownership from document to environment settings object entirely as I suspect that initial about:blank and a subsequent same-origin document don't share a container. @antosart did the policy container work and can hopefully help out here. |
I'm looking at moving origin to policy container, but I have another question. Right now the origin for a windows environment settings object delegates to the window's associated document's origin. So I presume I need to move document's origin into policy container. Correct? Current document's policy container is defined in html spec, but document's origin is defined in DOM spec. Is there a recommendation on how to adjust things here? Can DOM spec reference the policy container defined in html? I'm not familiar with the dependencies or associated restrictions between html-vs-dom. Thanks. |
I was thinking that maybe we can move origin to HTML, but that does not immediately work as it's also cloned and such. Perhaps that is no longer necessary though if we keep track of it on the global as I don't think document's origin is directly exposed. Interdependencies between DOM and HTML are okay though, but if we can avoid them or at least plan for a way out that's always better. |
Hmm, another complication will be that adding origin, top-level site, etc to policy container will mean it is no longer able to be created with reasonable defaults. We can use an opaque origin as a default, but that would change behavior. So we will have to ensure that wherever a policy container is created these values are now available. Edit: This is difficult because policy containers are created as defaults of other objects and so on. |
Hmm, another complication may be that document.origin is altered when document.domain is set? I'm unsure of the implications of that on moving origin to policy container. |
I've tried to start a PR in #8447, but I don't know where to set the policy container origin for new documents. I could just reference document.origin, but is that going away? And policy container origin would not get updated along with it for document.domain. |
Unless you take steps to copy an origin, you'll reference it, so any modifications to it should be reflected. This is what happens for instance with an As such I think this should be doable, including incrementally where we keep document's origin around, but we definitely want to be careful. |
I realized we might have a problem with document.domain changes leaking into the storage key incorrectly. See: whatwg/storage#150 |
This change also depends on whatwg/dom#1142.
This change also depends on whatwg/dom#1142.
This change also depends on whatwg/dom#1142.
This change also depends on whatwg/dom#1142.
At TPAC there was a discussion about moving various authority information from the environment into a policy container owned by the environment. This would ensure the information is copied around correctly.
I started looking into this, but there are a couple issues I see with doing this:
Also, I'm wondering if policy containers are truly copied or just a reference is passed around. I haven't verified which yet. But if a reference is passed around it becomes difficult to modify values. For example, a cross-origin iframe should inherit the top-level site but will have a different origin value. But maybe the containers are copied and not referenced.
@annevk Any thoughts on these issues and what a good path forward would be?
The text was updated successfully, but these errors were encountered: