Bug 994872 - Remove documentPrincipal from nsIContentSecurityPolicy::SetRequestContext. (r=ckerschb)

This commit is contained in:
Sid Stamm 2014-07-30 14:37:22 -07:00
parent 407401e416
commit 2252bd6c38
7 changed files with 7 additions and 11 deletions

View File

@ -530,10 +530,10 @@ nsPrincipal::Read(nsIObjectInputStream* aStream)
rv = SetCsp(csp);
NS_ENSURE_SUCCESS(rv, rv);
// need to link in the CSP context here (link in a reference to this
// nsIPrincipal and to the URI of the protected resource).
// need to link in the CSP context here (link in the URI of the protected
// resource).
if (csp) {
csp->SetRequestContext(codebase, nullptr, this, nullptr);
csp->SetRequestContext(codebase, nullptr, nullptr);
}
SetDomain(domain);

View File

@ -17,7 +17,7 @@ interface nsIPrincipal;
* one of these per document/principal.
*/
[scriptable, uuid(3e923bf6-a974-4f3b-91c4-b4fd48b37732)]
[scriptable, uuid(6d5d07e5-4ff1-48cc-aeaa-a7ffc979e854)]
interface nsIContentSecurityPolicy : nsISerializable
{
@ -188,7 +188,6 @@ interface nsIContentSecurityPolicy : nsISerializable
*/
void setRequestContext(in nsIURI selfURI,
in nsIURI referrer,
in nsIPrincipal documentPrincipal,
in nsIChannel aChannel);
/**

View File

@ -25,7 +25,6 @@
#include "nsIObjectOutputStream.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIPrincipal.h"
#include "nsIPropertyBag2.h"
#include "nsIStringStream.h"
#include "nsIUploadChannel.h"
@ -547,7 +546,6 @@ getInnerWindowID(nsIRequest* aRequest) {
NS_IMETHODIMP
nsCSPContext::SetRequestContext(nsIURI* aSelfURI,
nsIURI* aReferrer,
nsIPrincipal* aDocumentPrincipal,
nsIChannel* aChannel)
{
NS_PRECONDITION(aSelfURI || aChannel, "Need aSelfURI or aChannel to set the context properly");

View File

@ -2778,7 +2778,7 @@ nsDocument::InitCSP(nsIChannel* aChannel)
aChannel->GetURI(getter_AddRefs(selfURI));
// Store the request context for violation reports
csp->SetRequestContext(nullptr, nullptr, nullptr, aChannel);
csp->SetRequestContext(nullptr, nullptr, aChannel);
// ----- if the doc is an app and we want a default CSP, apply it.
if (applyAppDefaultCSP) {

View File

@ -108,7 +108,6 @@ nsresult runTest(uint32_t aExpectedPolicyCount, // this should be 0 for policies
// arguments can be nullptrs.
csp->SetRequestContext(selfURI,
nullptr, // nsIURI* aReferrer
nullptr, // nsIPrincipal* aDocumentPrincipal
dummyChannel);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -44,7 +44,7 @@
let appchan = SpecialPowers.Services.io.newChannel(gManifestURL, null, null);
try {
csp.setRequestContext(null, null, null, appchan);
csp.setRequestContext(null, null, appchan);
ok(true, "setRequestContext hasn't thown");
} catch(e) {
ok(false, "setRequestContext throws");

View File

@ -75,7 +75,7 @@ function makeTest(id, expectedJSON, useReportOnlyPolicy, callback) {
dump("Created test " + id + " : " + policy + "\n\n");
// make the reports seem authentic by "binding" them to a channel.
csp.setRequestContext(selfuri, null, null, selfchan);
csp.setRequestContext(selfuri, null, selfchan);
// Load up the policy
// set as report-only if that's the case