mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 451081 - Introduce ORIGIN_IS_FULL_SPEC protocol handler flag, r=bz+standard8 IGNORE IDL
This commit is contained in:
parent
54c615a386
commit
c19627f880
@ -294,6 +294,12 @@ interface nsIProtocolHandler : nsISupports
|
||||
* headers.
|
||||
*/
|
||||
const unsigned long URI_FETCHABLE_BY_ANYONE = (1 << 19);
|
||||
|
||||
/**
|
||||
* If this flag is set, then the origin for this protocol is the full URI
|
||||
* spec, not just the scheme + host + port.
|
||||
*/
|
||||
const unsigned long ORIGIN_IS_FULL_SPEC = (1 << 20);
|
||||
};
|
||||
|
||||
%{C++
|
||||
@ -304,4 +310,6 @@ interface nsIProtocolHandler : nsISupports
|
||||
/**
|
||||
* For example, "@mozilla.org/network/protocol;1?name=http"
|
||||
*/
|
||||
|
||||
#define IS_ORIGIN_IS_FULL_SPEC_DEFINED 1
|
||||
%}
|
||||
|
@ -1646,9 +1646,10 @@ NS_SecurityHashURI(nsIURI *aURI)
|
||||
if (scheme.EqualsLiteral("file"))
|
||||
return schemeHash; // sad face
|
||||
|
||||
if (scheme.EqualsLiteral("imap") ||
|
||||
scheme.EqualsLiteral("mailbox") ||
|
||||
scheme.EqualsLiteral("news"))
|
||||
bool hasFlag;
|
||||
if (NS_FAILED(NS_URIChainHasFlags(baseURI,
|
||||
nsIProtocolHandler::ORIGIN_IS_FULL_SPEC, &hasFlag)) ||
|
||||
hasFlag)
|
||||
{
|
||||
nsAutoCString spec;
|
||||
uint32_t specHash;
|
||||
@ -1745,13 +1746,13 @@ NS_SecurityCompareURIs(nsIURI *aSourceURI,
|
||||
return NS_SUCCEEDED(rv) && filesAreEqual;
|
||||
}
|
||||
|
||||
// Special handling for mailnews schemes
|
||||
if (targetScheme.EqualsLiteral("imap") ||
|
||||
targetScheme.EqualsLiteral("mailbox") ||
|
||||
targetScheme.EqualsLiteral("news"))
|
||||
bool hasFlag;
|
||||
if (NS_FAILED(NS_URIChainHasFlags(targetBaseURI,
|
||||
nsIProtocolHandler::ORIGIN_IS_FULL_SPEC, &hasFlag)) ||
|
||||
hasFlag)
|
||||
{
|
||||
// Each message is a distinct trust domain; use the
|
||||
// whole spec for comparison
|
||||
// URIs with this flag have the whole spec as a distinct trust
|
||||
// domain; use the whole spec for comparison
|
||||
nsAutoCString targetSpec;
|
||||
nsAutoCString sourceSpec;
|
||||
return ( NS_SUCCEEDED( targetBaseURI->GetSpec(targetSpec) ) &&
|
||||
|
Loading…
Reference in New Issue
Block a user