Bug 806587: Restore getCodebasePrincipal since extensions use it. r=mounir
--- a/caps/idl/nsIScriptSecurityManager.idl
+++ b/caps/idl/nsIScriptSecurityManager.idl
@@ -5,17 +5,17 @@
#include "nsISupports.idl"
#include "nsIPrincipal.idl"
#include "nsIXPCSecurityManager.idl"
interface nsIURI;
interface nsIChannel;
interface nsIDocShell;
-[scriptable, uuid(b17f9a0b-c36b-4961-8f19-11e03f43436d)]
+[scriptable, uuid(ae486501-ec57-4ec8-a565-6880ca4ae6c4)]
interface nsIScriptSecurityManager : nsIXPCSecurityManager
{
///////////////// Security Checks //////////////////
/**
* Checks whether the running script is allowed to access aProperty.
*/
[noscript] void checkPropertyAccess(in JSContextPtr aJSContext,
in JSObjectPtr aJSObject,
@@ -162,16 +162,23 @@ interface nsIScriptSecurityManager : nsI
/**
* Returns a principal with that has the same origin as uri and is not part
* of an appliction.
* The returned principal will have appId = NO_APP_ID.
*/
nsIPrincipal getNoAppCodebasePrincipal(in nsIURI uri);
+ /**
+ * Legacy name for getNoAppCodebasePrincipal.
+ *
+ * @deprecated use getNoAppCodebasePrincipal instead.
+ */
+ [deprecated] nsIPrincipal getCodebasePrincipal(in nsIURI uri);
+
///////////////////////
/**
* Return the principal of the specified object in the specified context.
*/
[noscript] nsIPrincipal getObjectPrincipal(in JSContextPtr cx,
in JSObjectPtr obj);
/**
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -1866,16 +1866,23 @@ NS_IMETHODIMP
nsScriptSecurityManager::GetNoAppCodebasePrincipal(nsIURI* aURI,
nsIPrincipal** aPrincipal)
{
return GetCodebasePrincipalInternal(aURI, nsIScriptSecurityManager::NO_APP_ID,
false, aPrincipal);
}
NS_IMETHODIMP
+nsScriptSecurityManager::GetCodebasePrincipal(nsIURI* aURI,
+ nsIPrincipal** aPrincipal)
+{
+ return GetNoAppCodebasePrincipal(aURI, aPrincipal);
+}
+
+NS_IMETHODIMP
nsScriptSecurityManager::GetAppCodebasePrincipal(nsIURI* aURI,
uint32_t aAppId,
bool aInMozBrowser,
nsIPrincipal** aPrincipal)
{
NS_ENSURE_TRUE(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
NS_ERROR_INVALID_ARG);
--- a/ipc/testshell/XPCShellEnvironment.cpp
+++ b/ipc/testshell/XPCShellEnvironment.cpp
@@ -753,16 +753,22 @@ FullTrustSecMan::GetSimpleCodebasePrinci
NS_IMETHODIMP
FullTrustSecMan::GetNoAppCodebasePrincipal(nsIURI *aURI,
nsIPrincipal **_retval)
{
return GetSimpleCodebasePrincipal(aURI, _retval);
}
NS_IMETHODIMP
+FullTrustSecMan::GetCodebasePrincipal(nsIURI *aURI, nsIPrincipal **_retval)
+{
+ return GetSimpleCodebasePrincipal(aURI, _retval);
+}
+
+NS_IMETHODIMP
FullTrustSecMan::GetAppCodebasePrincipal(nsIURI *aURI,
uint32_t aAppId,
bool aInMozBrowser,
nsIPrincipal **_retval)
{
return GetSimpleCodebasePrincipal(aURI, _retval);
}
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -1390,16 +1390,23 @@ FullTrustSecMan::GetSimpleCodebasePrinci
/* [noscript] nsIPrincipal getNoAppCodebasePrincipal (in nsIURI aURI); */
NS_IMETHODIMP
FullTrustSecMan::GetNoAppCodebasePrincipal(nsIURI *aURI, nsIPrincipal **_retval)
{
return GetSimpleCodebasePrincipal(aURI, _retval);
}
+/* [noscript] nsIPrincipal getCodebasePrincipal (in nsIURI aURI); */
+NS_IMETHODIMP
+FullTrustSecMan::GetCodebasePrincipal(nsIURI *aURI, nsIPrincipal **_retval)
+{
+ return GetSimpleCodebasePrincipal(aURI, _retval);
+}
+
/* [noscript] nsIPrincipal getAppCodebasePrincipal (in nsIURI aURI, unsigned long appid, bool inMozBrowser); */
NS_IMETHODIMP
FullTrustSecMan::GetAppCodebasePrincipal(nsIURI *aURI, uint32_t aAppId, bool aInMozBrowser, nsIPrincipal **_retval)
{
return GetSimpleCodebasePrincipal(aURI, _retval);
}
/* [noscript] nsIPrincipal getDocShellCodebasePrincipal (in nsIURI aURI, nsIDocShell docShell); */