2018-10-01 09:09:43 +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: */
|
|
|
|
/* 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_FeaturePolicyParser_h
|
|
|
|
#define mozilla_dom_FeaturePolicyParser_h
|
|
|
|
|
|
|
|
#include "nsString.h"
|
|
|
|
|
2018-10-12 10:36:33 +03:00
|
|
|
class nsIPrincipal;
|
2018-10-01 09:09:43 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
class Document;
|
2018-10-01 09:09:43 +03:00
|
|
|
class Feature;
|
|
|
|
|
|
|
|
class FeaturePolicyParser final {
|
|
|
|
public:
|
2018-10-12 10:36:33 +03:00
|
|
|
// aSelfOrigin must not be null. if aSrcOrigin is null, the parsing will not
|
2018-10-01 09:09:44 +03:00
|
|
|
// support 'src' as valid allow directive value.
|
2019-01-02 16:05:23 +03:00
|
|
|
static bool ParseString(const nsAString& aPolicy, Document* aDocument,
|
2018-10-12 10:36:33 +03:00
|
|
|
nsIPrincipal* aSelfOrigin, nsIPrincipal* aSrcOrigin,
|
2018-10-01 09:09:43 +03:00
|
|
|
nsTArray<Feature>& aParsedFeatures);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_FeaturePolicyParser_h
|