mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
3dafb8d491
- Bug 1162293 - Part 1: Remove instances of #ifdef PR_LOGGING. r=froydnj (20456f454)
- Bug 1162293 - Part 2: Fix string leak in logging code. r=froydnj (2b7552940)
- Bug 1162748 - Remove instances of #ifdef PR_LOGGING in graphics. r=froydnj (1ec0e8140)
- Bug 1156632 - Remove unused forward class declarations - patch 1 - dom/base, r=ehsan (eba98c427)
- Bug 1149420 - Make the IndexedDB permissions prompt work in e10s. r=bent/mfinkle (fc977c048)
- Bug 1156632 - Remove unused forward class declarations - patch 2 - dom/media, dom/indexedDB, dom/svg, r=ehsan (011caf393)
- Bug 1156632 - Remove unused forward class declarations - patch 3 - dom/{events,xbl,xslt,xul} and others, r=ehsan (72051c70b)
- Bug 1148005; Update WebVR APIs based on latest spec changes; r=baku (15b0a712f)
- Bug 1156632 - Remove unused forward class declarations - patch 4 - netwerk image and dom, r=ehsan (5ee4f1679)
- Bug 1139972 - IPC Proxy for charAt, r=tbsaunde (95d3626ec)
- Bug 1139887 - IPC Proxy for caretOffset, r=tbsaunde (c44893cd5)
- Bug 1141228 - include GfxMessageUtils.h in PDocAccessible.ipdl, r=tbsaunde (773e741f9)
- goannaCoordType -> geckoCoordType (b6ede7903)
- Bug 1145292 - IPC Proxy for ImageAccessible, r=tbsaunde (ca37ce753)
- bug 1128751 - handle unbinding and rebinding of documents in content processes r=davidb (0ad3331ab)
- Bug 1145366 - IPC Proxy for HyperLink, r=tbsaunde (87bc696f5)
- Bug 1146615 - IPC Proxy for HyperText, r=tbsaunde (de5322207)
- Bug 1146665 - IPC Proxy for TableCell, r=tbsaunde (895e24eee)
- Bug 1147079 - IPC Proxy for Table, r=tbsaunde (6e54178fe)
- Bug 1147168 - IPC Proxy for Selection, r=tbsaunde (40b8fa16e)
- Bug 1147518 - IPC Proxy for Action, r=davidb (12d5a235f)
- Bug 1147551 - IPC Proxy for min/cur/max values, r=davidb (3728abc54)
- Bug 1148025 - IPC Proxy for 'Component', r=tbsaunde (38bea1f4a)
- Bug 1148083 - IPC Proxy for Document, r=davidb (a7d53936d)
- Bug 1132854 - Make nsIntSize a typedef of gfx::IntSize. r=Bas, roc (09d0ae0d9)
- goannaRole -> geckoRole (421bdcd36)
- bug 1138436 - start on proxying IAccessible2 r=surkov, r=davidb (b2be8ba44)
- bug 1151402 - proxy most of IAccessibleText and IAccessibleEditableText r=davidb (dff7da028)
- Bug 1162740 - Part 1: Remove instances of #ifdef PR_LOGGING in rdf. r=froydnj (e398edb14)
- Bug 1162740 - Part 2: Wrap expensive calls in PR_LOG_TEST. r=froydnj (d873be4f4)
- Bug 1067054 - Remove generic SQLITE_ERROR warning & suppress warning if transaction exists. r=mak (cdc03b034)
- Bug 1137287 - Part 1: Shift some code from InterceptedChannelContent to HttpChannelChild. r=mayhemer (6141690a1)
- Bug 1136969 - Add a check that OnStartRequest is called just once during the lifetime of a channel. r=mcmanus (3b6aa0560)
- Bug 1053650 - Part 1: Add attribute 'networkInterfaceId' to XMLHttpRequest. r=bz Bug 1053650 - Part 2: Populate networkInterfaceId to SocketTransport r=mcmanus Bug 1053650 - Part 3: Make use of gonk-specific per-interface DNS lookup. r=mcmanus Bug 1053650 follow-up: Mark GetNetworkInterfaceId/SetNetworkInterfaceId as override (e308fc405)
165 lines
4.8 KiB
C++
165 lines
4.8 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* vim: set ts=4 et sw=4 tw=80: */
|
|
/* 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/. */
|
|
|
|
#ifndef nsScriptSecurityManager_h__
|
|
#define nsScriptSecurityManager_h__
|
|
|
|
#include "nsIScriptSecurityManager.h"
|
|
#include "nsIPrincipal.h"
|
|
#include "nsCOMPtr.h"
|
|
#include "nsIChannelEventSink.h"
|
|
#include "nsIObserver.h"
|
|
#include "plstr.h"
|
|
#include "js/TypeDecls.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
class nsCString;
|
|
class nsIIOService;
|
|
class nsIStringBundle;
|
|
class nsSystemPrincipal;
|
|
|
|
/////////////////////////////
|
|
// nsScriptSecurityManager //
|
|
/////////////////////////////
|
|
#define NS_SCRIPTSECURITYMANAGER_CID \
|
|
{ 0x7ee2a4c0, 0x4b93, 0x17d3, \
|
|
{ 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }}
|
|
|
|
class nsScriptSecurityManager final : public nsIScriptSecurityManager,
|
|
public nsIChannelEventSink,
|
|
public nsIObserver
|
|
{
|
|
public:
|
|
static void Shutdown();
|
|
|
|
NS_DEFINE_STATIC_CID_ACCESSOR(NS_SCRIPTSECURITYMANAGER_CID)
|
|
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSISCRIPTSECURITYMANAGER
|
|
NS_DECL_NSICHANNELEVENTSINK
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
static nsScriptSecurityManager*
|
|
GetScriptSecurityManager();
|
|
|
|
// Invoked exactly once, by XPConnect.
|
|
static void InitStatics();
|
|
|
|
static nsSystemPrincipal*
|
|
SystemPrincipalSingletonConstructor();
|
|
|
|
JSContext* GetCurrentJSContext();
|
|
|
|
JSContext* GetSafeJSContext();
|
|
|
|
/**
|
|
* 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 bool SecurityCompareURIs(nsIURI* aSourceURI, nsIURI* aTargetURI);
|
|
static uint32_t SecurityHashURI(nsIURI* aURI);
|
|
|
|
static uint16_t AppStatusForPrincipal(nsIPrincipal *aPrin);
|
|
|
|
static nsresult
|
|
ReportError(JSContext* cx, const nsAString& messageTag,
|
|
nsIURI* aSource, nsIURI* aTarget);
|
|
|
|
static uint32_t
|
|
HashPrincipalByOrigin(nsIPrincipal* aPrincipal);
|
|
|
|
static bool
|
|
GetStrictFileOriginPolicy()
|
|
{
|
|
return sStrictFileOriginPolicy;
|
|
}
|
|
|
|
/**
|
|
* Returns true if the two principals share the same app attributes.
|
|
*
|
|
* App attributes are appId and the inBrowserElement flag.
|
|
* Two principals have the same app attributes if those information are
|
|
* equals.
|
|
* This method helps keeping principals from different apps isolated from
|
|
* each other. Also, it helps making sure mozbrowser (web views) and their
|
|
* parent are isolated from each other. All those entities do not share the
|
|
* same data (cookies, IndexedDB, localStorage, etc.) so we shouldn't allow
|
|
* violating that principle.
|
|
*/
|
|
static bool
|
|
AppAttributesEqual(nsIPrincipal* aFirst,
|
|
nsIPrincipal* aSecond);
|
|
|
|
void DeactivateDomainPolicy();
|
|
|
|
private:
|
|
|
|
// GetScriptSecurityManager is the only call that can make one
|
|
nsScriptSecurityManager();
|
|
virtual ~nsScriptSecurityManager();
|
|
|
|
// Decides, based on CSP, whether or not eval() and stuff can be executed.
|
|
static bool
|
|
ContentSecurityPolicyPermitsJSAction(JSContext *cx);
|
|
|
|
static bool
|
|
JSPrincipalsSubsume(JSPrincipals *first, JSPrincipals *second);
|
|
|
|
// Returns null if a principal cannot be found; generally callers
|
|
// should error out at that point.
|
|
static nsIPrincipal* doGetObjectPrincipal(JSObject* obj);
|
|
|
|
nsresult
|
|
GetCodebasePrincipalInternal(nsIURI* aURI, uint32_t aAppId,
|
|
bool aInMozBrowser,
|
|
nsIPrincipal** result);
|
|
|
|
nsresult
|
|
CreateCodebasePrincipal(nsIURI* aURI, uint32_t aAppId, bool aInMozBrowser,
|
|
nsIPrincipal** result);
|
|
|
|
nsresult
|
|
Init();
|
|
|
|
nsresult
|
|
InitPrefs();
|
|
|
|
inline void
|
|
ScriptSecurityPrefChanged();
|
|
|
|
inline void
|
|
AddSitesToFileURIWhitelist(const nsCString& aSiteList);
|
|
|
|
nsCOMPtr<nsIPrincipal> mSystemPrincipal;
|
|
bool mPrefInitialized;
|
|
bool mIsJavaScriptEnabled;
|
|
nsTArray<nsCOMPtr<nsIURI>> mFileURIWhitelist;
|
|
|
|
// This machinery controls new-style domain policies. The old-style
|
|
// policy machinery will be removed soon.
|
|
nsCOMPtr<nsIDomainPolicy> mDomainPolicy;
|
|
|
|
static bool sStrictFileOriginPolicy;
|
|
|
|
static nsIIOService *sIOService;
|
|
static nsIStringBundle *sStrBundle;
|
|
static JSRuntime *sRuntime;
|
|
};
|
|
|
|
namespace mozilla {
|
|
|
|
void
|
|
GetJarPrefix(uint32_t aAppid,
|
|
bool aInMozBrowser,
|
|
nsACString& aJarPrefix);
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // nsScriptSecurityManager_h__
|