mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1124386 - BroadcastChannel should use the nsIPrincipal::URI in case the origin is null, r=smaug
This commit is contained in:
parent
43f4696a2d
commit
ba51f10b4d
@ -66,6 +66,27 @@ GetOrigin(nsIPrincipal* aPrincipal, nsAString& aOrigin, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
aOrigin = tmp;
|
||||
if (aOrigin.EqualsASCII("null")) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aRv = aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!uri)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString spec;
|
||||
aRv = uri->GetSpec(spec);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
aOrigin = NS_ConvertUTF8toUTF16(spec);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -438,6 +459,9 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
GetOrigin(principal, origin, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
aRv = PrincipalToPrincipalInfo(principal, &principalInfo);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
|
Loading…
Reference in New Issue
Block a user