You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"is a registrable domain suffix of or is equal to" seems pretty broken #6509
Consider a page hosted on https://www.gourmet.com.s3-website-us-east-1.amazonaws.com that does document.domain = "amazonaws.com".
amazonaws.com itself is not in the PSL. s3-website-us-east-1.amazonaws.com is.
It seems I regressed this in 326c644, maybe? At least what was there before has been there since forever I think.
If host is shorter than originalSuffix, then return false.
I would rephrase this as
If host, prefixed by U+002E (.), matches the end of originalSuffix, then return false.
to stick to the same comparison operations.
It would be really great to have examples for all these conditions. I put something up at #6510, but I'm struggling a bit at the moment with wrapping my head around it.
Yeah, I think your proposal will address it, but it mostly moves error handling further down the stack. That is, if I have www.gourmet.com.s3-website-us-east-1.amazonaws.com and try to document.domain = example.com, rather than being excluded based on length, it would be excluded based on the fact that originalSuffix doesn't match the end of host.
I still manage to confuse myself so I started writing down some examples the eventual algorithm will have to account for. If you have more, please add them.
Activity
Correct innards of document.domain
annevk commentedon Mar 19, 2021
It seems I regressed this in 326c644, maybe? At least what was there before has been there since forever I think.
I would rephrase this as
to stick to the same comparison operations.
It would be really great to have examples for all these conditions. I put something up at #6510, but I'm struggling a bit at the moment with wrapping my head around it.
sleevi commentedon Mar 19, 2021
Yeah, I think your proposal will address it, but it mostly moves error handling further down the stack. That is, if I have
www.gourmet.com.s3-website-us-east-1.amazonaws.comand try to document.domain =example.com, rather than being excluded based on length, it would be excluded based on the fact thatoriginalSuffixdoesn't match the end ofhost.I mentioned on the internal bug, it looks like Firefox is already implementing the algorithm I mentioned ( https://searchfox.org/mozilla-central/rev/200bfc652c5128011e7725fc7c201eb125d453e7/dom/base/Document.cpp#8463-8469 ), not the algorithm mentioned in 326c644 or above. That is, it's relying on the length check as a short-circuit.
That said, since the observable effect is the same, I'm not sure it matters, other than it took a little extra effort to reason though.
annevk commentedon Apr 15, 2021
I still manage to confuse myself so I started writing down some examples the eventual algorithm will have to account for. If you have more, please add them.
In the notes hostSuffix is hostParse(hostSuffixString).
Correct innards of document.domain
Correct innards of document.domain