Bug 1793868 - Use the scheme of document's principal as the initial value of |isSecure|, r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D158749
This commit is contained in:
Kershaw Chang
2022-10-06 11:14:55 +00:00
parent 8ae83a6c8a
commit db4ae0ee74

View File

@@ -1313,7 +1313,7 @@ already_AddRefed<WebSocket> WebSocket::ConstructorCommon(
webSocket->GetOwner()->UpdateWebSocketCount(1);
}
bool isSecure = true;
bool isSecure = principal->SchemeIs("https");
aRv = webSocketImpl->IsSecure(&isSecure);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
@@ -2814,7 +2814,7 @@ nsresult WebSocketImpl::IsSecure(bool* aValue) {
// innerWindow will be null. There is nothing on top of this to be
// considered.
if (NS_WARN_IF(!principal)) {
return NS_ERROR_DOM_SECURITY_ERR;
return NS_OK;
}
*aValue = principal->SchemeIs("https");
return NS_OK;