gecko-dev/dom/security/nsContentSecurityUtils.h
Tom Ritter c2e992ed6e Bug 1570681 - Enforce eval restrictions in system contexts and the parent process r=ckerschb
We log to MOZ_LOG, report an error to the console, send telemetry, and in debug builds - crash

Differential Revision: https://phabricator.services.mozilla.com/D45055

--HG--
extra : moz-landing-system : lando
2019-09-19 02:32:41 +00:00

32 lines
1018 B
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 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/. */
/* A namespace class for static content security utilities. */
#ifndef nsContentSecurityUtils_h___
#define nsContentSecurityUtils_h___
namespace mozilla {
namespace dom {
class Document;
} // namespace dom
} // namespace mozilla
typedef mozilla::Pair<nsCString, mozilla::Maybe<nsString>> FilenameType;
class nsContentSecurityUtils {
public:
static FilenameType FilenameToEvalType(const nsString& fileName);
static bool IsEvalAllowed(JSContext* cx, nsIPrincipal* aSubjectPrincipal,
const nsAString& aScript);
#if defined(DEBUG)
static void AssertAboutPageHasCSP(mozilla::dom::Document* aDocument);
#endif
};
#endif /* nsContentSecurityUtils_h___ */