2002-02-20 08:51:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-09-25 05:03:58 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 01:52:36 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-20 13:51:02 +04:00
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-08-20 13:51:02 +04:00
|
|
|
*
|
2001-09-25 05:03:58 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-08-20 13:51:02 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 05:03:58 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-25 05:03:58 +04:00
|
|
|
* Contributor(s):
|
2004-04-18 01:52:36 +04:00
|
|
|
* Norris Boyd <nboyd@atg.com>
|
|
|
|
* Mitch Stoltz <mstoltz@netscape.com>
|
|
|
|
* Christopher A. Aillon <christopher@aillon.com>
|
2005-07-20 01:55:36 +04:00
|
|
|
* Giorgio Maone <g.maone@informaction.com>
|
2001-09-25 05:03:58 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 01:52:36 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-25 05:03:58 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 01:52:36 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 05:03:58 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 01:52:36 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 05:03:58 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-02-10 07:56:56 +03:00
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
#ifndef nsScriptSecurityManager_h__
|
|
|
|
#define nsScriptSecurityManager_h__
|
1999-08-20 13:51:02 +04:00
|
|
|
|
|
|
|
#include "nsIScriptSecurityManager.h"
|
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "jsapi.h"
|
2000-04-14 07:14:53 +04:00
|
|
|
#include "jsdbgapi.h"
|
1999-09-07 06:54:19 +04:00
|
|
|
#include "nsIXPCSecurityManager.h"
|
2003-10-22 02:11:49 +04:00
|
|
|
#include "nsInterfaceHashtable.h"
|
1999-11-12 01:10:36 +03:00
|
|
|
#include "nsHashtable.h"
|
2000-01-19 00:54:01 +03:00
|
|
|
#include "nsCOMPtr.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
#include "nsIPrefService.h"
|
2000-07-26 08:53:01 +04:00
|
|
|
#include "nsISecurityPref.h"
|
2005-11-08 23:47:16 +03:00
|
|
|
#include "nsIChannelEventSink.h"
|
2000-08-22 10:02:14 +04:00
|
|
|
#include "nsIJSContextStack.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
#include "nsIObserver.h"
|
2002-02-13 07:20:46 +03:00
|
|
|
#include "pldhash.h"
|
2002-05-15 22:55:21 +04:00
|
|
|
#include "plstr.h"
|
2000-08-22 10:02:14 +04:00
|
|
|
|
2001-03-23 07:22:56 +03:00
|
|
|
class nsIDocShell;
|
2001-04-17 05:21:44 +04:00
|
|
|
class nsString;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
class nsIClassInfo;
|
2003-10-22 02:11:49 +04:00
|
|
|
class nsIIOService;
|
|
|
|
class nsIXPConnect;
|
2003-07-29 09:28:00 +04:00
|
|
|
class nsIStringBundle;
|
2001-08-07 07:59:29 +04:00
|
|
|
class nsSystemPrincipal;
|
2002-02-13 07:20:46 +03:00
|
|
|
struct ClassPolicy;
|
2005-10-21 03:49:59 +04:00
|
|
|
class ClassInfoData;
|
2006-02-24 07:38:46 +03:00
|
|
|
class DomainPolicy;
|
2001-03-23 07:22:56 +03:00
|
|
|
|
2004-07-10 23:38:28 +04:00
|
|
|
#if defined(DEBUG_mstoltz) || defined(DEBUG_caillon)
|
2003-10-22 02:11:49 +04:00
|
|
|
#define DEBUG_CAPS_HACKER
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_CAPS_HACKER
|
|
|
|
#define DEBUG_CAPS_CheckPropertyAccessImpl
|
|
|
|
#define DEBUG_CAPS_LookupPolicy
|
|
|
|
#define DEBUG_CAPS_CheckComponentPermissions
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#define DEBUG_CAPS_CanCreateWrapper
|
|
|
|
#define DEBUG_CAPS_CanCreateInstance
|
|
|
|
#define DEBUG_CAPS_CanGetService
|
2005-07-20 01:55:36 +04:00
|
|
|
#define DEBUG_CAPS_DomainPolicyLifeCycle
|
2003-10-22 02:11:49 +04:00
|
|
|
#endif
|
|
|
|
|
2000-03-21 07:05:35 +03:00
|
|
|
/////////////////////
|
2003-10-22 02:11:49 +04:00
|
|
|
// PrincipalKey //
|
2000-03-21 07:05:35 +03:00
|
|
|
/////////////////////
|
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
class PrincipalKey : public PLDHashEntryHdr
|
2003-07-24 09:15:20 +04:00
|
|
|
{
|
2000-03-21 07:05:35 +03:00
|
|
|
public:
|
2003-10-22 02:11:49 +04:00
|
|
|
typedef const nsIPrincipal* KeyType;
|
|
|
|
typedef const nsIPrincipal* KeyTypePointer;
|
|
|
|
|
|
|
|
PrincipalKey(const nsIPrincipal* key)
|
2007-07-08 11:08:04 +04:00
|
|
|
: mKey(const_cast<nsIPrincipal*>(key))
|
2003-10-22 02:11:49 +04:00
|
|
|
{
|
2000-03-21 07:05:35 +03:00
|
|
|
}
|
2003-10-22 02:11:49 +04:00
|
|
|
|
|
|
|
PrincipalKey(const PrincipalKey& toCopy)
|
|
|
|
: mKey(toCopy.mKey)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~PrincipalKey()
|
|
|
|
{
|
2000-03-21 07:05:35 +03:00
|
|
|
}
|
2003-10-22 02:11:49 +04:00
|
|
|
|
|
|
|
KeyType GetKey() const
|
|
|
|
{
|
|
|
|
return mKey;
|
2003-07-24 09:15:20 +04:00
|
|
|
}
|
2003-10-22 02:11:49 +04:00
|
|
|
|
|
|
|
PRBool KeyEquals(KeyTypePointer aKey) const
|
|
|
|
{
|
2000-03-21 07:05:35 +03:00
|
|
|
PRBool eq;
|
2007-07-08 11:08:04 +04:00
|
|
|
mKey->Equals(const_cast<nsIPrincipal*>(aKey),
|
2003-10-22 02:11:49 +04:00
|
|
|
&eq);
|
2000-03-21 07:05:35 +03:00
|
|
|
return eq;
|
|
|
|
}
|
2003-10-22 02:11:49 +04:00
|
|
|
|
|
|
|
static KeyTypePointer KeyToPointer(KeyType aKey)
|
|
|
|
{
|
|
|
|
return aKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PLDHashNumber HashKey(KeyTypePointer aKey)
|
|
|
|
{
|
|
|
|
PRUint32 hash;
|
2007-07-08 11:08:04 +04:00
|
|
|
const_cast<nsIPrincipal*>(aKey)->GetHashValue(&hash);
|
2003-10-22 02:11:49 +04:00
|
|
|
return PLDHashNumber(hash);
|
2003-07-24 09:15:20 +04:00
|
|
|
}
|
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
enum { ALLOW_MEMMOVE = PR_TRUE };
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIPrincipal> mKey;
|
2000-03-21 07:05:35 +03:00
|
|
|
};
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
////////////////////
|
|
|
|
// Policy Storage //
|
|
|
|
////////////////////
|
|
|
|
|
|
|
|
// Property Policy
|
|
|
|
union SecurityLevel
|
|
|
|
{
|
2009-02-26 20:31:17 +03:00
|
|
|
PRWord level;
|
2002-02-13 07:20:46 +03:00
|
|
|
char* capability;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Security levels
|
|
|
|
// These values all have the low bit set (except UNDEFINED_ACCESS)
|
|
|
|
// to distinguish them from pointer values, because no pointer
|
|
|
|
// to allocated memory ever has the low bit set. A SecurityLevel
|
|
|
|
// contains either one of these constants or a pointer to a string
|
|
|
|
// representing the name of a capability.
|
|
|
|
|
|
|
|
#define SCRIPT_SECURITY_UNDEFINED_ACCESS 0
|
|
|
|
#define SCRIPT_SECURITY_ACCESS_IS_SET_BIT 1
|
|
|
|
#define SCRIPT_SECURITY_NO_ACCESS \
|
|
|
|
((1 << 0) | SCRIPT_SECURITY_ACCESS_IS_SET_BIT)
|
|
|
|
#define SCRIPT_SECURITY_SAME_ORIGIN_ACCESS \
|
|
|
|
((1 << 1) | SCRIPT_SECURITY_ACCESS_IS_SET_BIT)
|
|
|
|
#define SCRIPT_SECURITY_ALL_ACCESS \
|
|
|
|
((1 << 2) | SCRIPT_SECURITY_ACCESS_IS_SET_BIT)
|
|
|
|
|
|
|
|
#define SECURITY_ACCESS_LEVEL_FLAG(_sl) \
|
|
|
|
((_sl.level == 0) || \
|
|
|
|
(_sl.level & SCRIPT_SECURITY_ACCESS_IS_SET_BIT))
|
|
|
|
|
|
|
|
|
|
|
|
struct PropertyPolicy : public PLDHashEntryHdr
|
|
|
|
{
|
|
|
|
jsval key; // property name as jsval
|
|
|
|
SecurityLevel mGet;
|
|
|
|
SecurityLevel mSet;
|
|
|
|
};
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
static PRBool
|
2002-02-13 07:20:46 +03:00
|
|
|
InitPropertyPolicyEntry(PLDHashTable *table,
|
|
|
|
PLDHashEntryHdr *entry,
|
|
|
|
const void *key)
|
|
|
|
{
|
|
|
|
PropertyPolicy* pp = (PropertyPolicy*)entry;
|
|
|
|
pp->key = (jsval)key;
|
|
|
|
pp->mGet.level = SCRIPT_SECURITY_UNDEFINED_ACCESS;
|
|
|
|
pp->mSet.level = SCRIPT_SECURITY_UNDEFINED_ACCESS;
|
2003-08-06 00:09:21 +04:00
|
|
|
return PR_TRUE;
|
2002-02-13 07:20:46 +03:00
|
|
|
}
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
static void
|
2002-02-13 07:20:46 +03:00
|
|
|
ClearPropertyPolicyEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
|
|
|
{
|
|
|
|
PropertyPolicy* pp = (PropertyPolicy*)entry;
|
|
|
|
pp->key = JSVAL_VOID;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Class Policy
|
|
|
|
#define NO_POLICY_FOR_CLASS (ClassPolicy*)1
|
|
|
|
|
|
|
|
struct ClassPolicy : public PLDHashEntryHdr
|
|
|
|
{
|
2003-08-06 00:09:21 +04:00
|
|
|
char* key;
|
2002-03-20 08:53:46 +03:00
|
|
|
PLDHashTable* mPolicy;
|
2006-02-24 07:38:46 +03:00
|
|
|
|
|
|
|
// Note: the DomainPolicy owns us, so if if dies we will too. Hence no
|
|
|
|
// need to refcount it here (and in fact, we'd probably leak if we tried).
|
|
|
|
DomainPolicy* mDomainWeAreWildcardFor;
|
2002-02-13 07:20:46 +03:00
|
|
|
};
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
static void
|
2002-02-13 07:20:46 +03:00
|
|
|
ClearClassPolicyEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
|
|
|
{
|
|
|
|
ClassPolicy* cp = (ClassPolicy *)entry;
|
|
|
|
if (cp->key)
|
|
|
|
{
|
|
|
|
PL_strfree(cp->key);
|
|
|
|
cp->key = nsnull;
|
|
|
|
}
|
2002-03-20 08:53:46 +03:00
|
|
|
PL_DHashTableDestroy(cp->mPolicy);
|
2002-02-13 07:20:46 +03:00
|
|
|
}
|
|
|
|
|
2006-02-24 07:38:46 +03:00
|
|
|
// Note: actual impl is going to be after the DomainPolicy class definition,
|
|
|
|
// since we need to access members of DomainPolicy in the impl
|
2008-10-10 19:04:34 +04:00
|
|
|
static void
|
2006-02-24 07:38:46 +03:00
|
|
|
MoveClassPolicyEntry(PLDHashTable *table,
|
|
|
|
const PLDHashEntryHdr *from,
|
|
|
|
PLDHashEntryHdr *to);
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
static PRBool
|
2002-02-13 07:20:46 +03:00
|
|
|
InitClassPolicyEntry(PLDHashTable *table,
|
|
|
|
PLDHashEntryHdr *entry,
|
|
|
|
const void *key)
|
|
|
|
{
|
|
|
|
static PLDHashTableOps classPolicyOps =
|
|
|
|
{
|
|
|
|
PL_DHashAllocTable,
|
|
|
|
PL_DHashFreeTable,
|
|
|
|
PL_DHashVoidPtrKeyStub,
|
|
|
|
PL_DHashMatchEntryStub,
|
|
|
|
PL_DHashMoveEntryStub,
|
|
|
|
ClearPropertyPolicyEntry,
|
|
|
|
PL_DHashFinalizeStub,
|
|
|
|
InitPropertyPolicyEntry
|
|
|
|
};
|
|
|
|
|
|
|
|
ClassPolicy* cp = (ClassPolicy*)entry;
|
2006-02-24 07:38:46 +03:00
|
|
|
cp->mDomainWeAreWildcardFor = nsnull;
|
2002-02-13 07:20:46 +03:00
|
|
|
cp->key = PL_strdup((const char*)key);
|
2003-08-06 00:09:21 +04:00
|
|
|
if (!cp->key)
|
|
|
|
return PR_FALSE;
|
2002-03-20 08:53:46 +03:00
|
|
|
cp->mPolicy = PL_NewDHashTable(&classPolicyOps, nsnull,
|
2003-08-06 00:09:21 +04:00
|
|
|
sizeof(PropertyPolicy), 16);
|
|
|
|
if (!cp->mPolicy) {
|
|
|
|
PL_strfree(cp->key);
|
|
|
|
cp->key = nsnull;
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
return PR_TRUE;
|
2002-02-13 07:20:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Domain Policy
|
|
|
|
class DomainPolicy : public PLDHashTable
|
|
|
|
{
|
|
|
|
public:
|
2003-06-26 04:18:43 +04:00
|
|
|
DomainPolicy() : mWildcardPolicy(nsnull),
|
|
|
|
mRefCount(0)
|
2002-02-13 07:20:46 +03:00
|
|
|
{
|
2005-06-29 20:29:49 +04:00
|
|
|
mGeneration = sGeneration;
|
|
|
|
|
|
|
|
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
|
|
|
|
++sObjects;
|
|
|
|
_printPopulationInfo();
|
|
|
|
#endif
|
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PRBool Init()
|
|
|
|
{
|
|
|
|
static const PLDHashTableOps domainPolicyOps =
|
2002-02-13 07:20:46 +03:00
|
|
|
{
|
|
|
|
PL_DHashAllocTable,
|
|
|
|
PL_DHashFreeTable,
|
|
|
|
PL_DHashStringKey,
|
2003-08-06 00:09:21 +04:00
|
|
|
PL_DHashMatchStringKey,
|
2006-02-24 07:38:46 +03:00
|
|
|
MoveClassPolicyEntry,
|
2002-02-13 07:20:46 +03:00
|
|
|
ClearClassPolicyEntry,
|
|
|
|
PL_DHashFinalizeStub,
|
|
|
|
InitClassPolicyEntry
|
|
|
|
};
|
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
return PL_DHashTableInit(this, &domainPolicyOps, nsnull,
|
|
|
|
sizeof(ClassPolicy), 16);
|
2002-02-13 07:20:46 +03:00
|
|
|
}
|
|
|
|
|
2002-03-10 03:41:08 +03:00
|
|
|
~DomainPolicy()
|
|
|
|
{
|
|
|
|
PL_DHashTableFinish(this);
|
2005-07-20 01:55:36 +04:00
|
|
|
NS_ASSERTION(mRefCount == 0, "Wrong refcount in DomainPolicy dtor");
|
2005-06-29 20:29:49 +04:00
|
|
|
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
|
2005-07-20 01:55:36 +04:00
|
|
|
printf("DomainPolicy deleted with mRefCount = %d\n", mRefCount);
|
2005-06-29 20:29:49 +04:00
|
|
|
--sObjects;
|
|
|
|
_printPopulationInfo();
|
|
|
|
#endif
|
|
|
|
|
2002-03-10 03:41:08 +03:00
|
|
|
}
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
void Hold()
|
|
|
|
{
|
|
|
|
mRefCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Drop()
|
|
|
|
{
|
|
|
|
if (--mRefCount == 0)
|
|
|
|
delete this;
|
|
|
|
}
|
2005-06-29 20:29:49 +04:00
|
|
|
|
|
|
|
static void InvalidateAll()
|
|
|
|
{
|
|
|
|
sGeneration++;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool IsInvalid()
|
|
|
|
{
|
|
|
|
return mGeneration != sGeneration;
|
|
|
|
}
|
|
|
|
|
2003-06-26 04:18:43 +04:00
|
|
|
ClassPolicy* mWildcardPolicy;
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
private:
|
|
|
|
PRUint32 mRefCount;
|
2005-06-29 20:29:49 +04:00
|
|
|
PRUint32 mGeneration;
|
|
|
|
static PRUint32 sGeneration;
|
|
|
|
|
|
|
|
#ifdef DEBUG_CAPS_DomainPolicyLifeCycle
|
|
|
|
static PRUint32 sObjects;
|
|
|
|
static void _printPopulationInfo();
|
|
|
|
#endif
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
};
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
static void
|
2006-02-24 07:38:46 +03:00
|
|
|
MoveClassPolicyEntry(PLDHashTable *table,
|
|
|
|
const PLDHashEntryHdr *from,
|
|
|
|
PLDHashEntryHdr *to)
|
|
|
|
{
|
|
|
|
memcpy(to, from, table->entrySize);
|
|
|
|
|
|
|
|
// Now update the mDefaultPolicy pointer that points to us, if any.
|
2007-07-08 11:08:04 +04:00
|
|
|
ClassPolicy* cp = static_cast<ClassPolicy*>(to);
|
2006-02-24 07:38:46 +03:00
|
|
|
if (cp->mDomainWeAreWildcardFor) {
|
|
|
|
NS_ASSERTION(cp->mDomainWeAreWildcardFor->mWildcardPolicy ==
|
2007-07-08 11:08:04 +04:00
|
|
|
static_cast<const ClassPolicy*>(from),
|
2006-02-24 07:38:46 +03:00
|
|
|
"Unexpected wildcard policy on mDomainWeAreWildcardFor");
|
|
|
|
cp->mDomainWeAreWildcardFor->mWildcardPolicy = cp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
/////////////////////////////
|
|
|
|
// nsScriptSecurityManager //
|
|
|
|
/////////////////////////////
|
1999-08-20 13:51:02 +04:00
|
|
|
#define NS_SCRIPTSECURITYMANAGER_CID \
|
|
|
|
{ 0x7ee2a4c0, 0x4b93, 0x17d3, \
|
|
|
|
{ 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }}
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
class nsScriptSecurityManager : public nsIScriptSecurityManager,
|
2005-02-06 15:39:31 +03:00
|
|
|
public nsIPrefSecurityCheck,
|
2005-11-08 23:47:16 +03:00
|
|
|
public nsIChannelEventSink,
|
2002-02-13 07:20:46 +03:00
|
|
|
public nsIObserver
|
1999-09-07 06:54:19 +04:00
|
|
|
{
|
1999-08-20 13:51:02 +04:00
|
|
|
public:
|
2002-02-13 07:20:46 +03:00
|
|
|
static void Shutdown();
|
1999-08-30 01:58:42 +04:00
|
|
|
|
|
|
|
NS_DEFINE_STATIC_CID_ACCESSOR(NS_SCRIPTSECURITYMANAGER_CID)
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISCRIPTSECURITYMANAGER
|
1999-09-07 06:54:19 +04:00
|
|
|
NS_DECL_NSIXPCSECURITYMANAGER
|
2005-02-06 15:39:31 +03:00
|
|
|
NS_DECL_NSIPREFSECURITYCHECK
|
2005-11-08 23:47:16 +03:00
|
|
|
NS_DECL_NSICHANNELEVENTSINK
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
2001-04-17 05:21:44 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
static nsScriptSecurityManager*
|
1999-08-30 01:58:42 +04:00
|
|
|
GetScriptSecurityManager();
|
2000-08-22 10:02:14 +04:00
|
|
|
|
2001-08-07 07:59:29 +04:00
|
|
|
static nsSystemPrincipal*
|
|
|
|
SystemPrincipalSingletonConstructor();
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
JSContext* GetCurrentJSContext();
|
|
|
|
|
|
|
|
JSContext* GetSafeJSContext();
|
2001-04-17 05:21:44 +04:00
|
|
|
|
2008-02-27 06:45:29 +03:00
|
|
|
/**
|
|
|
|
* Utility method for comparing two URIs. For security purposes, two URIs
|
|
|
|
* are equivalent if their schemes, hosts, and ports (if any) match. This
|
|
|
|
* method returns true if aSubjectURI and aObjectURI have the same origin,
|
|
|
|
* false otherwise.
|
|
|
|
*/
|
|
|
|
static PRBool SecurityCompareURIs(nsIURI* aSourceURI, nsIURI* aTargetURI);
|
2008-10-08 17:16:27 +04:00
|
|
|
static PRUint32 SecurityHashURI(nsIURI* aURI);
|
2008-02-27 06:45:29 +03:00
|
|
|
|
|
|
|
static nsresult
|
|
|
|
ReportError(JSContext* cx, const nsAString& messageTag,
|
|
|
|
nsIURI* aSource, nsIURI* aTarget);
|
2008-10-08 17:16:27 +04:00
|
|
|
|
2008-03-19 00:14:49 +03:00
|
|
|
static nsresult
|
|
|
|
CheckSameOriginPrincipal(nsIPrincipal* aSubject,
|
2010-02-02 13:29:15 +03:00
|
|
|
nsIPrincipal* aObject);
|
2008-10-08 17:16:27 +04:00
|
|
|
static PRUint32
|
|
|
|
HashPrincipalByOrigin(nsIPrincipal* aPrincipal);
|
2008-03-22 19:50:47 +03:00
|
|
|
|
|
|
|
static PRBool
|
|
|
|
GetStrictFileOriginPolicy()
|
|
|
|
{
|
|
|
|
return sStrictFileOriginPolicy;
|
|
|
|
}
|
|
|
|
|
1999-08-20 13:51:02 +04:00
|
|
|
private:
|
2000-01-19 00:54:01 +03:00
|
|
|
|
2003-01-17 05:00:01 +03:00
|
|
|
// GetScriptSecurityManager is the only call that can make one
|
|
|
|
nsScriptSecurityManager();
|
|
|
|
virtual ~nsScriptSecurityManager();
|
|
|
|
|
2008-09-07 02:21:43 +04:00
|
|
|
static JSBool
|
2003-03-06 22:40:14 +03:00
|
|
|
CheckObjectAccess(JSContext *cx, JSObject *obj,
|
|
|
|
jsval id, JSAccessMode mode,
|
|
|
|
jsval *vp);
|
2002-02-13 07:20:46 +03:00
|
|
|
|
2010-03-08 11:24:50 +03:00
|
|
|
// Decides, based on CSP, whether or not eval() and stuff can be executed.
|
|
|
|
static JSBool
|
|
|
|
ContentSecurityPolicyPermitsJSAction(JSContext *cx);
|
|
|
|
|
2005-04-11 03:27:07 +04:00
|
|
|
// Returns null if a principal cannot be found; generally callers
|
|
|
|
// should error out at that point.
|
|
|
|
static nsIPrincipal*
|
2008-01-29 23:51:01 +03:00
|
|
|
doGetObjectPrincipal(JSObject *obj
|
2007-12-13 02:02:25 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
, PRBool aAllowShortCircuit = PR_TRUE
|
|
|
|
#endif
|
|
|
|
);
|
2005-04-11 03:27:07 +04:00
|
|
|
|
|
|
|
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
|
|
|
// when this happens -- this means that there was no JS running.
|
|
|
|
nsIPrincipal*
|
|
|
|
doGetSubjectPrincipal(nsresult* rv);
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2002-02-13 07:20:46 +03:00
|
|
|
CheckPropertyAccessImpl(PRUint32 aAction,
|
2008-01-15 18:50:57 +03:00
|
|
|
nsAXPCNativeCallContext* aCallContext,
|
2002-02-13 07:20:46 +03:00
|
|
|
JSContext* cx, JSObject* aJSObject,
|
2008-04-18 21:35:55 +04:00
|
|
|
nsISupports* aObj, nsIURI* aTargetURI,
|
2001-05-19 04:33:51 +04:00
|
|
|
nsIClassInfo* aClassInfo,
|
2002-02-13 07:20:46 +03:00
|
|
|
const char* aClassName, jsval aProperty,
|
|
|
|
void** aCachedClassPolicy);
|
1999-08-30 01:58:42 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2002-06-15 03:54:18 +04:00
|
|
|
CheckSameOriginDOMProp(nsIPrincipal* aSubject,
|
|
|
|
nsIPrincipal* aObject,
|
2010-02-02 13:29:15 +03:00
|
|
|
PRUint32 aAction);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
nsresult
|
2003-06-26 04:18:43 +04:00
|
|
|
LookupPolicy(nsIPrincipal* principal,
|
2005-10-21 03:49:59 +04:00
|
|
|
ClassInfoData& aClassData, jsval aProperty,
|
2003-06-26 04:18:43 +04:00
|
|
|
PRUint32 aAction,
|
|
|
|
ClassPolicy** aCachedClassPolicy,
|
|
|
|
SecurityLevel* result);
|
1999-08-30 01:58:42 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
CreateCodebasePrincipal(nsIURI* aURI, nsIPrincipal** result);
|
|
|
|
|
2005-07-22 23:05:42 +04:00
|
|
|
// This is just like the API method, but it doesn't check that the subject
|
2005-07-23 00:49:12 +04:00
|
|
|
// name is non-empty or aCertificate is non-null, and it doesn't change the
|
2005-07-22 23:05:42 +04:00
|
|
|
// certificate in the table (if any) in any way if aModifyTable is false.
|
|
|
|
nsresult
|
|
|
|
DoGetCertificatePrincipal(const nsACString& aCertFingerprint,
|
|
|
|
const nsACString& aSubjectName,
|
|
|
|
const nsACString& aPrettyName,
|
|
|
|
nsISupports* aCertificate,
|
|
|
|
nsIURI* aURI,
|
|
|
|
PRBool aModifyTable,
|
|
|
|
nsIPrincipal **result);
|
|
|
|
|
2005-04-11 03:27:07 +04:00
|
|
|
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
|
|
|
// when this happens -- this means that there was no script for the
|
|
|
|
// context. Callers MUST pass in a non-null rv here.
|
2009-08-22 05:20:20 +04:00
|
|
|
nsIPrincipal*
|
2005-04-11 03:27:07 +04:00
|
|
|
GetSubjectPrincipal(JSContext* cx, nsresult* rv);
|
|
|
|
|
|
|
|
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
|
|
|
// when this happens -- this means that there was no script for the frame.
|
|
|
|
// Callers MUST pass in a non-null rv here.
|
2009-08-22 05:20:20 +04:00
|
|
|
nsIPrincipal*
|
2005-04-11 03:27:07 +04:00
|
|
|
GetFramePrincipal(JSContext* cx, JSStackFrame* fp, nsresult* rv);
|
2009-08-22 05:20:20 +04:00
|
|
|
|
2005-04-11 03:27:07 +04:00
|
|
|
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
|
|
|
// when this happens -- this means that there was no script. Callers MUST
|
|
|
|
// pass in a non-null rv here.
|
|
|
|
static nsIPrincipal*
|
|
|
|
GetScriptPrincipal(JSContext* cx, JSScript* script, nsresult* rv);
|
|
|
|
|
|
|
|
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
|
|
|
// when this happens -- this means that there was no script associated
|
2005-05-04 10:28:36 +04:00
|
|
|
// with the function object, and no global object associated with the scope
|
|
|
|
// of obj (the last object on its parent chain). If the caller is walking
|
|
|
|
// the JS stack, fp must point to the current frame in the stack iteration.
|
|
|
|
// Callers MUST pass in a non-null rv here.
|
2005-04-11 03:27:07 +04:00
|
|
|
static nsIPrincipal*
|
2005-05-04 10:28:36 +04:00
|
|
|
GetFunctionObjectPrincipal(JSContext* cx, JSObject* obj, JSStackFrame *fp,
|
|
|
|
nsresult* rv);
|
2005-04-11 03:27:07 +04:00
|
|
|
|
|
|
|
// Returns null if a principal cannot be found. Note that rv can be NS_OK
|
|
|
|
// when this happens -- this means that there was no script
|
|
|
|
// running. Callers MUST pass in a non-null rv here.
|
2009-08-22 05:20:20 +04:00
|
|
|
nsIPrincipal*
|
2001-05-11 04:43:27 +04:00
|
|
|
GetPrincipalAndFrame(JSContext *cx,
|
2005-04-11 03:27:07 +04:00
|
|
|
JSStackFrame** frameResult,
|
|
|
|
nsresult* rv);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-03-20 08:53:46 +03:00
|
|
|
static PRBool
|
2003-07-29 09:28:00 +04:00
|
|
|
CheckConfirmDialog(JSContext* cx, nsIPrincipal* aPrincipal,
|
|
|
|
const char* aCapability, PRBool *checkValue);
|
2002-03-20 08:53:46 +03:00
|
|
|
|
2004-09-01 11:53:32 +04:00
|
|
|
static void
|
|
|
|
FormatCapabilityString(nsAString& aCapability);
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2000-04-26 07:50:07 +04:00
|
|
|
SavePrincipal(nsIPrincipal* aToSave);
|
|
|
|
|
2009-05-14 02:01:01 +04:00
|
|
|
/**
|
|
|
|
* Check capability levels for an |aObj| that implements
|
|
|
|
* nsISecurityCheckedComponent.
|
|
|
|
*
|
|
|
|
* NB: This function also checks to see if aObj is a plugin and the user
|
|
|
|
* has set the "security.xpconnect.plugin.unrestricted" pref to allow
|
|
|
|
* anybody to script plugin objects from anywhere.
|
|
|
|
*
|
2009-08-07 07:26:33 +04:00
|
|
|
* @param cx The context we're running on.
|
|
|
|
* NB: If null, "sameOrigin" does not have any effect.
|
2009-05-14 02:01:01 +04:00
|
|
|
* @param aObj The nsISupports representation of the object in question
|
|
|
|
* object, possibly null.
|
2009-08-07 07:26:33 +04:00
|
|
|
* @param aJSObject The JSObject representation of the object in question
|
|
|
|
* if |cx| is non-null and |aObjectSecurityLevel| is
|
|
|
|
* "sameOrigin". If null will be calculated from aObj (if
|
|
|
|
* non-null) if and only if aObj is an XPCWrappedJS. The
|
|
|
|
* rationale behind this is that if we're creating a JS
|
|
|
|
* wrapper for an XPCWrappedJS, this object definitely
|
|
|
|
* expects to be exposed to JS.
|
2009-05-14 02:01:01 +04:00
|
|
|
* @param aSubjectPrincipal The nominal subject principal used when
|
2009-08-07 07:26:33 +04:00
|
|
|
* aObjectSecurityLevel is "sameOrigin". If null,
|
|
|
|
* this is calculated if it's needed.
|
2009-05-14 02:01:01 +04:00
|
|
|
* @param aObjectSecurityLevel Can be one of three values:
|
|
|
|
* - allAccess: Allow access no matter what.
|
|
|
|
* - noAccess: Deny access no matter what.
|
2009-08-07 07:26:33 +04:00
|
|
|
* - sameOrigin: If |cx| is null, behave like noAccess.
|
|
|
|
* Otherwise, possibly compute a subject
|
|
|
|
* and object principal and return true if
|
|
|
|
* and only if the subject has greater than
|
|
|
|
* or equal privileges to the object.
|
2009-05-14 02:01:01 +04:00
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2009-08-07 07:26:33 +04:00
|
|
|
CheckXPCPermissions(JSContext* cx,
|
|
|
|
nsISupports* aObj, JSObject* aJSObject,
|
2009-05-14 02:01:01 +04:00
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
2001-08-14 04:18:58 +04:00
|
|
|
const char* aObjectSecurityLevel);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2003-01-17 05:00:01 +03:00
|
|
|
nsresult
|
|
|
|
Init();
|
2009-05-14 02:01:01 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
InitPrefs();
|
2000-11-30 08:32:08 +03:00
|
|
|
|
2000-05-16 07:40:51 +04:00
|
|
|
static nsresult
|
2005-07-22 23:05:42 +04:00
|
|
|
GetPrincipalPrefNames(const char* prefBase,
|
|
|
|
nsCString& grantedPref,
|
|
|
|
nsCString& deniedPref,
|
|
|
|
nsCString& subjectNamePref);
|
2000-05-16 07:40:51 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2002-02-13 07:20:46 +03:00
|
|
|
InitPolicies();
|
|
|
|
|
|
|
|
nsresult
|
2002-03-20 08:53:46 +03:00
|
|
|
InitDomainPolicy(JSContext* cx, const char* aPolicyName,
|
2002-02-13 07:20:46 +03:00
|
|
|
DomainPolicy* aDomainPolicy);
|
1999-11-25 08:28:18 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2001-08-03 00:32:48 +04:00
|
|
|
InitPrincipals(PRUint32 prefCount, const char** prefNames,
|
|
|
|
nsISecurityPref* securityPref);
|
2000-01-19 00:54:01 +03:00
|
|
|
|
2006-11-15 01:46:45 +03:00
|
|
|
|
2003-03-12 05:17:37 +03:00
|
|
|
#ifdef XPC_IDISPATCH_SUPPORT
|
|
|
|
// While this header is included outside of caps, this class isn't
|
|
|
|
// referenced so this should be fine.
|
|
|
|
nsresult
|
|
|
|
CheckComponentPermissions(JSContext *cx, const nsCID &aCID);
|
|
|
|
#endif
|
2003-10-22 02:11:49 +04:00
|
|
|
#ifdef DEBUG_CAPS_HACKER
|
2002-02-13 07:20:46 +03:00
|
|
|
void
|
|
|
|
PrintPolicyDB();
|
|
|
|
#endif
|
|
|
|
|
2009-08-22 05:20:20 +04:00
|
|
|
struct ContextPrincipal {
|
|
|
|
ContextPrincipal(ContextPrincipal *next, JSContext *cx,
|
|
|
|
JSStackFrame *fp, nsIPrincipal *principal)
|
|
|
|
: mNext(next), mCx(cx), mFp(fp), mPrincipal(principal) {}
|
|
|
|
|
|
|
|
ContextPrincipal *mNext;
|
|
|
|
JSContext *mCx;
|
|
|
|
JSStackFrame *mFp;
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
};
|
|
|
|
|
2002-02-13 07:20:46 +03:00
|
|
|
// JS strings we need to clean up on shutdown
|
|
|
|
static jsval sEnabledID;
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
inline void
|
2007-09-06 11:02:57 +04:00
|
|
|
ScriptSecurityPrefChanged();
|
2000-01-06 03:59:18 +03:00
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
static const char sJSEnabledPrefName[];
|
2007-09-06 11:02:57 +04:00
|
|
|
static const char sFileOriginPolicyPrefName[];
|
2000-02-10 07:56:56 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsObjectHashtable* mOriginToPolicyMap;
|
2002-02-13 07:20:46 +03:00
|
|
|
DomainPolicy* mDefaultPolicy;
|
|
|
|
nsObjectHashtable* mCapabilities;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrefBranch> mPrefBranch;
|
|
|
|
nsCOMPtr<nsISecurityPref> mSecurityPref;
|
2003-10-22 02:11:49 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mSystemPrincipal;
|
2000-04-26 07:50:07 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mSystemCertificate;
|
2009-08-22 05:20:20 +04:00
|
|
|
ContextPrincipal *mContextPrincipals;
|
2003-10-22 02:11:49 +04:00
|
|
|
nsInterfaceHashtable<PrincipalKey, nsIPrincipal> mPrincipals;
|
|
|
|
PRPackedBool mIsJavaScriptEnabled;
|
|
|
|
PRPackedBool mIsWritingPrefs;
|
|
|
|
PRPackedBool mPolicyPrefsChanged;
|
2003-03-12 05:17:37 +03:00
|
|
|
#ifdef XPC_IDISPATCH_SUPPORT
|
2003-10-22 02:11:49 +04:00
|
|
|
PRPackedBool mXPCDefaultGrantAll;
|
|
|
|
static const char sXPCDefaultGrantAllName[];
|
2003-03-12 05:17:37 +03:00
|
|
|
#endif
|
2008-02-27 06:45:29 +03:00
|
|
|
|
2008-03-21 07:39:08 +03:00
|
|
|
static PRBool sStrictFileOriginPolicy;
|
2008-02-27 06:45:32 +03:00
|
|
|
|
2003-10-22 02:11:49 +04:00
|
|
|
static nsIIOService *sIOService;
|
|
|
|
static nsIXPConnect *sXPConnect;
|
2008-10-14 18:16:25 +04:00
|
|
|
static nsIThreadJSContextStack* sJSContextStack;
|
2003-07-29 09:28:00 +04:00
|
|
|
static nsIStringBundle *sStrBundle;
|
2005-06-08 01:57:56 +04:00
|
|
|
static JSRuntime *sRuntime;
|
2003-07-24 09:15:20 +04:00
|
|
|
};
|
2003-10-22 02:11:49 +04:00
|
|
|
|
|
|
|
#endif // nsScriptSecurityManager_h__
|