Open Bug 1433181 Opened 7 years ago Updated 2 years ago

consider making GetChannelResultPrincipal() return the same null principal every time its called for the same data URL nsIChannel

Categories

(Core :: Security: CAPS, enhancement)

enhancement

Tracking

()

People

(Reporter: bkelly, Unassigned)

References

Details

While investigating bug 1433044 I discovered that it seems GetChannelResultPrincipal() will return a different null principal if you call it multiple times for the same channel. I found this a bit unexpected. Could we cache the null principal on the channel somewhere so that we can return the same null principal on repeated calls?
For example, if I add this code to WorkerPrivate.cpp: nsCOMPtr<nsIPrincipal> channelPrincipal; nsresult rv = ssm->GetChannelResultPrincipal(aChannel, getter_AddRefs(channelPrincipal)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIPrincipal> p2; rv = ssm->GetChannelResultPrincipal(aChannel, getter_AddRefs(p2)); NS_ENSURE_SUCCESS(rv, rv); nsAutoCString o1; nsAutoCString o2; channelPrincipal->GetOrigin(o1); p2->GetOrigin(o2); printf_stderr("### ### channel principal p1:%s p2:%s\n", o1.get(), o2.get()); I get this output when creating a data URL worker script: ### ### channel principal p1:moz-nullprincipal:{6c67355e-b095-4549-a928-827a33247809} p2:moz-nullprincipal:{da0d37fe-cef2-4f6b-9c95-e88f172d5b61}
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.