Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/security/featurepolicy/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  FeaturePolicyUtils.h

  Sprache: C
 

/* 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 mozilla_dom_FeaturePolicyUtils_h
#define mozilla_dom_FeaturePolicyUtils_h

#include <functional>

#include "mozilla/dom/FeaturePolicy.h"

class PickleIterator;

namespace IPC {
class Message;
class MessageReader;
class MessageWriter;
}  // namespace IPC

namespace mozilla {
namespace dom {

class Document;

class FeaturePolicyUtils final {
 public:
  enum FeaturePolicyValue {
    // Feature always allowed.
    eAll,

    // Feature allowed for documents that are same-origin with this one.
    eSelf,

    // Feature denied.
    eNone,
  };

  // This method returns true if aFeatureName is allowed for aDocument.
  // Use this method everywhere you need to check feature-policy directives.
  static bool IsFeatureAllowed(Document* aDocument,
                               const nsAString& aFeatureName);

  // Returns true if aFeatureName is a known feature policy name.
  static bool IsSupportedFeature(const nsAString& aFeatureName);

  // Returns true if aFeatureName is a experimental feature policy name.
  static bool IsExperimentalFeature(const nsAString& aFeatureName);

  // Runs aCallback for each known feature policy, with the feature name as
  // argument.
  static void ForEachFeature(const std::function<void(const char*)>& aCallback);

  // Returns the default policy value for aFeatureName.
  static FeaturePolicyValue DefaultAllowListFeature(
      const nsAString& aFeatureName);

  // This method returns true if aFeatureName is in unsafe allowed "*" case.
  // We are in "unsafe" case when there is 'allow "*"' presents for an origin
  // that's not presented in the ancestor feature policy chain, via src, via
  // explicitly listed in allow, and not being the top-level origin.
  static bool IsFeatureUnsafeAllowedAll(Document* aDocument,
                                        const nsAString& aFeatureName);

 private:
  static void ReportViolation(Document* aDocument,
                              const nsAString& aFeatureName);
};

}  // namespace dom
}  // namespace mozilla

namespace IPC {

template <typename T>
struct ParamTraits;

template <>
struct ParamTraits<mozilla::dom::FeaturePolicyInfo> {
  static void Write(MessageWriter* aWriter,
                    const mozilla::dom::FeaturePolicyInfo& aParam);
  static bool Read(MessageReader* aReader,
                   mozilla::dom::FeaturePolicyInfo* aResult);
};

}  // namespace IPC

#endif  // mozilla_dom_FeaturePolicyUtils_h

Messung V0.5 in Prozent
C=78 H=92 G=84

¤ Dauer der Verarbeitung: 0.23 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.