2016-02-26 04:51:01 +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_StyleSheetInfo_h
|
|
|
|
#define mozilla_StyleSheetInfo_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/SRIMetadata.h"
|
|
|
|
#include "mozilla/net/ReferrerPolicy.h"
|
|
|
|
#include "mozilla/CORSMode.h"
|
|
|
|
|
2016-09-26 15:03:25 +03:00
|
|
|
#include "nsIURI.h"
|
|
|
|
|
2016-02-26 04:51:01 +03:00
|
|
|
namespace mozilla {
|
2017-01-24 02:52:56 +03:00
|
|
|
class StyleSheet;
|
2016-02-26 04:51:01 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
class nsCSSRuleProcessor;
|
|
|
|
class nsIPrincipal;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
/**
|
2016-09-29 09:11:52 +03:00
|
|
|
* Struct for data common to CSSStyleSheetInner and ServoStyleSheet.
|
2016-02-26 04:51:01 +03:00
|
|
|
*/
|
2016-09-29 09:17:58 +03:00
|
|
|
struct StyleSheetInfo
|
2016-02-26 04:51:01 +03:00
|
|
|
{
|
|
|
|
typedef net::ReferrerPolicy ReferrerPolicy;
|
|
|
|
|
|
|
|
StyleSheetInfo(CORSMode aCORSMode,
|
|
|
|
ReferrerPolicy aReferrerPolicy,
|
|
|
|
const dom::SRIMetadata& aIntegrity);
|
|
|
|
|
2017-02-18 02:48:35 +03:00
|
|
|
StyleSheetInfo(StyleSheetInfo& aCopy,
|
|
|
|
StyleSheet* aPrimarySheet);
|
|
|
|
|
2017-05-16 02:19:17 +03:00
|
|
|
virtual ~StyleSheetInfo();
|
|
|
|
|
|
|
|
virtual StyleSheetInfo* CloneFor(StyleSheet* aPrimarySheet) = 0;
|
2017-02-18 02:48:35 +03:00
|
|
|
|
|
|
|
virtual void AddSheet(StyleSheet* aSheet);
|
|
|
|
virtual void RemoveSheet(StyleSheet* aSheet);
|
|
|
|
|
2016-02-26 04:51:01 +03:00
|
|
|
nsCOMPtr<nsIURI> mSheetURI; // for error reports, etc.
|
|
|
|
nsCOMPtr<nsIURI> mOriginalSheetURI; // for GetHref. Can be null.
|
|
|
|
nsCOMPtr<nsIURI> mBaseURI; // for resolving relative URIs
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
CORSMode mCORSMode;
|
|
|
|
// The Referrer Policy of a stylesheet is used for its child sheets, so it is
|
|
|
|
// stored here.
|
|
|
|
ReferrerPolicy mReferrerPolicy;
|
|
|
|
dom::SRIMetadata mIntegrity;
|
|
|
|
bool mComplete;
|
2017-01-24 02:52:56 +03:00
|
|
|
|
|
|
|
// Pointer to start of linked list of child sheets. This is all fundamentally
|
|
|
|
// broken, because each of the child sheets has a unique parent... We can
|
|
|
|
// only hope (and currently this is the case) that any time page JS can get
|
|
|
|
// its hands on a child sheet that means we've already ensured unique infos
|
|
|
|
// throughout its parent chain and things are good.
|
|
|
|
RefPtr<StyleSheet> mFirstChild;
|
2017-02-18 02:48:35 +03:00
|
|
|
AutoTArray<StyleSheet*, 8> mSheets;
|
|
|
|
|
2017-06-29 02:51:46 +03:00
|
|
|
// If a SourceMap or X-SourceMap response header is seen, this is
|
|
|
|
// the value. If both are seen, SourceMap is preferred. If neither
|
|
|
|
// is seen, this will be an empty string.
|
|
|
|
nsString mSourceMapURL;
|
2017-08-09 22:33:24 +03:00
|
|
|
// This stores any source map URL that might have been seen in a
|
|
|
|
// comment in the style sheet. This is separate from mSourceMapURL
|
|
|
|
// so that the value does not overwrite any value that might have
|
|
|
|
// come from a response header.
|
|
|
|
nsString mSourceMapURLFromComment;
|
2017-09-14 23:59:32 +03:00
|
|
|
// This stores any source URL that might have been seen in a comment
|
|
|
|
// in the style sheet.
|
|
|
|
nsString mSourceURL;
|
2017-06-29 02:51:46 +03:00
|
|
|
|
2016-02-26 04:51:01 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool mPrincipalSet;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_StyleSheetInfo_h
|