зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1622042 - Remove nsContentUtils::GetAsciiOrigin r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D66634 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
63b92a302c
Коммит
6deb42e865
|
@ -5850,26 +5850,6 @@ SameOriginCheckerImpl::GetInterface(const nsIID& aIID, void** aResult) {
|
|||
return QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult nsContentUtils::GetASCIIOrigin(nsIPrincipal* aPrincipal,
|
||||
nsACString& aOrigin) {
|
||||
MOZ_ASSERT(aPrincipal, "missing principal");
|
||||
|
||||
aOrigin.Truncate();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (uri) {
|
||||
return GetASCIIOrigin(uri, aOrigin);
|
||||
}
|
||||
|
||||
aOrigin.AssignLiteral("null");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult nsContentUtils::GetASCIIOrigin(nsIURI* aURI, nsACString& aOrigin) {
|
||||
MOZ_ASSERT(aURI, "missing uri");
|
||||
|
@ -5927,7 +5907,7 @@ nsresult nsContentUtils::GetUTFOrigin(nsIPrincipal* aPrincipal,
|
|||
aOrigin.Truncate();
|
||||
nsAutoCString asciiOrigin;
|
||||
|
||||
nsresult rv = GetASCIIOrigin(aPrincipal, asciiOrigin);
|
||||
nsresult rv = aPrincipal->GetAsciiOrigin(asciiOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aOrigin = NS_ConvertUTF8toUTF16(asciiOrigin);
|
||||
|
|
|
@ -2199,7 +2199,6 @@ class nsContentUtils {
|
|||
*
|
||||
* @note this should be used for HTML5 origin determination.
|
||||
*/
|
||||
static nsresult GetASCIIOrigin(nsIPrincipal* aPrincipal, nsACString& aOrigin);
|
||||
static nsresult GetASCIIOrigin(nsIURI* aURI, nsACString& aOrigin);
|
||||
static nsresult GetUTFOrigin(nsIPrincipal* aPrincipal, nsAString& aOrigin);
|
||||
static nsresult GetUTFOrigin(nsIURI* aURI, nsAString& aOrigin);
|
||||
|
|
|
@ -669,7 +669,7 @@ nsresult BlobURLProtocolHandler::GenerateURIString(nsIPrincipal* aPrincipal,
|
|||
|
||||
if (aPrincipal) {
|
||||
nsAutoCString origin;
|
||||
rv = nsContentUtils::GetASCIIOrigin(aPrincipal, origin);
|
||||
rv = aPrincipal->GetAsciiOrigin(origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -1646,7 +1646,7 @@ nsresult WebSocketImpl::AsyncOpen(
|
|||
MOZ_ASSERT_IF(!aTransportProvider, aNegotiatedExtensions.IsEmpty());
|
||||
|
||||
nsCString asciiOrigin;
|
||||
nsresult rv = nsContentUtils::GetASCIIOrigin(aPrincipal, asciiOrigin);
|
||||
nsresult rv = aPrincipal->GetAsciiOrigin(asciiOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aTransportProvider) {
|
||||
|
|
|
@ -3871,7 +3871,7 @@ HttpBaseChannel::TimingAllowCheck(nsIPrincipal* aOrigin, bool* _retval) {
|
|||
}
|
||||
|
||||
nsAutoCString origin;
|
||||
nsContentUtils::GetASCIIOrigin(aOrigin, origin);
|
||||
aOrigin->GetAsciiOrigin(origin);
|
||||
|
||||
Tokenizer p(headerValue);
|
||||
Tokenizer::Token t;
|
||||
|
|
|
@ -743,7 +743,7 @@ NullHttpChannel::TimingAllowCheck(nsIPrincipal* aOrigin, bool* _retval) {
|
|||
}
|
||||
|
||||
nsAutoCString origin;
|
||||
nsContentUtils::GetASCIIOrigin(aOrigin, origin);
|
||||
aOrigin->GetAsciiOrigin(origin);
|
||||
|
||||
if (mTimingAllowOriginHeader == origin) {
|
||||
*_retval = true;
|
||||
|
|
|
@ -563,7 +563,7 @@ nsresult nsCORSListenerProxy::CheckRequestApproved(nsIRequest* aRequest) {
|
|||
if (mWithCredentials || !allowedOriginHeader.EqualsLiteral("*")) {
|
||||
MOZ_ASSERT(!nsContentUtils::IsExpandedPrincipal(mOriginHeaderPrincipal));
|
||||
nsAutoCString origin;
|
||||
nsContentUtils::GetASCIIOrigin(mOriginHeaderPrincipal, origin);
|
||||
mOriginHeaderPrincipal->GetAsciiOrigin(origin);
|
||||
|
||||
if (!allowedOriginHeader.Equals(origin)) {
|
||||
LogBlockedRequest(
|
||||
|
|
Загрузка…
Ссылка в новой задаче