2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-01-23 00:38:21 +03:00
|
|
|
|
2014-04-01 20:35:22 +04:00
|
|
|
#ifndef nsCSPService_h___
|
|
|
|
#define nsCSPService_h___
|
|
|
|
|
2010-01-23 00:38:21 +03:00
|
|
|
#include "nsXPCOM.h"
|
|
|
|
#include "nsIContentPolicy.h"
|
2010-04-23 21:03:03 +04:00
|
|
|
#include "nsIChannel.h"
|
|
|
|
#include "nsIChannelEventSink.h"
|
2014-06-20 06:01:40 +04:00
|
|
|
#include "nsDataHashtable.h"
|
2010-01-23 00:38:21 +03:00
|
|
|
|
|
|
|
#define CSPSERVICE_CONTRACTID "@mozilla.org/cspservice;1"
|
|
|
|
#define CSPSERVICE_CID \
|
2018-11-30 13:46:48 +03:00
|
|
|
{ \
|
2010-01-23 00:38:21 +03:00
|
|
|
0x8d2f40b2, 0x4875, 0x4c95, { \
|
|
|
|
0x97, 0xd9, 0x3f, 0x7d, 0xca, 0x2c, 0xb4, 0x60 \
|
|
|
|
} \
|
|
|
|
}
|
2010-04-23 21:03:03 +04:00
|
|
|
class CSPService : public nsIContentPolicy, public nsIChannelEventSink {
|
2010-01-23 00:38:21 +03:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTENTPOLICY
|
2010-04-23 21:03:03 +04:00
|
|
|
NS_DECL_NSICHANNELEVENTSINK
|
2010-07-13 07:12:32 +04:00
|
|
|
|
2010-01-23 00:38:21 +03:00
|
|
|
CSPService();
|
2014-06-25 06:09:15 +04:00
|
|
|
|
2019-06-03 09:04:25 +03:00
|
|
|
// helper function to avoid creating a new instance of the
|
|
|
|
// cspservice everytime we call content policies.
|
|
|
|
static nsresult ConsultCSP(nsIURI* aContentLocation, nsILoadInfo* aLoadInfo,
|
|
|
|
const nsACString& aMimeTypeGuess,
|
|
|
|
int16_t* aDecision);
|
|
|
|
|
2019-08-06 10:41:42 +03:00
|
|
|
static nsresult ConsultCSPForRedirect(nsIURI* aOriginalURI, nsIURI* aNewURI,
|
|
|
|
nsILoadInfo* aLoadInfo,
|
|
|
|
int16_t* aDecision);
|
|
|
|
|
2014-06-25 06:09:15 +04:00
|
|
|
protected:
|
|
|
|
virtual ~CSPService();
|
2010-01-23 00:38:21 +03:00
|
|
|
};
|
2014-04-01 20:35:22 +04:00
|
|
|
#endif /* nsCSPService_h___ */
|