mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1170311 - Stop asserting non-null argument to nsIPrincipal::{subsumes,equals}{,ConsideringDomain}. r=gabor
This commit is contained in:
parent
1b3a3e59e4
commit
7dca575d33
@ -76,14 +76,14 @@ BasePrincipal::GetOriginNoSuffix(nsACString& aOrigin)
|
||||
bool
|
||||
BasePrincipal::Subsumes(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(aOther, "The caller is performing a nonsensical security check!");
|
||||
MOZ_ASSERT(aOther);
|
||||
return SubsumesInternal(aOther, aConsideration);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
|
||||
NS_ENSURE_TRUE(aOther, NS_ERROR_INVALID_ARG);
|
||||
*aResult = Subsumes(aOther, DontConsiderDocumentDomain) &&
|
||||
Cast(aOther)->Subsumes(this, DontConsiderDocumentDomain);
|
||||
return NS_OK;
|
||||
@ -92,6 +92,7 @@ BasePrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(aOther, NS_ERROR_INVALID_ARG);
|
||||
*aResult = Subsumes(aOther, ConsiderDocumentDomain) &&
|
||||
Cast(aOther)->Subsumes(this, ConsiderDocumentDomain);
|
||||
return NS_OK;
|
||||
@ -100,6 +101,7 @@ BasePrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(aOther, NS_ERROR_INVALID_ARG);
|
||||
*aResult = Subsumes(aOther, DontConsiderDocumentDomain);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -107,6 +109,7 @@ BasePrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
|
||||
NS_IMETHODIMP
|
||||
BasePrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(aOther, NS_ERROR_INVALID_ARG);
|
||||
*aResult = Subsumes(aOther, ConsiderDocumentDomain);
|
||||
return NS_OK;
|
||||
}
|
||||
|
5
js/xpconnect/tests/unit/test_bug1170311.js
Normal file
5
js/xpconnect/tests/unit/test_bug1170311.js
Normal file
@ -0,0 +1,5 @@
|
||||
const Cu = Components.utils;
|
||||
function run_test() {
|
||||
do_check_throws_nsIException(() => Cu.getObjectPrincipal({}).equals(null), "NS_ERROR_ILLEGAL_VALUE");
|
||||
do_check_throws_nsIException(() => Cu.getObjectPrincipal({}).subsumes(null), "NS_ERROR_ILLEGAL_VALUE");
|
||||
}
|
@ -58,6 +58,7 @@ support-files =
|
||||
[test_bug1150106.js]
|
||||
[test_bug1150771.js]
|
||||
[test_bug1151385.js]
|
||||
[test_bug1170311.js]
|
||||
[test_bug_442086.js]
|
||||
[test_callFunctionWithAsyncStack.js]
|
||||
[test_file.js]
|
||||
|
Loading…
Reference in New Issue
Block a user