зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1297687 - Part 1: Remove nsIScriptSecurityManager.createExpandedPrincipal(); r=bholley
This commit is contained in:
Родитель
48aef09e25
Коммит
6b65aceec2
|
@ -200,20 +200,6 @@ interface nsIScriptSecurityManager : nsISupports
|
|||
[implicit_jscontext]
|
||||
nsIPrincipal createNullPrincipal(in jsval originAttributes);
|
||||
|
||||
/**
|
||||
* Creates an expanded principal whose capabilities are the union of the
|
||||
* given principals. An expanded principal has an asymmetric privilege
|
||||
* relationship with its sub-principals (that is to say, it subsumes the
|
||||
* sub-principals, but the sub-principals do not subsume it), even if
|
||||
* there's only one. This presents a legitimate use-case for making an
|
||||
* expanded principal around a single sub-principal, which we do frequently.
|
||||
*
|
||||
* Expanded principals cannot have origin attributes themselves, but rather
|
||||
* have them through their sub-principals - so we don't accept them here.
|
||||
*/
|
||||
nsIPrincipal createExpandedPrincipal([array, size_is(aLength)] in nsIPrincipal aPrincipalArray,
|
||||
[optional] in unsigned long aLength);
|
||||
|
||||
/**
|
||||
* Returns OK if aSourceURI and target have the same "origin"
|
||||
* (scheme, host, and port).
|
||||
|
|
|
@ -1181,21 +1181,6 @@ nsScriptSecurityManager::CreateNullPrincipal(JS::Handle<JS::Value> aOriginAttrib
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::CreateExpandedPrincipal(nsIPrincipal** aPrincipalArray, uint32_t aLength,
|
||||
nsIPrincipal** aResult)
|
||||
{
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>> principals;
|
||||
principals.SetCapacity(aLength);
|
||||
for (uint32_t i = 0; i < aLength; ++i) {
|
||||
principals.AppendElement(aPrincipalArray[i]);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> p = new nsExpandedPrincipal(principals);
|
||||
p.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::GetAppCodebasePrincipal(nsIURI* aURI,
|
||||
uint32_t aAppId,
|
||||
|
|
|
@ -80,7 +80,7 @@ function run_test() {
|
|||
var ipv6NPPrin = ssm.createCodebasePrincipal(makeURI('https://[2001:db8::ff00:42:8329]'), {});
|
||||
do_check_eq(ipv6NPPrin.origin, 'https://[2001:db8::ff00:42:8329]');
|
||||
checkOriginAttributes(ipv6NPPrin);
|
||||
var ep = ssm.createExpandedPrincipal([exampleCom, nullPrin, exampleOrg]);
|
||||
var ep = Cu.getObjectPrincipal(Cu.Sandbox([exampleCom, nullPrin, exampleOrg]));
|
||||
checkOriginAttributes(ep);
|
||||
checkCrossOrigin(exampleCom, exampleOrg);
|
||||
checkCrossOrigin(exampleOrg, nullPrin);
|
||||
|
@ -204,7 +204,7 @@ function run_test() {
|
|||
}
|
||||
checkKind(ssm.createNullPrincipal({}), 'nullPrincipal');
|
||||
checkKind(ssm.createCodebasePrincipal(makeURI('http://www.example.com'), {}), 'codebasePrincipal');
|
||||
checkKind(ssm.createExpandedPrincipal([ssm.createCodebasePrincipal(makeURI('http://www.example.com'), {})]), 'expandedPrincipal');
|
||||
checkKind(Cu.getObjectPrincipal(Cu.Sandbox([ssm.createCodebasePrincipal(makeURI('http://www.example.com'), {})])), 'expandedPrincipal');
|
||||
checkKind(ssm.getSystemPrincipal(), 'systemPrincipal');
|
||||
|
||||
//
|
||||
|
|
|
@ -170,7 +170,7 @@ add_task(function* test_stringify_inaccessible() {
|
|||
|
||||
add_task(function* test_stringify_accessible() {
|
||||
// Test that an accessible property from another global is included
|
||||
let principal = ssm.createExpandedPrincipal([PRINCIPAL1, PRINCIPAL2]);
|
||||
let principal = Cu.getObjectPrincipal(Cu.Sandbox([PRINCIPAL1, PRINCIPAL2]));
|
||||
let context = new Context(principal);
|
||||
let sandbox = context.sandbox;
|
||||
let sandbox2 = Cu.Sandbox(PRINCIPAL2);
|
||||
|
|
Загрузка…
Ссылка в новой задаче