Bug 1404910 - WebSocket should consider the corrent top-level window principal, r=smaug

This commit is contained in:
Andrea Marchesini committed 2017-10-04 14:18:19 +02:00
1 parent eb2a8564d0
commit 68d2d74bd5
4 files changed
+106 -8

No files matched your search

+7 -8
View File
@@ -1666,18 +1666,17 @@ WebSocketImpl::Init(JSContext* aCx,
nsCOMPtr<nsPIDOMWindowInner> innerWindow;
while (true) {
if (principal) {
bool isNullPrincipal = true;
isNullPrincipal = principal->GetIsNullPrincipal();
if (isNullPrincipal || nsContentUtils::IsSystemPrincipal(principal)) {
break;
}
if (principal && !principal->GetIsNullPrincipal()) {
break;
}
if (!innerWindow) {
innerWindow = do_QueryInterface(globalObject);
if (NS_WARN_IF(!innerWindow)) {
return NS_ERROR_DOM_SECURITY_ERR;
if (!innerWindow) {
// If we are in a XPConnect sandbox or in a JS component,
// innerWindow will be null. There is nothing on top of this to be
// considered.
break;
}
}