What is the right TriggeringWindowId in edge cases like mouse middle click?
Categories
(Core :: Privacy: Anti-Tracking, defect)
Tracking
()
People
(Reporter: vhilla, Unassigned)
References
Details
Trying to verify nsDocShellLoadState::mTriggeringWindowId against nsDocShellLoadState::mTriggeringRemoteType fails in some cases. I suspect it's because of this fallback.
One example is middle click on a cross origin link. This goes through ClickHandlerParent which sets the triggering remote type but not window id. So the triggering window ends up being the new tab the link is opened in. I think there were also issues around service worker opening a window, or URIs being upgraded to https.
My understanding of bug 1835907 is that these cases are probably not important regarding storage access. But for consistency, maybe we should do something? Remove the fallback, limit the fallback more, or add assertions and fix places like ClickHandlerParent?
At least for being able to verify triggeringWindowId against triggeringRemoteType, we could change nsDocShell::DoURILoad to
if (!aLoadState->TriggeringWindowId()) {
// Only stamp current as triggering window if this load originated in this remote.
// That might still be wrong for same origin non-self-initiated navigations.
const nsCString& triggererRemote = aLoadState->GetEffectiveTriggeringRemoteType();
if (XRE_IsContentProcess() && triggererRemote == ContentChild::GetSingleton()->GetRemoteType()) {
aLoadState->SetTriggeringWindowId(context->Id());
}
}
| Reporter | ||
Updated•6 months ago
|
| Reporter | ||
Comment 1•6 months ago
|
||
I just stumbled upon this, maybe you can have a look whether this is something we should fix?
Comment 2•6 months ago
|
||
My understanding of bug 1835907 is that these cases are probably not important regarding storage access.
Yeah, the primary use of triggeringWindowId from that bug is here: https://hg-edge.mozilla.org/integration/autoland/rev/51e533c3d812
Access is even gated behindpolicyType == ExtContentPolicy::TYPE_SUBDOCUMENT), so these corner cases don't come up.
But for consistency, maybe we should do something? Remove the fallback, limit the fallback more, or add assertions and fix places like ClickHandlerParent?
Any of these sound reasonable to me- it just depends on how tightly you want to tie in the assertions. Your suggested snippet looks nice because it keeps the triggeringWindowId null in these corner cases where I don't need it anyway.
Description
•