Bug 776140 - Add GetExtendedOrigin method to nsILoadContext. r=jlebar, sr=sicking

This commit is contained in:
Jason Duell 2012-07-23 11:09:26 -07:00
parent d1caa102c7
commit f599864772
3 changed files with 31 additions and 0 deletions

View File

@ -11364,6 +11364,20 @@ nsDocShell::GetIsContent(bool *aIsContent)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetExtendedOrigin(nsIURI *aUri, nsACString &aResult)
{
bool isInBrowserElement;
GetIsInBrowserElement(&isInBrowserElement);
nsCOMPtr<nsIScriptSecurityManager> ssmgr =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
NS_ENSURE_TRUE(ssmgr, false);
return ssmgr->GetExtendedOrigin(aUri, mAppId, isInBrowserElement, aResult);
}
bool
nsDocShell::IsOKToLoadURI(nsIURI* aURI)
{

View File

@ -228,6 +228,7 @@ public:
NS_IMETHOD GetIsContent(bool*);
NS_IMETHOD GetUsePrivateBrowsing(bool*);
NS_IMETHOD SetUsePrivateBrowsing(bool);
NS_IMETHOD GetExtendedOrigin(nsIURI *uri, nsACString & retval);
// Restores a cached presentation from history (mLSHE).
// This method swaps out the content viewer and simulates loads for

View File

@ -7,6 +7,7 @@
#include "nsISupports.idl"
interface nsIDOMWindow;
interface nsIURI;
/**
* An nsILoadContext represents the context of a load. This interface
@ -78,4 +79,19 @@ interface nsILoadContext : nsISupports
*/
readonly attribute unsigned long appId;
/**
* Get the extended origin of a channel in this load context.
* The extended origin is a string that has more information than the origin
* and 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 load is taking place in a mozbrowser.
*
* In some cases this function will simply return the origin for the
* channel's URI.
*
* The extendedOrigin 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.
*/
AUTF8String GetExtendedOrigin(in nsIURI channel);
};