Bug 1189086 - Eliminate nsIPrincipal::jarPrefix. r=dveditz

This commit is contained in:
Dave Huseby 2016-10-24 13:52:00 +02:00
Родитель fa19ea68e4
Коммит ce82855c42
6 изменённых файлов: 3 добавлений и 86 удалений

Просмотреть файл

@ -571,13 +571,6 @@ BasePrincipal::GetIsSystemPrincipal(bool* aResult)
return NS_OK;
}
NS_IMETHODIMP
BasePrincipal::GetJarPrefix(nsACString& aJarPrefix)
{
mozilla::GetJarPrefix(mOriginAttributes.mAppId, mOriginAttributes.mInIsolatedMozBrowser, aJarPrefix);
return NS_OK;
}
NS_IMETHODIMP
BasePrincipal::GetOriginAttributes(JSContext* aCx, JS::MutableHandle<JS::Value> aVal)
{

Просмотреть файл

@ -279,7 +279,6 @@ public:
NS_IMETHOD GetIsCodebasePrincipal(bool* aResult) override;
NS_IMETHOD GetIsExpandedPrincipal(bool* aResult) override;
NS_IMETHOD GetIsSystemPrincipal(bool* aResult) override;
NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix) final;
NS_IMETHOD GetOriginAttributes(JSContext* aCx, JS::MutableHandle<JS::Value> aVal) final;
NS_IMETHOD GetOriginSuffix(nsACString& aOriginSuffix) final;
NS_IMETHOD GetAppStatus(uint16_t* aAppStatus) final;

Просмотреть файл

@ -21,7 +21,7 @@ interface nsIDOMDocument;
[ptr] native JSPrincipals(JSPrincipals);
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
[scriptable, builtinclass, uuid(d0391e86-1ad7-4ab0-bb7c-14d6d9967369)]
[scriptable, builtinclass, uuid(3da7b133-f1a0-4de9-a2bc-5c49014c1077)]
interface nsIPrincipal : nsISerializable
{
/**
@ -176,21 +176,6 @@ interface nsIPrincipal : nsISerializable
*/
readonly attribute AString cspJSON;
/**
* Returns the jar prefix of the principal.
* The jar prefix is a string that can be used to isolate data or
* permissions between different principals while taking into account
* parameters like the app id or the fact that the principal is embedded in
* a mozbrowser.
* Some principals will return an empty string.
* Some principals will assert if you try to access the jarPrefix.
*
* The jarPrefix is intended to be an opaque identifier. It is currently
* "human-readable" but no callers should assume it will stay as is and
* it might be crypto-hashed at some point.
*/
readonly attribute AUTF8String jarPrefix;
/**
* A dictionary of the non-default origin attributes associated with this
* nsIPrincipal.
@ -234,9 +219,6 @@ interface nsIPrincipal : nsISerializable
* The value of .originSuffix is automatically serialized into .origin, so any
* consumers using that are automatically origin-attribute-aware. Consumers with
* special requirements must inspect and compare .originSuffix manually.
*
* originsuffix are intended to be a replacement for jarPrefix, which will
* eventually be removed.
*/
readonly attribute AUTF8String originSuffix;

Просмотреть файл

@ -26,7 +26,7 @@ class DomainPolicyClone;
[ptr] native JSObjectPtr(JSObject);
[ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone);
[scriptable, uuid(da831650-4241-4892-806c-cce8465a2ba8)]
[scriptable, uuid(51daad87-3a0c-44cc-b620-7356801c9022)]
interface nsIScriptSecurityManager : nsISupports
{
/**
@ -260,14 +260,6 @@ interface nsIScriptSecurityManager : nsISupports
const unsigned long DEFAULT_USER_CONTEXT_ID = 0;
/**
* Returns the jar prefix for the app.
* appId can be NO_APP_ID or a valid app id. appId should not be
* UNKNOWN_APP_ID.
* inMozBrowser has to be true if the app is inside a mozbrowser iframe.
*/
AUTF8String getJarPrefix(in unsigned long appId, in boolean inMozBrowser);
/**
* Per-domain controls to enable and disable script. This system is designed
* to be used by at most one consumer, and enforces this with its semantics.

Просмотреть файл

@ -1518,46 +1518,6 @@ nsScriptSecurityManager::InitPrefs()
return NS_OK;
}
namespace mozilla {
void
GetJarPrefix(uint32_t aAppId, bool aInIsolatedMozBrowser, nsACString& aJarPrefix)
{
MOZ_ASSERT(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
if (aAppId == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
aAppId = nsIScriptSecurityManager::NO_APP_ID;
}
aJarPrefix.Truncate();
// Fallback.
if (aAppId == nsIScriptSecurityManager::NO_APP_ID && !aInIsolatedMozBrowser) {
return;
}
// aJarPrefix = appId + "+" + { 't', 'f' } + "+";
aJarPrefix.AppendInt(aAppId);
aJarPrefix.Append('+');
aJarPrefix.Append(aInIsolatedMozBrowser ? 't' : 'f');
aJarPrefix.Append('+');
return;
}
} // namespace mozilla
NS_IMETHODIMP
nsScriptSecurityManager::GetJarPrefix(uint32_t aAppId,
bool aInIsolatedMozBrowser,
nsACString& aJarPrefix)
{
MOZ_ASSERT(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID);
mozilla::GetJarPrefix(aAppId, aInIsolatedMozBrowser, aJarPrefix);
return NS_OK;
}
NS_IMETHODIMP
nsScriptSecurityManager::GetDomainPolicyActive(bool *aRv)
{

Просмотреть файл

@ -69,7 +69,7 @@ public:
static uint16_t AppStatusForPrincipal(nsIPrincipal *aPrin);
static nsresult
static nsresult
ReportError(JSContext* cx, const nsAString& messageTag,
nsIURI* aSource, nsIURI* aTarget);
@ -159,13 +159,4 @@ private:
static JSContext *sContext;
};
namespace mozilla {
void
GetJarPrefix(uint32_t aAppid,
bool aInIsolatedMozBrowser,
nsACString& aJarPrefix);
} // namespace mozilla
#endif // nsScriptSecurityManager_h__