2013-03-26 15:13:17 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 22:32:37 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-03-26 15:13:17 +04:00
|
|
|
/* 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_quota_originorpatternstring_h__
|
|
|
|
#define mozilla_dom_quota_originorpatternstring_h__
|
|
|
|
|
|
|
|
#include "mozilla/dom/quota/QuotaCommon.h"
|
|
|
|
|
2016-06-05 22:42:48 +03:00
|
|
|
#include "mozilla/BasePrincipal.h"
|
2018-09-07 19:22:50 +03:00
|
|
|
#include "mozilla/Variant.h"
|
2016-06-05 22:42:48 +03:00
|
|
|
|
2013-03-26 15:13:17 +04:00
|
|
|
BEGIN_QUOTA_NAMESPACE
|
|
|
|
|
2016-06-05 22:42:48 +03:00
|
|
|
class OriginScope
|
2013-03-26 15:13:17 +04:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
class Origin
|
2016-08-20 15:50:20 +03:00
|
|
|
{
|
|
|
|
nsCString mOrigin;
|
2018-09-07 19:22:50 +03:00
|
|
|
nsCString mOriginNoSuffix;
|
|
|
|
UniquePtr<OriginAttributes> mAttributes;
|
2016-08-20 15:50:20 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
public:
|
|
|
|
explicit Origin(const nsACString& aOrigin)
|
|
|
|
: mOrigin(aOrigin)
|
|
|
|
{
|
|
|
|
InitMembers();
|
|
|
|
}
|
|
|
|
|
|
|
|
Origin(const Origin& aOther)
|
2016-08-20 15:50:20 +03:00
|
|
|
: mOrigin(aOther.mOrigin)
|
2018-09-07 19:22:50 +03:00
|
|
|
, mOriginNoSuffix(aOther.mOriginNoSuffix)
|
|
|
|
, mAttributes(MakeUnique<OriginAttributes>(*aOther.mAttributes))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
Origin(Origin&& aOther) = default;
|
|
|
|
|
|
|
|
const nsACString&
|
|
|
|
GetOrigin() const
|
2016-08-20 15:50:20 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return mOrigin;
|
2016-08-20 15:50:20 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
void
|
|
|
|
SetOrigin(const nsACString& aOrigin)
|
|
|
|
{
|
|
|
|
mOrigin = aOrigin;
|
|
|
|
|
|
|
|
InitMembers();
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsACString&
|
|
|
|
GetOriginNoSuffix() const
|
|
|
|
{
|
|
|
|
return mOriginNoSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
const OriginAttributes&
|
|
|
|
GetAttributes() const
|
2016-08-20 15:50:20 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
MOZ_ASSERT(mAttributes);
|
2016-08-20 15:50:20 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
return *mAttributes;
|
2016-08-20 15:50:20 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
private:
|
|
|
|
void
|
|
|
|
InitMembers()
|
2016-08-20 15:50:20 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
mAttributes = MakeUnique<OriginAttributes>();
|
|
|
|
|
|
|
|
MOZ_ALWAYS_TRUE(mAttributes->PopulateFromOrigin(mOrigin,
|
|
|
|
mOriginNoSuffix));
|
2016-08-20 15:50:20 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
class Prefix
|
|
|
|
{
|
|
|
|
nsCString mOriginNoSuffix;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Prefix(const nsACString& aOriginNoSuffix)
|
|
|
|
: mOriginNoSuffix(aOriginNoSuffix)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
const nsCString&
|
|
|
|
GetOriginNoSuffix() const
|
|
|
|
{
|
|
|
|
return mOriginNoSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetOriginNoSuffix(const nsACString& aOriginNoSuffix)
|
|
|
|
{
|
|
|
|
mOriginNoSuffix = aOriginNoSuffix;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class Pattern
|
|
|
|
{
|
|
|
|
UniquePtr<OriginAttributesPattern> mPattern;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Pattern(const OriginAttributesPattern& aPattern)
|
|
|
|
: mPattern(MakeUnique<OriginAttributesPattern>(aPattern))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
explicit Pattern(const nsAString& aJSONPattern)
|
|
|
|
: mPattern(MakeUnique<OriginAttributesPattern>())
|
|
|
|
{
|
|
|
|
MOZ_ALWAYS_TRUE(mPattern->Init(aJSONPattern));
|
|
|
|
}
|
|
|
|
|
|
|
|
Pattern(const Pattern& aOther)
|
|
|
|
: mPattern(MakeUnique<OriginAttributesPattern>(*aOther.mPattern))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
Pattern(Pattern&& aOther) = default;
|
|
|
|
|
|
|
|
const OriginAttributesPattern&
|
|
|
|
GetPattern() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mPattern);
|
|
|
|
|
|
|
|
return *mPattern;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetPattern(const OriginAttributesPattern& aPattern)
|
|
|
|
{
|
|
|
|
mPattern = MakeUnique<OriginAttributesPattern>(aPattern);
|
|
|
|
}
|
2016-08-20 15:50:20 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
nsString
|
|
|
|
GetJSONPattern() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mPattern);
|
2016-08-20 15:50:20 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
nsString result;
|
|
|
|
MOZ_ALWAYS_TRUE(mPattern->ToJSON(result));
|
2016-08-17 05:57:18 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
return result;
|
|
|
|
}
|
2016-08-20 15:50:20 +03:00
|
|
|
};
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
struct Null
|
|
|
|
{ };
|
|
|
|
|
|
|
|
using DataType = Variant<Origin, Prefix, Pattern, Null>;
|
|
|
|
|
|
|
|
DataType mData;
|
2016-08-20 15:50:20 +03:00
|
|
|
|
|
|
|
public:
|
2018-09-07 19:22:50 +03:00
|
|
|
OriginScope()
|
|
|
|
: mData(Null())
|
|
|
|
{ }
|
|
|
|
|
2015-06-30 15:59:27 +03:00
|
|
|
static OriginScope
|
2013-03-26 15:13:17 +04:00
|
|
|
FromOrigin(const nsACString& aOrigin)
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return OriginScope(std::move(Origin(aOrigin)));
|
2013-03-26 15:13:17 +04:00
|
|
|
}
|
|
|
|
|
2015-06-30 15:59:27 +03:00
|
|
|
static OriginScope
|
2018-09-07 19:22:50 +03:00
|
|
|
FromPrefix(const nsACString& aPrefix)
|
2013-03-26 15:13:17 +04:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return OriginScope(std::move(Prefix(aPrefix)));
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static OriginScope
|
2018-09-07 19:22:50 +03:00
|
|
|
FromPattern(const OriginAttributesPattern& aPattern)
|
2016-06-05 22:42:48 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return OriginScope(std::move(Pattern(aPattern)));
|
2013-03-26 15:13:17 +04:00
|
|
|
}
|
|
|
|
|
2016-08-17 05:57:18 +03:00
|
|
|
static OriginScope
|
2018-09-07 19:22:50 +03:00
|
|
|
FromJSONPattern(const nsAString& aJSONPattern)
|
2016-08-17 05:57:18 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return OriginScope(std::move(Pattern(aJSONPattern)));
|
2016-08-17 05:57:18 +03:00
|
|
|
}
|
|
|
|
|
2015-06-30 15:59:27 +03:00
|
|
|
static OriginScope
|
2013-09-11 08:18:36 +04:00
|
|
|
FromNull()
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return OriginScope(std::move(Null()));
|
2016-08-20 15:50:20 +03:00
|
|
|
}
|
|
|
|
|
2013-03-26 15:13:17 +04:00
|
|
|
bool
|
|
|
|
IsOrigin() const
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.is<Origin>();
|
2013-03-26 15:13:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2018-09-07 19:22:50 +03:00
|
|
|
IsPrefix() const
|
2013-03-26 15:13:17 +04:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.is<Prefix>();
|
2013-09-11 08:18:36 +04:00
|
|
|
}
|
|
|
|
|
2016-08-17 05:57:18 +03:00
|
|
|
bool
|
2018-09-07 19:22:50 +03:00
|
|
|
IsPattern() const
|
2016-08-17 05:57:18 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.is<Pattern>();
|
2016-08-17 05:57:18 +03:00
|
|
|
}
|
|
|
|
|
2013-09-11 08:18:36 +04:00
|
|
|
bool
|
|
|
|
IsNull() const
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.is<Null>();
|
2015-06-30 15:59:27 +03:00
|
|
|
}
|
2013-09-11 08:18:36 +04:00
|
|
|
|
2015-11-22 12:43:55 +03:00
|
|
|
void
|
|
|
|
SetFromOrigin(const nsACString& aOrigin)
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
mData = AsVariant(Origin(aOrigin));
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-09-07 19:22:50 +03:00
|
|
|
SetFromPrefix(const nsACString& aPrefix)
|
2016-06-05 22:42:48 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
mData = AsVariant(Prefix(aPrefix));
|
2015-11-22 12:43:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-09-07 19:22:50 +03:00
|
|
|
SetFromPattern(const OriginAttributesPattern& aPattern)
|
2015-11-22 12:43:55 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
mData = AsVariant(Pattern(aPattern));
|
2015-11-22 12:43:55 +03:00
|
|
|
}
|
|
|
|
|
2016-08-17 05:57:18 +03:00
|
|
|
void
|
2018-09-07 19:22:50 +03:00
|
|
|
SetFromJSONPattern(const nsAString& aJSONPattern)
|
2016-08-17 05:57:18 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
mData = AsVariant(Pattern(aJSONPattern));
|
2016-08-17 05:57:18 +03:00
|
|
|
}
|
|
|
|
|
2015-11-22 12:43:55 +03:00
|
|
|
void
|
|
|
|
SetFromNull()
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
mData = AsVariant(Null());
|
2015-11-22 12:43:55 +03:00
|
|
|
}
|
|
|
|
|
2016-06-05 22:42:48 +03:00
|
|
|
const nsACString&
|
|
|
|
GetOrigin() const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOrigin());
|
2016-08-20 15:50:20 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.as<Origin>().GetOrigin();
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetOrigin(const nsACString& aOrigin)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsOrigin());
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
mData.as<Origin>().SetOrigin(aOrigin);
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
2016-08-17 05:57:18 +03:00
|
|
|
const nsACString&
|
2018-09-07 19:22:50 +03:00
|
|
|
GetOriginNoSuffix() const
|
2016-08-17 05:57:18 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
MOZ_ASSERT(IsOrigin() || IsPrefix());
|
2016-08-17 05:57:18 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
if (IsOrigin()) {
|
|
|
|
return mData.as<Origin>().GetOriginNoSuffix();
|
|
|
|
}
|
|
|
|
return mData.as<Prefix>().GetOriginNoSuffix();
|
2016-08-17 05:57:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2018-09-07 19:22:50 +03:00
|
|
|
SetOriginNoSuffix(const nsACString& aOriginNoSuffix)
|
2016-08-17 05:57:18 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(IsPrefix());
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
mData.as<Prefix>().SetOriginNoSuffix(aOriginNoSuffix);
|
2016-08-17 05:57:18 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
const OriginAttributesPattern&
|
|
|
|
GetPattern() const
|
2016-06-05 22:42:48 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
MOZ_ASSERT(IsPattern());
|
2016-06-05 22:42:48 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.as<Pattern>().GetPattern();
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
nsString
|
|
|
|
GetJSONPattern() const
|
2016-06-05 22:42:48 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
MOZ_ASSERT(IsPattern());
|
2016-08-17 05:57:18 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
return mData.as<Pattern>().GetJSONPattern();
|
2016-08-17 05:57:18 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
void
|
|
|
|
SetPattern(const OriginAttributesPattern& aPattern)
|
2016-08-17 05:57:18 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
MOZ_ASSERT(IsPattern());
|
2016-06-05 22:42:48 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
mData.as<Pattern>().SetPattern(aPattern);
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
bool
|
|
|
|
Matches(const OriginScope& aOther) const
|
2016-06-05 22:42:48 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
struct Matcher
|
|
|
|
{
|
|
|
|
const OriginScope& mThis;
|
|
|
|
|
|
|
|
explicit Matcher(const OriginScope& aThis)
|
|
|
|
: mThis(aThis)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Origin& aOther) {
|
|
|
|
return mThis.MatchesOrigin(aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Prefix& aOther) {
|
|
|
|
return mThis.MatchesPrefix(aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Pattern& aOther) {
|
|
|
|
return mThis.MatchesPattern(aOther);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Null& aOther) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return aOther.mData.match(Matcher(*this));
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
OriginScope
|
|
|
|
Clone()
|
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
return OriginScope(mData);
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
2015-06-30 15:59:27 +03:00
|
|
|
private:
|
2018-09-07 19:22:50 +03:00
|
|
|
// Move constructors
|
|
|
|
explicit OriginScope(const Origin&& aOrigin)
|
|
|
|
: mData(aOrigin)
|
2016-08-20 15:50:20 +03:00
|
|
|
{ }
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
explicit OriginScope(const Prefix&& aPrefix)
|
|
|
|
: mData(aPrefix)
|
|
|
|
{ }
|
2016-06-05 22:42:48 +03:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
explicit OriginScope(const Pattern&& aPattern)
|
|
|
|
: mData(aPattern)
|
2016-06-05 22:42:48 +03:00
|
|
|
{ }
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
explicit OriginScope(const Null&& aNull)
|
|
|
|
: mData(aNull)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
// Copy constructor
|
|
|
|
explicit OriginScope(const DataType& aOther)
|
|
|
|
: mData(aOther)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool
|
|
|
|
MatchesOrigin(const Origin& aOther) const
|
2016-06-05 22:42:48 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
struct OriginMatcher
|
|
|
|
{
|
|
|
|
const Origin& mOther;
|
|
|
|
|
|
|
|
explicit OriginMatcher(const Origin& aOther)
|
|
|
|
: mOther(aOther)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Origin& aThis) {
|
|
|
|
return aThis.GetOrigin().Equals(mOther.GetOrigin());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Prefix& aThis) {
|
|
|
|
return aThis.GetOriginNoSuffix().Equals(mOther.GetOriginNoSuffix());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Pattern& aThis) {
|
|
|
|
return aThis.GetPattern().Matches(mOther.GetAttributes());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Null& aThis) {
|
|
|
|
// Null covers everything.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return mData.match(OriginMatcher(aOther));
|
2016-06-05 22:42:48 +03:00
|
|
|
}
|
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
bool
|
|
|
|
MatchesPrefix(const Prefix& aOther) const
|
|
|
|
{
|
|
|
|
struct PrefixMatcher
|
|
|
|
{
|
|
|
|
const Prefix& mOther;
|
|
|
|
|
|
|
|
explicit PrefixMatcher(const Prefix& aOther)
|
|
|
|
: mOther(aOther)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Origin& aThis) {
|
|
|
|
return aThis.GetOriginNoSuffix().Equals(mOther.GetOriginNoSuffix());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Prefix& aThis) {
|
|
|
|
return aThis.GetOriginNoSuffix().Equals(mOther.GetOriginNoSuffix());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Pattern& aThis) {
|
|
|
|
// The match will be always true here because any origin attributes
|
|
|
|
// pattern overlaps any origin prefix (an origin prefix targets all
|
|
|
|
// origin attributes).
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Null& aThis) {
|
|
|
|
// Null covers everything.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return mData.match(PrefixMatcher(aOther));
|
|
|
|
}
|
2013-03-26 15:13:17 +04:00
|
|
|
|
2018-09-07 19:22:50 +03:00
|
|
|
bool
|
|
|
|
MatchesPattern(const Pattern& aOther) const
|
2016-08-20 15:50:20 +03:00
|
|
|
{
|
2018-09-07 19:22:50 +03:00
|
|
|
struct PatternMatcher
|
|
|
|
{
|
|
|
|
const Pattern& mOther;
|
|
|
|
|
|
|
|
explicit PatternMatcher(const Pattern& aOther)
|
|
|
|
: mOther(aOther)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Origin& aThis) {
|
|
|
|
return mOther.GetPattern().Matches(aThis.GetAttributes());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Prefix& aThis) {
|
|
|
|
// The match will be always true here because any origin attributes
|
|
|
|
// pattern overlaps any origin prefix (an origin prefix targets all
|
|
|
|
// origin attributes).
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Pattern& aThis) {
|
|
|
|
return aThis.GetPattern().Overlaps(mOther.GetPattern());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
match(const Null& aThis) {
|
|
|
|
// Null covers everything.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
PatternMatcher patternMatcher(aOther);
|
|
|
|
return mData.match(PatternMatcher(aOther));
|
2016-08-20 15:50:20 +03:00
|
|
|
}
|
|
|
|
|
2013-03-26 15:13:17 +04:00
|
|
|
bool
|
2015-06-30 15:59:27 +03:00
|
|
|
operator==(const OriginScope& aOther) = delete;
|
2013-03-26 15:13:17 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
END_QUOTA_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_quota_originorpatternstring_h__
|