mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00
Bug 1630865 - Implement nsICookieService::getCookieStringForPrincipal() - part 1 - nsIPrincipal methods, r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D71275
This commit is contained in:
parent
f85114ad67
commit
5e2698efa8
@ -667,6 +667,17 @@ BasePrincipal::GetPrepath(nsACString& aPath) {
|
||||
return prinURI->GetPrePath(aPath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetFilePath(nsACString& aPath) {
|
||||
aPath.Truncate();
|
||||
nsCOMPtr<nsIURI> prinURI;
|
||||
nsresult rv = GetURI(getter_AddRefs(prinURI));
|
||||
if (NS_FAILED(rv) || !prinURI) {
|
||||
return NS_OK;
|
||||
}
|
||||
return prinURI->GetFilePath(aPath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::GetIsSystemPrincipal(bool* aResult) {
|
||||
*aResult = IsSystemPrincipal();
|
||||
|
@ -133,6 +133,7 @@ class BasePrincipal : public nsJSPrincipals {
|
||||
NS_IMETHOD GetHostPort(nsACString& aRes) override;
|
||||
NS_IMETHOD GetHost(nsACString& aRes) override;
|
||||
NS_IMETHOD GetPrepath(nsACString& aResult) override;
|
||||
NS_IMETHOD GetFilePath(nsACString& aResult) override;
|
||||
NS_IMETHOD GetOriginSuffix(nsACString& aOriginSuffix) final;
|
||||
NS_IMETHOD GetIsIpAddress(bool* aIsIpAddress) override;
|
||||
NS_IMETHOD GetIsOnion(bool* aIsOnion) override;
|
||||
|
@ -231,7 +231,6 @@ interface nsIPrincipal : nsISerializable
|
||||
*/
|
||||
[noscript] readonly attribute ACString asciiHost;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the "host" portion of the
|
||||
* Principals URI, if any.
|
||||
@ -239,11 +238,16 @@ interface nsIPrincipal : nsISerializable
|
||||
[noscript] readonly attribute ACString host;
|
||||
|
||||
/**
|
||||
* Returns the prepath of the principals uri
|
||||
* follows the format scheme:
|
||||
* "scheme://username:password@hostname:portnumber/"
|
||||
*/
|
||||
[noscript] readonly attribute ACString prepath;
|
||||
* Returns the prepath of the principals uri
|
||||
* follows the format scheme:
|
||||
* "scheme://username:password@hostname:portnumber/"
|
||||
*/
|
||||
[noscript] readonly attribute ACString prepath;
|
||||
|
||||
/**
|
||||
* Returns the filePath of the principals uri. See nsIURI.
|
||||
*/
|
||||
[noscript] readonly attribute ACString filePath;
|
||||
|
||||
/**
|
||||
* Returns the ASCII Spec from the Principals URI.
|
||||
@ -322,7 +326,8 @@ interface nsIPrincipal : nsISerializable
|
||||
*
|
||||
* This method returns false instead of throwing upon errors.
|
||||
*/
|
||||
readonly attribute bool isOriginPotentiallyTrustworthy;
|
||||
[infallible]
|
||||
readonly attribute boolean isOriginPotentiallyTrustworthy;
|
||||
|
||||
/**
|
||||
* Returns the Flags of the Principals
|
||||
|
@ -9030,9 +9030,7 @@ bool nsContentUtils::HttpsStateIsModern(Document* aDocument) {
|
||||
|
||||
MOZ_ASSERT(principal->GetIsContentPrincipal());
|
||||
|
||||
bool isTrustworthyOrigin = false;
|
||||
principal->GetIsOriginPotentiallyTrustworthy(&isTrustworthyOrigin);
|
||||
return isTrustworthyOrigin;
|
||||
return principal->GetIsOriginPotentiallyTrustworthy();
|
||||
}
|
||||
|
||||
/* static */
|
||||
@ -9062,9 +9060,7 @@ bool nsContentUtils::ComputeIsSecureContext(nsIChannel* aChannel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isTrustworthyOrigin = false;
|
||||
principal->GetIsOriginPotentiallyTrustworthy(&isTrustworthyOrigin);
|
||||
return isTrustworthyOrigin;
|
||||
return principal->GetIsOriginPotentiallyTrustworthy();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -1908,9 +1908,7 @@ bool nsGlobalWindowOuter::ComputeIsSecureContext(Document* aDocument,
|
||||
}
|
||||
}
|
||||
|
||||
bool isTrustworthyOrigin = false;
|
||||
principal->GetIsOriginPotentiallyTrustworthy(&isTrustworthyOrigin);
|
||||
return isTrustworthyOrigin;
|
||||
return principal->GetIsOriginPotentiallyTrustworthy();
|
||||
}
|
||||
|
||||
static bool InitializeLegacyNetscapeObject(JSContext* aCx,
|
||||
|
@ -509,9 +509,7 @@ bool PresentationRequest::IsPrioriAuthenticatedURL(const nsAString& aUrl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isTrustworthyOrigin = false;
|
||||
principal->GetIsOriginPotentiallyTrustworthy(&isTrustworthyOrigin);
|
||||
return isTrustworthyOrigin;
|
||||
return principal->GetIsOriginPotentiallyTrustworthy();
|
||||
}
|
||||
|
||||
bool PresentationRequest::IsAllURLAuthenticated() {
|
||||
|
@ -69,9 +69,7 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithContentPrincipal)
|
||||
nsAutoCString uri(uris[i].uri);
|
||||
rv = nsScriptSecurityManager::GetScriptSecurityManager()
|
||||
->CreateContentPrincipalFromOrigin(uri, getter_AddRefs(prin));
|
||||
bool isPotentiallyTrustworthy = false;
|
||||
rv = prin->GetIsOriginPotentiallyTrustworthy(&isPotentiallyTrustworthy);
|
||||
ASSERT_EQ(NS_OK, rv);
|
||||
bool isPotentiallyTrustworthy = prin->GetIsOriginPotentiallyTrustworthy();
|
||||
ASSERT_EQ(isPotentiallyTrustworthy, uris[i].expectedResult);
|
||||
}
|
||||
}
|
||||
@ -82,10 +80,7 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithSystemPrincipal)
|
||||
nsScriptSecurityManager::GetScriptSecurityManager();
|
||||
ASSERT_TRUE(!!ssManager);
|
||||
nsCOMPtr<nsIPrincipal> sysPrin = nsContentUtils::GetSystemPrincipal();
|
||||
bool isPotentiallyTrustworthy;
|
||||
nsresult rv =
|
||||
sysPrin->GetIsOriginPotentiallyTrustworthy(&isPotentiallyTrustworthy);
|
||||
ASSERT_EQ(rv, NS_OK);
|
||||
bool isPotentiallyTrustworthy = sysPrin->GetIsOriginPotentiallyTrustworthy();
|
||||
ASSERT_TRUE(isPotentiallyTrustworthy);
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,7 @@ void ClearSiteData::ClearDataFromChannel(nsIHttpChannel* aChannel) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool secure;
|
||||
rv = principal->GetIsOriginPotentiallyTrustworthy(&secure);
|
||||
bool secure = principal->GetIsOriginPotentiallyTrustworthy();
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || !secure) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user