Bug 1673931 - Avoid including Document.h from header files. r=emilio

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

Depends on D95045
This commit is contained in:
Simon Giesecke 2020-11-23 16:07:43 +00:00
parent fbfebfdada
commit 5bfbb2a572
78 changed files with 620 additions and 365 deletions

View file

@ -541,3 +541,9 @@ void DocManager::RemoteDocAdded(DocAccessibleParent* aDoc) {
sRemoteDocuments->AppendElement(aDoc);
ProxyCreated(aDoc, Interfaces::DOCUMENT | Interfaces::HYPERTEXT);
}
DocAccessible* mozilla::a11y::GetExistingDocAccessible(
const dom::Document* aDocument) {
PresShell* presShell = aDocument->GetPresShell();
return presShell ? presShell->GetDocAccessible() : nullptr;
}

View file

@ -7,13 +7,16 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/Document.h"
#include "nsIDOMEventListener.h"
#include "nsRefPtrHashtable.h"
#include "nsIWebProgressListener.h"
#include "nsWeakReference.h"
#include "mozilla/StaticPtr.h"
namespace mozilla::dom {
class Document;
}
namespace mozilla {
namespace a11y {
@ -187,10 +190,7 @@ class DocManager : public nsIWebProgressListener,
* Note this returns the doc accessible for the primary pres shell if there is
* more than one.
*/
inline DocAccessible* GetExistingDocAccessible(const dom::Document* aDocument) {
PresShell* presShell = aDocument->GetPresShell();
return presShell ? presShell->GetDocAccessible() : nullptr;
}
DocAccessible* GetExistingDocAccessible(const dom::Document* aDocument);
} // namespace a11y
} // namespace mozilla

View file

@ -383,6 +383,10 @@ bool nsCoreUtils::IsErrorPage(Document* aDocument) {
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
}
PresShell* nsCoreUtils::GetPresShellFor(nsINode* aNode) {
return aNode->OwnerDoc()->GetPresShell();
}
bool nsCoreUtils::GetID(nsIContent* aContent, nsAString& aID) {
return aContent->IsElement() &&
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);

View file

@ -10,7 +10,6 @@
#include "mozilla/dom/Element.h"
#include "nsIAccessibleEvent.h"
#include "nsIContent.h"
#include "mozilla/dom/Document.h" // for GetPresShell()
#include "mozilla/FlushType.h"
#include "mozilla/PresShellForwards.h"
@ -26,8 +25,9 @@ class nsIWidget;
namespace mozilla {
class PresShell;
namespace dom {
class Document;
class XULTreeElement;
}
} // namespace dom
} // namespace mozilla
/**
@ -219,9 +219,7 @@ class nsCoreUtils {
/**
* Return presShell for the document containing the given DOM node.
*/
static PresShell* GetPresShellFor(nsINode* aNode) {
return aNode->OwnerDoc()->GetPresShell();
}
static PresShell* GetPresShellFor(nsINode* aNode);
/**
* Get the ID for an element, in some types of XML this may not be the ID

View file

@ -41,6 +41,16 @@ inline nsIAccessiblePivot* DocAccessible::VirtualCursor() {
return mVirtualCursor;
}
inline bool DocAccessible::IsContentLoaded() const {
// eDOMLoaded flag check is used for error pages as workaround to make this
// method return correct result since error pages do not receive 'pageshow'
// event and as consequence Document::IsShowing() returns false.
return mDocumentNode && mDocumentNode->IsVisible() &&
(mDocumentNode->IsShowing() || HasLoadState(eDOMLoaded));
}
inline bool DocAccessible::IsHidden() const { return mDocumentNode->Hidden(); }
inline void DocAccessible::FireDelayedEvent(AccEvent* aEvent) {
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDocLoad)) logging::DocLoadEventFired(aEvent);

View file

@ -338,6 +338,14 @@ void DocAccessible::URL(nsAString& aURL) const {
CopyUTF8toUTF16(theURL, aURL);
}
void DocAccessible::Title(nsString& aTitle) const {
mDocumentNode->GetTitle(aTitle);
}
void DocAccessible::MimeType(nsAString& aType) const {
mDocumentNode->GetContentType(aType);
}
void DocAccessible::DocType(nsAString& aType) const {
dom::DocumentType* docType = mDocumentNode->GetDoctype();
if (docType) docType->GetPublicId(aType);
@ -449,6 +457,8 @@ nsIFrame* DocAccessible::GetFrame() const {
return root;
}
nsINode* DocAccessible::GetNode() const { return mDocumentNode; }
// DocAccessible protected member
nsRect DocAccessible::RelativeBounds(nsIFrame** aRelativeFrame) const {
*aRelativeFrame = GetFrame();
@ -2676,3 +2686,8 @@ void DocAccessible::SetRoleMapEntryForDoc(dom::Element* aElement) {
// No other ARIA roles are valid on body elements.
SetRoleMapEntry(nullptr);
}
Accessible* DocAccessible::GetAccessible(nsINode* aNode) const {
return aNode == mDocumentNode ? const_cast<DocAccessible*>(this)
: mNodeToAccessibleMap.Get(aNode);
}

View file

@ -13,7 +13,6 @@
#include "nsClassHashtable.h"
#include "nsDataHashtable.h"
#include "mozilla/dom/Document.h"
#include "mozilla/UniquePtr.h"
#include "nsIDocumentObserver.h"
#include "nsIObserver.h"
@ -66,7 +65,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
virtual void Init();
virtual void Shutdown() override;
virtual nsIFrame* GetFrame() const override;
virtual nsINode* GetNode() const override { return mDocumentNode; }
virtual nsINode* GetNode() const override;
Document* DocumentNode() const { return mDocumentNode; }
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
@ -100,15 +99,12 @@ class DocAccessible : public HyperTextAccessibleWrap,
/**
* Return DOM document title.
*/
void Title(nsString& aTitle) const { mDocumentNode->GetTitle(aTitle); }
void Title(nsString& aTitle) const;
/**
* Return DOM document mime type.
*/
void MimeType(nsAString& aType) const {
mDocumentNode->GetContentType(aType);
}
void MimeType(nsAString& aType) const;
/**
* Return DOM document type.
*/
@ -140,15 +136,9 @@ class DocAccessible : public HyperTextAccessibleWrap,
/**
* Return true if associated DOM document was loaded and isn't unloading.
*/
bool IsContentLoaded() const {
// eDOMLoaded flag check is used for error pages as workaround to make this
// method return correct result since error pages do not receive 'pageshow'
// event and as consequence Document::IsShowing() returns false.
return mDocumentNode && mDocumentNode->IsVisible() &&
(mDocumentNode->IsShowing() || HasLoadState(eDOMLoaded));
}
bool IsContentLoaded() const;
bool IsHidden() const { return mDocumentNode->Hidden(); }
bool IsHidden() const;
/**
* Document load states.
@ -240,10 +230,7 @@ class DocAccessible : public HyperTextAccessibleWrap,
*
* @return the accessible object
*/
Accessible* GetAccessible(nsINode* aNode) const {
return aNode == mDocumentNode ? const_cast<DocAccessible*>(this)
: mNodeToAccessibleMap.Get(aNode);
}
Accessible* GetAccessible(nsINode* aNode) const;
/**
* Return an accessible for the given node even if the node is not in

View file

@ -6840,6 +6840,38 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
}
void nsDocShell::ReportBFCacheComboTelemetry(uint16_t aCombo) {
// There are 11 possible reasons to make a request fails to use BFCache
// (see BFCacheStatus in dom/base/Document.h), and we'd like to record
// the common combinations for reasons which make requests fail to use
// BFCache. These combinations are generated based on some local browsings,
// we need to adjust them when necessary.
enum BFCacheStatusCombo : uint16_t {
BFCACHE_SUCCESS,
SUCCESS_NOT_ONLY_TOPLEVEL =
mozilla::dom::BFCacheStatus::NOT_ONLY_TOPLEVEL_IN_BCG,
UNLOAD = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER,
UNLOAD_REQUEST = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST,
REQUEST = mozilla::dom::BFCacheStatus::REQUEST,
UNLOAD_REQUEST_PEER = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::ACTIVE_PEER_CONNECTION,
UNLOAD_REQUEST_PEER_MSE =
mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::ACTIVE_PEER_CONNECTION |
mozilla::dom::BFCacheStatus::CONTAINS_MSE_CONTENT,
UNLOAD_REQUEST_MSE = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::CONTAINS_MSE_CONTENT,
SUSPENDED_UNLOAD_REQUEST_PEER =
mozilla::dom::BFCacheStatus::SUSPENDED |
mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::ACTIVE_PEER_CONNECTION,
REMOTE_SUBFRAMES = mozilla::dom::BFCacheStatus::CONTAINS_REMOTE_SUBFRAMES
};
switch (aCombo) {
case BFCACHE_SUCCESS:
Telemetry::AccumulateCategorical(

View file

@ -32,7 +32,6 @@
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsCharsetSource.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
#include "nsDocLoader.h"
#include "nsIAuthPromptProvider.h"
@ -874,38 +873,6 @@ class nsDocShell final : public nsDocLoader,
bool CanSavePresentation(uint32_t aLoadType, nsIRequest* aNewRequest,
mozilla::dom::Document* aNewDocument);
// There are 11 possible reasons to make a request fails to use BFCache
// (see BFCacheStatus in dom/base/Document.h), and we'd like to record
// the common combinations for reasons which make requests fail to use
// BFCache. These combinations are generated based on some local browsings,
// we need to adjust them when necessary.
enum BFCacheStatusCombo : uint16_t {
BFCACHE_SUCCESS,
SUCCESS_NOT_ONLY_TOPLEVEL =
mozilla::dom::BFCacheStatus::NOT_ONLY_TOPLEVEL_IN_BCG,
UNLOAD = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER,
UNLOAD_REQUEST = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST,
REQUEST = mozilla::dom::BFCacheStatus::REQUEST,
UNLOAD_REQUEST_PEER = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::ACTIVE_PEER_CONNECTION,
UNLOAD_REQUEST_PEER_MSE =
mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::ACTIVE_PEER_CONNECTION |
mozilla::dom::BFCacheStatus::CONTAINS_MSE_CONTENT,
UNLOAD_REQUEST_MSE = mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::CONTAINS_MSE_CONTENT,
SUSPENDED_UNLOAD_REQUEST_PEER =
mozilla::dom::BFCacheStatus::SUSPENDED |
mozilla::dom::BFCacheStatus::UNLOAD_LISTENER |
mozilla::dom::BFCacheStatus::REQUEST |
mozilla::dom::BFCacheStatus::ACTIVE_PEER_CONNECTION,
REMOTE_SUBFRAMES = mozilla::dom::BFCacheStatus::CONTAINS_REMOTE_SUBFRAMES
};
void ReportBFCacheComboTelemetry(uint16_t aCombo);
// Captures the state of the supporting elements of the presentation

View file

@ -41,6 +41,10 @@ AnimationEffect::AnimationEffect(Document* aDocument, TimingParams&& aTiming)
AnimationEffect::~AnimationEffect() = default;
nsISupports* AnimationEffect::GetParentObject() const {
return ToSupports(mDocument);
}
// https://drafts.csswg.org/web-animations/#current
bool AnimationEffect::IsCurrent() const {
if (!mAnimation || mAnimation->PlayState() == AnimationPlayState::Finished) {

View file

@ -34,7 +34,7 @@ class AnimationEffect : public nsISupports, public nsWrapperCache {
virtual KeyframeEffect* AsKeyframeEffect() { return nullptr; }
nsISupports* GetParentObject() const { return ToSupports(mDocument); }
nsISupports* GetParentObject() const;
bool IsCurrent() const;
bool IsInEffect() const;

View file

@ -41,6 +41,26 @@ NS_INTERFACE_MAP_END_INHERITING(AnimationTimeline)
NS_IMPL_ADDREF_INHERITED(DocumentTimeline, AnimationTimeline)
NS_IMPL_RELEASE_INHERITED(DocumentTimeline, AnimationTimeline)
DocumentTimeline::DocumentTimeline(Document* aDocument,
const TimeDuration& aOriginTime)
: AnimationTimeline(aDocument->GetParentObject()),
mDocument(aDocument),
mIsObservingRefreshDriver(false),
mOriginTime(aOriginTime) {
if (mDocument) {
mDocument->Timelines().insertBack(this);
}
}
DocumentTimeline::~DocumentTimeline() {
MOZ_ASSERT(!mIsObservingRefreshDriver,
"Timeline should have disassociated"
" from the refresh driver before being destroyed");
if (isInList()) {
remove();
}
}
JSObject* DocumentTimeline::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return DocumentTimeline_Binding::Wrap(aCx, this, aGivenProto);

View file

@ -26,25 +26,10 @@ class DocumentTimeline final : public AnimationTimeline,
public nsATimerAdjustmentObserver,
public LinkedListElement<DocumentTimeline> {
public:
DocumentTimeline(Document* aDocument, const TimeDuration& aOriginTime)
: AnimationTimeline(aDocument->GetParentObject()),
mDocument(aDocument),
mIsObservingRefreshDriver(false),
mOriginTime(aOriginTime) {
if (mDocument) {
mDocument->Timelines().insertBack(this);
}
}
DocumentTimeline(Document* aDocument, const TimeDuration& aOriginTime);
protected:
virtual ~DocumentTimeline() {
MOZ_ASSERT(!mIsObservingRefreshDriver,
"Timeline should have disassociated"
" from the refresh driver before being destroyed");
if (isInList()) {
remove();
}
}
virtual ~DocumentTimeline();
public:
NS_DECL_ISUPPORTS_INHERITED

View file

@ -23,6 +23,9 @@ NS_IMPL_CYCLE_COLLECTION(PendingAnimationTracker, mPlayPendingSet,
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PendingAnimationTracker, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PendingAnimationTracker, Release)
PendingAnimationTracker::PendingAnimationTracker(dom::Document* aDocument)
: mDocument(aDocument) {}
void PendingAnimationTracker::AddPending(dom::Animation& aAnimation,
AnimationSet& aSet) {
aSet.PutEntry(&aAnimation);

View file

@ -8,7 +8,6 @@
#define mozilla_dom_PendingAnimationTracker_h
#include "mozilla/dom/Animation.h"
#include "mozilla/dom/Document.h"
#include "mozilla/TypedEnumBits.h"
#include "nsCycleCollectionParticipant.h"
#include "nsTHashtable.h"
@ -23,8 +22,7 @@ class Document;
class PendingAnimationTracker final {
public:
explicit PendingAnimationTracker(dom::Document* aDocument)
: mDocument(aDocument) {}
explicit PendingAnimationTracker(dom::Document* aDocument);
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PendingAnimationTracker)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(PendingAnimationTracker)

View file

@ -82,6 +82,8 @@ AbstractRange::AbstractRange(nsINode* aNode)
Init(aNode);
}
AbstractRange::~AbstractRange() = default;
void AbstractRange::Init(nsINode* aNode) {
MOZ_ASSERT(aNode, "range isn't in a document!");
mOwner = aNode->OwnerDoc();
@ -203,9 +205,20 @@ nsresult AbstractRange::SetStartAndEndInternal(
return NS_OK;
}
nsINode* AbstractRange::GetParentObject() const { return mOwner; }
JSObject* AbstractRange::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
MOZ_CRASH("Must be overridden");
}
void AbstractRange::ClearForReuse() {
mOwner = nullptr;
mStart = RangeBoundary();
mEnd = RangeBoundary();
mIsPositioned = false;
mIsGenerated = false;
mCalledByJS = false;
}
} // namespace mozilla::dom

View file

@ -7,19 +7,31 @@
#ifndef mozilla_dom_AbstractRange_h
#define mozilla_dom_AbstractRange_h
#include <cstdint>
#include "ErrorList.h"
#include "js/RootingAPI.h"
#include "mozilla/Assertions.h"
#include "mozilla/Maybe.h"
#include "mozilla/RangeBoundary.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
#include "nsINode.h"
#include "mozilla/RefPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupports.h"
#include "nsWrapperCache.h"
class JSObject;
class nsIContent;
class nsINode;
struct JSContext;
namespace mozilla {
namespace dom {
class Document;
class AbstractRange : public nsISupports, public nsWrapperCache {
protected:
explicit AbstractRange(nsINode* aNode);
virtual ~AbstractRange() = default;
virtual ~AbstractRange();
public:
AbstractRange() = delete;
@ -75,7 +87,7 @@ class AbstractRange : public nsISupports, public nsWrapperCache {
StartOffset() == EndOffset());
}
nsINode* GetParentObject() const { return mOwner; }
nsINode* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
@ -96,14 +108,7 @@ class AbstractRange : public nsISupports, public nsWrapperCache {
void Init(nsINode* aNode);
private:
void ClearForReuse() {
mOwner = nullptr;
mStart = RangeBoundary();
mEnd = RangeBoundary();
mIsPositioned = false;
mIsGenerated = false;
mCalledByJS = false;
}
void ClearForReuse();
protected:
RefPtr<Document> mOwner;

View file

@ -0,0 +1,41 @@
/* -*- 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 dom_base_AutoSuppressEventHandlingAndSuspend_h
#define dom_base_AutoSuppressEventHandlingAndSuspend_h
#include "mozilla/dom/Document.h"
#include "nsCOMPtr.h"
#include "nsPIDOMWindow.h"
#include "nsTArray.h"
namespace mozilla::dom {
class BrowsingContext;
class BrowsingContextGroup;
/**
* Suppresses event handling and suspends the active inner window for all
* in-process documents in a BrowsingContextGroup. This should be used while
* spinning the event loop for a synchronous operation (like `window.open()`)
* which affects operations in any other window in the same BrowsingContext
* group.
*/
class MOZ_RAII AutoSuppressEventHandlingAndSuspend {
public:
explicit AutoSuppressEventHandlingAndSuspend(BrowsingContextGroup* aGroup);
~AutoSuppressEventHandlingAndSuspend();
private:
void SuppressBrowsingContext(BrowsingContext* aBC);
AutoTArray<RefPtr<Document>, 16> mDocuments;
AutoTArray<nsCOMPtr<nsPIDOMWindowInner>, 16> mWindows;
};
} // namespace mozilla::dom
#endif

View file

@ -10,13 +10,15 @@
#define mozilla_dom_BindContext_h__
#include "mozilla/Attributes.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsINode.h"
namespace mozilla {
namespace dom {
class Document;
struct MOZ_STACK_CLASS BindContext final {
// The document that owns the tree we're getting bound to.
//

View file

@ -4,10 +4,13 @@
* 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/. */
#include "Document.h"
#include "nsCOMArray.h"
#include "js/RootingAPI.h"
#include "mozilla/AlreadyAddRefed.h"
#include "nsContentList.h"
#include "nsPIDOMWindow.h"
class JSObject;
class nsINode;
struct JSContext;
namespace mozilla {
class ErrorResult;

View file

@ -14,6 +14,7 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CustomElementRegistryBinding.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/WebComponentsBinding.h"
#include "nsCycleCollectionParticipant.h"

View file

@ -27,6 +27,18 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMImplementation, mOwner)
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMImplementation)
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMImplementation)
DOMImplementation::DOMImplementation(Document* aOwner,
nsIGlobalObject* aScriptObject,
nsIURI* aDocumentURI, nsIURI* aBaseURI)
: mOwner(aOwner),
mScriptObject(do_GetWeakReference(aScriptObject)),
mDocumentURI(aDocumentURI),
mBaseURI(aBaseURI) {
MOZ_ASSERT(aOwner);
}
DOMImplementation::~DOMImplementation() = default;
JSObject* DOMImplementation::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return DOMImplementation_Binding::Wrap(aCx, this, aGivenProto);

View file

@ -13,7 +13,6 @@
#include "mozilla/ErrorResult.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/Document.h"
#include "nsIScriptGlobalObject.h"
#include "nsIURI.h"
#include "nsIWeakReferenceUtils.h"
@ -27,17 +26,11 @@ template <typename T>
class Optional;
class DOMImplementation final : public nsISupports, public nsWrapperCache {
~DOMImplementation() = default;
~DOMImplementation();
public:
DOMImplementation(Document* aOwner, nsIGlobalObject* aScriptObject,
nsIURI* aDocumentURI, nsIURI* aBaseURI)
: mOwner(aOwner),
mScriptObject(do_GetWeakReference(aScriptObject)),
mDocumentURI(aDocumentURI),
mBaseURI(aBaseURI) {
MOZ_ASSERT(aOwner);
}
nsIURI* aDocumentURI, nsIURI* aBaseURI);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation)

View file

@ -76,6 +76,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMIntersectionObserver)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mQueuedEntries)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
DOMIntersectionObserver::DOMIntersectionObserver(
already_AddRefed<nsPIDOMWindowInner>&& aOwner,
dom::IntersectionCallback& aCb)
: mOwner(aOwner),
mDocument(mOwner->GetExtantDoc()),
mCallback(RefPtr<dom::IntersectionCallback>(&aCb)),
mConnected(false) {}
already_AddRefed<DOMIntersectionObserver> DOMIntersectionObserver::Constructor(
const GlobalObject& aGlobal, dom::IntersectionCallback& aCb,
ErrorResult& aRv) {
@ -185,6 +193,8 @@ bool DOMIntersectionObserver::SetRootMargin(const nsAString& aString) {
return Servo_IntersectionObserverRootMargin_Parse(&aString, &mRootMargin);
}
nsISupports* DOMIntersectionObserver::GetParentObject() const { return mOwner; }
void DOMIntersectionObserver::GetRootMargin(DOMString& aRetVal) {
nsString& retVal = aRetVal;
Servo_IntersectionObserverRootMargin_ToString(&mRootMargin, &retVal);

View file

@ -90,11 +90,7 @@ class DOMIntersectionObserver final : public nsISupports,
public:
DOMIntersectionObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner,
dom::IntersectionCallback& aCb)
: mOwner(aOwner),
mDocument(mOwner->GetExtantDoc()),
mCallback(RefPtr<dom::IntersectionCallback>(&aCb)),
mConnected(false) {}
dom::IntersectionCallback& aCb);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMIntersectionObserver)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_INTERSECTION_OBSERVER_IID)
@ -110,7 +106,7 @@ class DOMIntersectionObserver final : public nsISupports,
return IntersectionObserver_Binding::Wrap(aCx, this, aGivenProto);
}
nsISupports* GetParentObject() const { return mOwner; }
nsISupports* GetParentObject() const;
nsINode* GetRoot() const { return mRoot; }

View file

@ -12,6 +12,7 @@
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/Telemetry.h"
#include "mozilla/ThrottledEventQueue.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/dom/JSExecutionManager.h"
#include "nsDOMMutationObserver.h"
@ -148,6 +149,16 @@ void DocGroup::SetExecutionManager(JSExecutionManager* aManager) {
mExecutionManager = aManager;
}
mozilla::dom::CustomElementReactionsStack*
DocGroup::CustomElementReactionsStack() {
MOZ_ASSERT(NS_IsMainThread());
if (!mReactionsStack) {
mReactionsStack = new mozilla::dom::CustomElementReactionsStack();
}
return mReactionsStack;
}
void DocGroup::AddDocument(Document* aDocument) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mDocuments.Contains(aDocument));

View file

@ -14,7 +14,6 @@
#include "nsString.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/BrowsingContextGroup.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/PerformanceCounter.h"
#include "mozilla/PerformanceTypes.h"
@ -23,6 +22,9 @@ namespace mozilla {
class AbstractThread;
namespace dom {
class CustomElementReactionsStack;
class JSExecutionManager;
// Two browsing contexts are considered "related" if they are reachable from one
// another through window.opener, window.parent, or window.frames. This is the
// spec concept of a browsing context group.
@ -68,14 +70,7 @@ class DocGroup final {
mozilla::dom::DOMArena* ArenaAllocator() { return mArena; }
mozilla::dom::CustomElementReactionsStack* CustomElementReactionsStack() {
MOZ_ASSERT(NS_IsMainThread());
if (!mReactionsStack) {
mReactionsStack = new mozilla::dom::CustomElementReactionsStack();
}
return mReactionsStack;
}
mozilla::dom::CustomElementReactionsStack* CustomElementReactionsStack();
// Adding documents to a DocGroup should be done through
// BrowsingContextGroup::AddDocument (which in turn calls

View file

@ -1974,6 +1974,11 @@ void Element::UnbindFromTree(bool aNullParent) {
MOZ_ASSERT(!document || document->GetServoRestyleRoot() != this);
}
UniquePtr<SMILAttr> Element::GetAnimatedAttr(int32_t aNamespaceID,
nsAtom* aName) {
return nullptr;
}
nsDOMCSSAttributeDeclaration* Element::SMILOverrideStyle() {
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();

View file

@ -403,9 +403,7 @@ class Element : public FragmentOrElement {
* attribute on this element.
*/
virtual UniquePtr<SMILAttr> GetAnimatedAttr(int32_t aNamespaceID,
nsAtom* aName) {
return nullptr;
}
nsAtom* aName);
/**
* Get the SMIL override style for this element. This is a style declaration

View file

@ -7,7 +7,9 @@
#include "IDTracker.h"
#include "mozilla/Encoding.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentOrShadowRoot.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsAtom.h"
#include "nsContentUtils.h"
#include "nsIURI.h"
@ -49,6 +51,10 @@ static DocumentOrShadowRoot* FindTreeToWatch(nsIContent& aContent,
return aContent.OwnerDoc();
}
IDTracker::IDTracker() = default;
IDTracker::~IDTracker() { Unlink(); }
void IDTracker::ResetToURIFragmentID(nsIContent* aFromContent, nsIURI* aURI,
nsIReferrerInfo* aReferrerInfo,
bool aWatch, bool aReferenceImage) {
@ -223,4 +229,16 @@ IDTracker::DocumentLoadNotification::Observe(nsISupports* aSubject,
return NS_OK;
}
DocumentOrShadowRoot* IDTracker::GetWatchDocOrShadowRoot() const {
if (!mWatchDocumentOrShadowRoot) {
return nullptr;
}
MOZ_ASSERT(mWatchDocumentOrShadowRoot->IsDocument() ||
mWatchDocumentOrShadowRoot->IsShadowRoot());
if (ShadowRoot* shadow = ShadowRoot::FromNode(*mWatchDocumentOrShadowRoot)) {
return shadow;
}
return mWatchDocumentOrShadowRoot->AsDocument();
}
} // namespace mozilla::dom

View file

@ -9,11 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsAtom.h"
#include "mozilla/dom/Document.h"
#include "nsThreadUtils.h"
#include "plstr.h"
class nsAtom;
class nsIContent;
@ -24,6 +20,8 @@ class nsIReferrerInfo;
namespace mozilla {
namespace dom {
class Document;
/**
* Class to track what element is referenced by a given ID.
*
@ -45,9 +43,9 @@ class IDTracker {
public:
typedef mozilla::dom::Element Element;
IDTracker() = default;
IDTracker();
~IDTracker() { Unlink(); }
~IDTracker();
/**
* Find which element, if any, is referenced.
@ -180,18 +178,7 @@ class IDTracker {
};
friend class DocumentLoadNotification;
DocumentOrShadowRoot* GetWatchDocOrShadowRoot() const {
if (!mWatchDocumentOrShadowRoot) {
return nullptr;
}
MOZ_ASSERT(mWatchDocumentOrShadowRoot->IsDocument() ||
mWatchDocumentOrShadowRoot->IsShadowRoot());
if (ShadowRoot* shadow =
ShadowRoot::FromNode(*mWatchDocumentOrShadowRoot)) {
return shadow;
}
return mWatchDocumentOrShadowRoot->AsDocument();
}
DocumentOrShadowRoot* GetWatchDocOrShadowRoot() const;
RefPtr<nsAtom> mWatchID;
nsCOMPtr<nsINode>

View file

@ -7,16 +7,18 @@
#ifndef DOM_BASE_MUTATIONOBSERVERS_H_
#define DOM_BASE_MUTATIONOBSERVERS_H_
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
#include "mozilla/dom/Document.h"
#include "js/TypeDecls.h"
#include "nsContentUtils.h"
#include "nsIContent.h" // for use in inline function (NotifyParentChainChanged)
#include "nsIMutationObserver.h" // for use in inline function (NotifyParentChainChanged)
#include "nsINode.h"
#include "nsTObserverArray.h"
class nsAtom;
class nsAttrValue;
struct CharacterDataChangeInfo;
namespace mozilla {
namespace dom {
class Animation;
class Element;
class MutationObservers {
public:

View file

@ -5,28 +5,47 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ThirdPartyUtil.h"
#include "nsDocShell.h"
#include "nsGlobalWindowOuter.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIChannel.h"
#include "nsIClassifiedChannel.h"
#include "nsIHttpChannelInternal.h"
#include "nsILoadContext.h"
#include "nsIPrincipal.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIURI.h"
#include "nsReadableUtils.h"
#include "nsThreadUtils.h"
#include <cstdint>
#include "MainThreadUtils.h"
#include "mozIDOMWindow.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/ContentBlocking.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/dom/Document.h"
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/Logging.h"
#include "mozilla/MacroForEach.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TextUtils.h"
#include "mozilla/Unused.h"
#include "nsGlobalWindowOuter.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/WindowContext.h"
#include "mozilla/dom/WindowGlobalParent.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsEffectiveTLDService.h"
#include "nsError.h"
#include "nsGlobalWindowInner.h"
#include "nsIChannel.h"
#include "nsIClassifiedChannel.h"
#include "nsIContentPolicy.h"
#include "nsIHttpChannelInternal.h"
#include "nsILoadContext.h"
#include "nsILoadInfo.h"
#include "nsIPrincipal.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIURI.h"
#include "nsLiteralString.h"
#include "nsNetUtil.h"
#include "nsPIDOMWindow.h"
#include "nsPIDOMWindowInlines.h"
#include "nsServiceManagerUtils.h"
#include "nsTLiteralString.h"
using namespace mozilla;
using namespace mozilla::dom;

View file

@ -7,18 +7,26 @@
#ifndef ThirdPartyUtil_h__
#define ThirdPartyUtil_h__
#include <cstdint>
#include "ErrorList.h"
#include "mozIThirdPartyUtil.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/Document.h"
#include "nsCOMPtr.h"
#include "nsEffectiveTLDService.h"
#include "mozilla/RefPtr.h"
#include "nsISupports.h"
#include "nsString.h"
#include "nsPIDOMWindow.h"
#include "mozilla/dom/WindowGlobalParent.h"
class mozIDOMWindowProxy;
class nsEffectiveTLDService;
class nsIChannel;
class nsIPrincipal;
class nsIURI;
class nsPIDOMWindowOuter;
namespace mozilla {
namespace dom {
class WindowGlobalParent;
}
} // namespace mozilla
class ThirdPartyUtil final : public mozIThirdPartyUtil {
public:
NS_DECL_THREADSAFE_ISUPPORTS

View file

@ -142,6 +142,7 @@ EXPORTS.mozilla.dom += [
"AnonymousContent.h",
"Attr.h",
"AutoPrintEventDispatcher.h",
"AutoSuppressEventHandlingAndSuspend.h",
"BarProps.h",
"BindContext.h",
"BodyConsumer.h",

View file

@ -3525,26 +3525,6 @@ class MOZ_STACK_CLASS nsAutoScriptBlockerSuppressNodeRemoved
namespace mozilla {
namespace dom {
/**
* Suppresses event handling and suspends the active inner window for all
* in-process documents in a BrowsingContextGroup. This should be used while
* spinning the event loop for a synchronous operation (like `window.open()`)
* which affects operations in any other window in the same BrowsingContext
* group.
*/
class MOZ_RAII AutoSuppressEventHandlingAndSuspend {
public:
explicit AutoSuppressEventHandlingAndSuspend(BrowsingContextGroup* aGroup);
~AutoSuppressEventHandlingAndSuspend();
private:
void SuppressBrowsingContext(BrowsingContext* aBC);
AutoTArray<RefPtr<Document>, 16> mDocuments;
AutoTArray<nsCOMPtr<nsPIDOMWindowInner>, 16> mWindows;
};
class TreeOrderComparator {
public:
bool Equals(nsINode* aElem1, nsINode* aElem2) const {

View file

@ -6,14 +6,15 @@
#ifndef nsCopySupport_h__
#define nsCopySupport_h__
#include "nsError.h"
#include "mozilla/dom/Document.h"
#include <cstdint>
#include "ErrorList.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Attributes.h"
#include "mozilla/BasicEvents.h"
#include "nsStringFwd.h"
#include "mozilla/EventForwards.h"
class nsINode;
class nsIImageLoadingContent;
class nsIContent;
class nsITransferable;
class nsILoadContext;

View file

@ -9,6 +9,8 @@
* handling of loads in it, recursion-checking).
*/
#include "nsFrameLoader.h"
#include "base/basictypes.h"
#include "prenv.h"
@ -30,7 +32,6 @@
#include "nsUnicharUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h"
#include "nsFrameLoader.h"
#include "nsFrameLoaderOwner.h"
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"

View file

@ -21,7 +21,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/Promise.h"
@ -61,6 +60,7 @@ class OriginAttributes;
namespace dom {
class ChromeMessageSender;
class ContentParent;
class Document;
class TabListener;
class InProcessBrowserChildMessageManager;
class MessageSender;

View file

@ -2519,6 +2519,10 @@ void nsGlobalWindowInner::UpdateTopInnerWindow() {
mTopInnerWindow->UpdateWebSocketCount(-(int32_t)mNumOfOpenWebSockets);
}
bool nsGlobalWindowInner::IsInSyncOperation() {
return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
}
bool nsGlobalWindowInner::IsSharedMemoryAllowed() const {
MOZ_ASSERT(NS_IsMainThread());

View file

@ -47,7 +47,6 @@
#include "mozilla/OwningNonNull.h"
#include "mozilla/TimeStamp.h"
#include "nsWrapperCacheInlines.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/WindowBinding.h"
#include "mozilla/dom/WindowProxyHolder.h"
@ -948,9 +947,7 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
void UpdateTopInnerWindow();
virtual bool IsInSyncOperation() override {
return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
}
virtual bool IsInSyncOperation() override;
bool IsSharedMemoryAllowed() const override;

View file

@ -7441,6 +7441,10 @@ nsIDOMWindowUtils* nsGlobalWindowOuter::WindowUtils() {
return mWindowUtils;
}
bool nsGlobalWindowOuter::IsInSyncOperation() {
return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
}
// Note: This call will lock the cursor, it will not change as it moves.
// To unlock, the cursor must be set back to Auto.
void nsGlobalWindowOuter::SetCursorOuter(const nsACString& aCursor,

View file

@ -43,7 +43,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include "nsWrapperCacheInlines.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/WindowBinding.h"
#include "Units.h"
@ -93,6 +92,7 @@ class Console;
class Crypto;
class CustomElementRegistry;
class DocGroup;
class Document;
class External;
class Function;
class Gamepad;
@ -674,9 +674,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
nsIDOMWindowUtils* WindowUtils();
virtual bool IsInSyncOperation() override {
return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
}
virtual bool IsInSyncOperation() override;
void ParentWindowChanged() {
// Reset our storage access permission flag when we get reparented.

View file

@ -1445,6 +1445,16 @@ bool CanvasRenderingContext2D::TryBasicTarget(
return true;
}
PresShell* CanvasRenderingContext2D::GetPresShell() {
if (mCanvasElement) {
return mCanvasElement->OwnerDoc()->GetPresShell();
}
if (mDocShell) {
return mDocShell->GetPresShell();
}
return nullptr;
}
NS_IMETHODIMP
CanvasRenderingContext2D::SetDimensions(int32_t aWidth, int32_t aHeight) {
// Zero sized surfaces can cause problems.

View file

@ -403,15 +403,7 @@ class CanvasRenderingContext2D final : public nsICanvasRenderingContextInternal,
/**
* Gets the pres shell from either the canvas element or the doc shell
*/
PresShell* GetPresShell() final {
if (mCanvasElement) {
return mCanvasElement->OwnerDoc()->GetPresShell();
}
if (mDocShell) {
return mDocShell->GetPresShell();
}
return nullptr;
}
PresShell* GetPresShell() final;
NS_IMETHOD SetDimensions(int32_t aWidth, int32_t aHeight) override;
NS_IMETHOD InitializeWithDrawTarget(
nsIDocShell* aShell, NotNull<gfx::DrawTarget*> aTarget) override;

View file

@ -8,7 +8,6 @@
#include "CanvasRenderingContextHelper.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/ToJSValue.h"
#include "jsapi.h"
#include "js/Array.h" // JS::GetArrayLength
@ -19,6 +18,7 @@ class nsIPrincipal;
namespace mozilla {
namespace dom {
class Document;
class HTMLCanvasElement;
} // namespace dom

View file

@ -5,6 +5,7 @@
#include "nsICanvasRenderingContextInternal.h"
#include "mozilla/dom/Document.h"
#include "nsRefreshDriver.h"
nsICanvasRenderingContextInternal::nsICanvasRenderingContextInternal()
@ -14,6 +15,13 @@ nsICanvasRenderingContextInternal::nsICanvasRenderingContextInternal()
nsICanvasRenderingContextInternal::~nsICanvasRenderingContextInternal() =
default;
mozilla::PresShell* nsICanvasRenderingContextInternal::GetPresShell() {
if (mCanvasElement) {
return mCanvasElement->OwnerDoc()->GetPresShell();
}
return nullptr;
}
void nsICanvasRenderingContextInternal::RemovePostRefreshObserver() {
if (mRefreshDriver) {
mRefreshDriver->RemovePostRefreshObserver(this);

View file

@ -73,12 +73,7 @@ class nsICanvasRenderingContextInternal : public nsISupports,
AddPostRefreshObserverIfNecessary();
}
virtual mozilla::PresShell* GetPresShell() {
if (mCanvasElement) {
return mCanvasElement->OwnerDoc()->GetPresShell();
}
return nullptr;
}
virtual mozilla::PresShell* GetPresShell();
void RemovePostRefreshObserver();

View file

@ -44,6 +44,8 @@ typedef uint16_t nsMediaReadyState;
typedef uint32_t SuspendTypes;
typedef uint32_t AudibleChangedReasons;
class nsIStreamListener;
namespace mozilla {
class AbstractThread;
class ChannelMediaDecoder;

View file

@ -47,6 +47,7 @@
#include "mozilla/WebBrowserPersistDocumentChild.h"
#include "mozilla/devtools/HeapSnapshotTempFileHelperChild.h"
#include "mozilla/docshell/OfflineCacheUpdateChild.h"
#include "mozilla/dom/AutoSuppressEventHandlingAndSuspend.h"
#include "mozilla/dom/BlobImpl.h"
#include "mozilla/dom/BrowserBridgeHost.h"
#include "mozilla/dom/BrowsingContext.h"

View file

@ -17,7 +17,6 @@
#include "nsIObserver.h"
#include "nsIDOMEventListener.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/extensions/WebExtensionContentScript.h"
namespace mozilla {
namespace dom {

View file

@ -13,7 +13,6 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/JSActor.h"
#include "mozilla/extensions/WebExtensionContentScript.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIDOMProcessParent.h"
#include "nsWrapperCache.h"

View file

@ -9,13 +9,13 @@
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/JSActorService.h"
#include "mozilla/extensions/MatchPattern.h"
#include "mozilla/ErrorResult.h"
#include "nsIURI.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsIObserver.h"
#include "nsIDOMEventListener.h"
#include "mozilla/extensions/WebExtensionContentScript.h"
namespace mozilla {
namespace dom {

View file

@ -7,12 +7,15 @@
#ifndef mozilla_dom_l10n_DocumentL10n_h
#define mozilla_dom_l10n_DocumentL10n_h
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DOMLocalization.h"
class nsIContentSink;
namespace mozilla {
namespace dom {
class Document;
enum class DocumentL10nState {
// State set when the DocumentL10n gets constructed.
Constructed = 0,

View file

@ -6,24 +6,21 @@
#ifndef GMPService_h_
#define GMPService_h_
#include "ChromiumCDMParent.h"
#include "GMPContentParent.h"
#include "GMPCrashHelper.h"
#include "MediaResult.h"
#include "mozIGeckoMediaPluginService.h"
#include "mozilla/Atomics.h"
#include "mozilla/Attributes.h"
#include "mozilla/Monitor.h"
#include "mozilla/MozPromise.h"
#include "mozilla/dom/Document.h"
#include "nsCOMPtr.h"
#include "nsClassHashtable.h"
#include "nsIAsyncShutdown.h"
#include "nsISupportsImpl.h"
#include "nsIThread.h"
#include "nsIObserver.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
class nsIAsyncShutdownClient;
class nsIRunnable;
class nsISerialEventTarget;
class nsIThread;
template <class>
struct already_AddRefed;
@ -31,6 +28,7 @@ struct already_AddRefed;
namespace mozilla {
class GMPCrashHelper;
class MediaResult;
extern LogModule* GetGMPLog();

View file

@ -13,7 +13,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsIWebVTTParserWrapper.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/HTMLDivElement.h"
#include "mozilla/dom/TextTrack.h"
#include "mozilla/StateWatching.h"
@ -21,6 +20,7 @@
namespace mozilla {
namespace dom {
class Document;
class HTMLTrackElement;
class TextTrackRegion;

View file

@ -4153,6 +4153,41 @@ bool ScriptLoader::MaybeRemovedDeferRequests() {
return false;
}
DocGroup* ScriptLoader::GetDocGroup() const { return mDocument->GetDocGroup(); }
void ScriptLoader::BeginDeferringScripts() {
mDeferEnabled = true;
if (mDeferCheckpointReached) {
// We already completed a parse and were just waiting for some async
// scripts to load (and were already blocking the load event waiting for
// that to happen), when document.open() happened and now we're doing a
// new parse. We shouldn't block the load event again, but _should_ reset
// mDeferCheckpointReached to false. It'll get set to true again when the
// DeferCheckpointReached call that corresponds to this
// BeginDeferringScripts call happens (on document.close()), since we just
// set mDeferEnabled to true.
mDeferCheckpointReached = false;
} else {
if (mDocument) {
mDocument->BlockOnload();
}
}
}
nsAutoScriptLoaderDisabler::nsAutoScriptLoaderDisabler(Document* aDoc) {
mLoader = aDoc->ScriptLoader();
mWasEnabled = mLoader->GetEnabled();
if (mWasEnabled) {
mLoader->SetEnabled(false);
}
}
nsAutoScriptLoaderDisabler::~nsAutoScriptLoaderDisabler() {
if (mWasEnabled) {
mLoader->SetEnabled(true);
}
}
#undef TRACE_FOR_TEST
#undef TRACE_FOR_TEST_BOOL
#undef TRACE_FOR_TEST_NONE

View file

@ -14,7 +14,6 @@
#include "nsCOMArray.h"
#include "nsCycleCollectionParticipant.h"
#include "nsTArray.h"
#include "mozilla/dom/Document.h"
#include "nsIIncrementalStreamLoader.h"
#include "nsINode.h"
#include "nsIObserver.h"
@ -43,6 +42,7 @@ namespace mozilla {
namespace dom {
class AutoJSAPI;
class Document;
class LoadedScript;
class ModuleLoadRequest;
class ModuleScript;
@ -302,24 +302,7 @@ class ScriptLoader final : public nsISupports {
* Starts deferring deferred scripts and puts them in the mDeferredRequests
* queue instead.
*/
void BeginDeferringScripts() {
mDeferEnabled = true;
if (mDeferCheckpointReached) {
// We already completed a parse and were just waiting for some async
// scripts to load (and were already blocking the load event waiting for
// that to happen), when document.open() happened and now we're doing a
// new parse. We shouldn't block the load event again, but _should_ reset
// mDeferCheckpointReached to false. It'll get set to true again when the
// DeferCheckpointReached call that corresponds to this
// BeginDeferringScripts call happens (on document.close()), since we just
// set mDeferEnabled to true.
mDeferCheckpointReached = false;
} else {
if (mDocument) {
mDocument->BlockOnload();
}
}
}
void BeginDeferringScripts();
/**
* Notifies the script loader that parsing is done. If aTerminated is true,
@ -380,9 +363,7 @@ class ScriptLoader final : public nsISupports {
return true;
}
mozilla::dom::DocGroup* GetDocGroup() const {
return mDocument->GetDocGroup();
}
mozilla::dom::DocGroup* GetDocGroup() const;
/**
* Register the fact that we saw the load event, and that we need to save the
@ -718,19 +699,9 @@ class ScriptLoader final : public nsISupports {
class nsAutoScriptLoaderDisabler {
public:
explicit nsAutoScriptLoaderDisabler(Document* aDoc) {
mLoader = aDoc->ScriptLoader();
mWasEnabled = mLoader->GetEnabled();
if (mWasEnabled) {
mLoader->SetEnabled(false);
}
}
explicit nsAutoScriptLoaderDisabler(Document* aDoc);
~nsAutoScriptLoaderDisabler() {
if (mWasEnabled) {
mLoader->SetEnabled(true);
}
}
~nsAutoScriptLoaderDisabler();
bool mWasEnabled;
RefPtr<ScriptLoader> mLoader;

View file

@ -14,6 +14,10 @@
#include "nsIParserUtils.h"
#include "nsTreeSanitizer.h"
// XXX(Bug 1673929) This is not really needed here, but the generated
// SanitizerBinding.cpp needs it and does not include it.
#include "mozilla/dom/Document.h"
class nsISupports;
namespace mozilla {

View file

@ -7,22 +7,22 @@
#ifndef mozilla_dom_serviceworkerregistrationimpl_h
#define mozilla_dom_serviceworkerregistrationimpl_h
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/Unused.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/Document.h"
#include "nsPIDOMWindow.h"
#include "ServiceWorkerManager.h"
#include "ServiceWorkerRegistration.h"
#include "ServiceWorkerRegistrationListener.h"
#include "mozilla/Assertions.h"
#include "mozilla/Mutex.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h"
#include "mozilla/dom/ServiceWorkerUtils.h"
#include "nsISupports.h"
#include "nsStringFwd.h"
namespace mozilla {
namespace dom {
class Promise;
class PushManager;
class ServiceWorker;
class ServiceWorkerRegistrationInfo;
class WeakWorkerRef;
class WorkerPrivate;
////////////////////////////////////////////////////
// Main Thread implementation

View file

@ -6,6 +6,8 @@
#include "mozilla/dom/AuthenticatorResponse.h"
#include "nsPIDOMWindow.h"
namespace mozilla {
namespace dom {
@ -42,6 +44,8 @@ AuthenticatorResponse::~AuthenticatorResponse() {
// Call DropJSObjects() in subclasses.
}
nsISupports* AuthenticatorResponse::GetParentObject() const { return mParent; }
void AuthenticatorResponse::GetClientDataJSON(
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
if (!mClientDataJSONCachedObj) {

View file

@ -31,7 +31,7 @@ class AuthenticatorResponse : public nsISupports, public nsWrapperCache {
virtual ~AuthenticatorResponse();
public:
nsISupports* GetParentObject() const { return mParent; }
nsISupports* GetParentObject() const;
void GetFormat(nsString& aRetVal) const;

View file

@ -10,7 +10,6 @@
#include "mozilla/NotNull.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/Document.h"
#include "nsIURI.h"
#include "nsIWebBrowserPersistDocument.h"
@ -19,6 +18,10 @@ class nsISHEntry;
namespace mozilla {
namespace dom {
class Document;
}
class WebBrowserPersistLocalDocument final
: public nsIWebBrowserPersistDocument {
public:

View file

@ -5719,4 +5719,26 @@ void EditorBase::TopLevelEditSubActionData::WillDeleteRange(
"failed, but ignored");
}
nsPIDOMWindowOuter* EditorBase::GetWindow() const {
return mDocument ? mDocument->GetWindow() : nullptr;
}
nsPIDOMWindowInner* EditorBase::GetInnerWindow() const {
return mDocument ? mDocument->GetInnerWindow() : nullptr;
}
PresShell* EditorBase::GetPresShell() const {
return mDocument ? mDocument->GetPresShell() : nullptr;
}
nsISelectionController* EditorBase::GetSelectionController() const {
if (mSelectionController) {
return mSelectionController;
}
if (!mDocument) {
return nullptr;
}
return mDocument->GetPresShell();
}
} // namespace mozilla

View file

@ -27,7 +27,6 @@
#include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsGkAtoms.h"
#include "mozilla/dom/Document.h"
#include "nsIContentInlines.h" // for nsINode::IsEditable()
#include "nsIEditor.h" // for nsIEditor, etc.
#include "nsIFrame.h" // for nsBidiLevel
@ -106,6 +105,7 @@ typedef CreateNodeResultBase<dom::Element> CreateElementResult;
namespace dom {
class AbstractRange;
class DataTransfer;
class Document;
class DragEvent;
class Element;
class EventTarget;
@ -197,12 +197,8 @@ class EditorBase : public nsIEditor,
bool Destroyed() const { return mDidPreDestroy; }
Document* GetDocument() const { return mDocument; }
nsPIDOMWindowOuter* GetWindow() const {
return mDocument ? mDocument->GetWindow() : nullptr;
}
nsPIDOMWindowInner* GetInnerWindow() const {
return mDocument ? mDocument->GetInnerWindow() : nullptr;
}
nsPIDOMWindowOuter* GetWindow() const;
nsPIDOMWindowInner* GetInnerWindow() const;
/**
* MayHaveMutationEventListeners() returns true when the window may have
@ -263,9 +259,7 @@ class EditorBase : public nsIEditor,
return false;
}
PresShell* GetPresShell() const {
return mDocument ? mDocument->GetPresShell() : nullptr;
}
PresShell* GetPresShell() const;
nsPresContext* GetPresContext() const {
PresShell* presShell = GetPresShell();
return presShell ? presShell->GetPresContext() : nullptr;
@ -280,15 +274,7 @@ class EditorBase : public nsIEditor,
already_AddRefed<nsIWidget> GetWidget();
nsISelectionController* GetSelectionController() const {
if (mSelectionController) {
return mSelectionController;
}
if (!mDocument) {
return nullptr;
}
return mDocument->GetPresShell();
}
nsISelectionController* GetSelectionController() const;
nsresult GetSelection(SelectionType aSelectionType,
Selection** aSelection) const;

View file

@ -9,7 +9,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/Document.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/Document.h"
#include "nsString.h"
#include "nsTArray.h"
@ -20,6 +19,10 @@ class nsINode;
namespace mozilla {
class TextEditor;
namespace dom {
class Document;
}
} // namespace mozilla
struct NodeOffset {

View file

@ -9,7 +9,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/dom/Document.h"
#include "mozilla/Mutex.h"
#include "mozilla/UniquePtr.h"
@ -34,7 +33,9 @@ class imgCacheExpirationTracker;
class imgMemoryReporter;
namespace mozilla {
namespace image {} // namespace image
namespace dom {
class Document;
}
} // namespace mozilla
class imgCacheEntry {

View file

@ -23,6 +23,7 @@
#include "nsIContentViewer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsIScreen.h"
#include "mozilla/dom/AutoSuppressEventHandlingAndSuspend.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/BeforeUnloadEvent.h"
#include "mozilla/dom/PopupBlocker.h"

View file

@ -10,9 +10,12 @@
#include "mozilla/dom/Document.h"
#include "nsContentSink.h"
#include "nsHtml5DocumentMode.h"
#include "mozilla/dom/Document.h"
#include "nsIContent.h"
namespace mozilla::dom {
class Document;
}
typedef nsIContent* nsIContentPtr;
enum eHtml5FlushState {

View file

@ -4,6 +4,8 @@
* 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/. */
#include "StorageAccess.h"
#include "mozilla/dom/Document.h"
#include "mozilla/net/CookieJarSettings.h"
#include "mozilla/ContentBlocking.h"
@ -331,6 +333,16 @@ bool StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
return disabled;
}
bool StorageDisabledByAntiTracking(dom::Document* aDocument, nsIURI* aURI) {
uint32_t rejectedReason = 0;
// Note that GetChannel() below may return null, but that's OK, since the
// callee is able to deal with a null channel argument, and if passed null,
// will only fail to notify the UI in case storage gets blocked.
return StorageDisabledByAntiTracking(
aDocument->GetInnerWindow(), aDocument->GetChannel(),
aDocument->NodePrincipal(), aURI, rejectedReason);
}
bool ShouldPartitionStorage(StorageAccess aAccess) {
return aAccess == StorageAccess::ePartitionTrackersOrDeny ||
aAccess == StorageAccess::ePartitionForeignOrDeny;

View file

@ -7,7 +7,7 @@
#ifndef mozilla_StorageAccess_h
#define mozilla_StorageAccess_h
#include "mozilla/dom/Document.h"
#include <cstdint>
class nsIChannel;
class nsICookieJarSettings;
@ -16,6 +16,9 @@ class nsIURI;
class nsPIDOMWindowInner;
namespace mozilla {
namespace dom {
class Document;
}
// The order of these entries matters, as we use std::min for total ordering
// of permissions. Private Browsing is considered to be more limiting
@ -99,16 +102,7 @@ bool StorageDisabledByAntiTracking(nsPIDOMWindowInner* aWindow,
* Returns true if this document should disable storages because of the
* anti-tracking feature.
*/
inline bool StorageDisabledByAntiTracking(dom::Document* aDocument,
nsIURI* aURI) {
uint32_t rejectedReason = 0;
// Note that GetChannel() below may return null, but that's OK, since the
// callee is able to deal with a null channel argument, and if passed null,
// will only fail to notify the UI in case storage gets blocked.
return StorageDisabledByAntiTracking(
aDocument->GetInnerWindow(), aDocument->GetChannel(),
aDocument->NodePrincipal(), aURI, rejectedReason);
}
bool StorageDisabledByAntiTracking(dom::Document* aDocument, nsIURI* aURI);
bool ShouldPartitionStorage(StorageAccess aAccess);

View file

@ -19,6 +19,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsISupports.h"
#include "nsIDocShell.h"
#include "nsPIDOMWindow.h"
#include "nsWrapperCache.h"
class nsILoadInfo;

View file

@ -330,6 +330,14 @@ void WebExtensionPolicy::UnregisterContentScript(
WebExtensionPolicy_Binding::ClearCachedContentScriptsValue(this);
}
bool WebExtensionPolicy::CanAccessURI(const URLInfo& aURI, bool aExplicit,
bool aCheckRestricted,
bool aAllowFilePermission) const {
return (!aCheckRestricted || !IsRestrictedURI(aURI)) && mHostPermissions &&
mHostPermissions->Matches(aURI, aExplicit) &&
(aURI.Scheme() != nsGkAtoms::file || aAllowFilePermission);
}
void WebExtensionPolicy::InjectContentScripts(ErrorResult& aRv) {
nsresult rv = EPS().InjectContentScripts(this);
if (NS_FAILED(rv)) {
@ -476,6 +484,11 @@ void WebExtensionPolicy::GetContentScripts(
aScripts.AppendElements(mContentScripts);
}
bool WebExtensionPolicy::PrivateBrowsingAllowed() const {
return mAllowPrivateBrowsingByDefault ||
HasPermission(nsGkAtoms::privateBrowsingAllowedPermission);
}
bool WebExtensionPolicy::CanAccessContext(nsILoadContext* aContext) const {
MOZ_ASSERT(aContext);
return PrivateBrowsingAllowed() || !aContext->UsePrivateBrowsing();

View file

@ -75,11 +75,7 @@ class WebExtensionPolicy final : public nsISupports,
bool CanAccessURI(const URLInfo& aURI, bool aExplicit = false,
bool aCheckRestricted = true,
bool aAllowFilePermission = false) const {
return (!aCheckRestricted || !IsRestrictedURI(aURI)) && mHostPermissions &&
mHostPermissions->Matches(aURI, aExplicit) &&
(aURI.Scheme() != nsGkAtoms::file || aAllowFilePermission);
}
bool aAllowFilePermission = false) const;
bool IsPathWebAccessible(const nsAString& aPath) const {
return mWebAccessiblePaths.Matches(aPath);
@ -129,10 +125,7 @@ class WebExtensionPolicy final : public nsISupports,
bool Active() const { return mActive; }
void SetActive(bool aActive, ErrorResult& aRv);
bool PrivateBrowsingAllowed() const {
return mAllowPrivateBrowsingByDefault ||
HasPermission(nsGkAtoms::privateBrowsingAllowedPermission);
}
bool PrivateBrowsingAllowed() const;
bool CanAccessContext(nsILoadContext* aContext) const;

View file

@ -6,35 +6,71 @@
#include "nsRFPService.h"
#include <algorithm>
#include <memory>
#include <time.h>
#include <cfloat>
#include <cinttypes>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <new>
#include <type_traits>
#include <utility>
#include "MainThreadUtils.h"
#include "mozilla/ArrayIterator.h"
#include "mozilla/Assertions.h"
#include "mozilla/Atomics.h"
#include "mozilla/Casting.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/Element.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/HelperMacros.h"
#include "mozilla/Likely.h"
#include "mozilla/Logging.h"
#include "mozilla/MacroForEach.h"
#include "mozilla/Mutex.h"
#include "mozilla/Preferences.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/fallible.h"
#include "nsBaseHashtable.h"
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsCoord.h"
#include "nsDataHashtable.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsHashKeys.h"
#include "nsJSUtils.h"
#include "nsLiteralString.h"
#include "nsPrintfCString.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
#include "nsPrintfCString.h"
#include "nsStringFlags.h"
#include "nsTArray.h"
#include "nsTLiteralString.h"
#include "nsTPromiseFlatString.h"
#include "nsTStringRepr.h"
#include "nsXPCOM.h"
#include "nsICryptoHash.h"
#include "nsIGlobalObject.h"
#include "nsIObserverService.h"
#include "nsIRandomGenerator.h"
#include "nsIXULAppInfo.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "prenv.h"
#include "nss.h"
#include "prtime.h"
#include "xpcpublic.h"
#include "js/Date.h"
@ -68,6 +104,41 @@ nsDataHashtable<KeyboardHashKey, const SpoofingKeyboardCode*>*
nsRFPService::sSpoofingKeyboardCodes = nullptr;
static mozilla::StaticMutex sLock;
KeyboardHashKey::KeyboardHashKey(const KeyboardLangs aLang,
const KeyboardRegions aRegion,
const KeyNameIndexType aKeyIdx,
const nsAString& aKey)
: mLang(aLang), mRegion(aRegion), mKeyIdx(aKeyIdx), mKey(aKey) {}
KeyboardHashKey::KeyboardHashKey(KeyTypePointer aOther)
: mLang(aOther->mLang),
mRegion(aOther->mRegion),
mKeyIdx(aOther->mKeyIdx),
mKey(aOther->mKey) {}
KeyboardHashKey::KeyboardHashKey(KeyboardHashKey&& aOther)
: PLDHashEntryHdr(std::move(aOther)),
mLang(std::move(aOther.mLang)),
mRegion(std::move(aOther.mRegion)),
mKeyIdx(std::move(aOther.mKeyIdx)),
mKey(std::move(aOther.mKey)) {}
KeyboardHashKey::~KeyboardHashKey() = default;
bool KeyboardHashKey::KeyEquals(KeyTypePointer aOther) const {
return mLang == aOther->mLang && mRegion == aOther->mRegion &&
mKeyIdx == aOther->mKeyIdx && mKey == aOther->mKey;
}
KeyboardHashKey::KeyTypePointer KeyboardHashKey::KeyToPointer(KeyType aKey) {
return &aKey;
}
PLDHashNumber KeyboardHashKey::HashKey(KeyTypePointer aKey) {
PLDHashNumber hash = mozilla::HashString(aKey->mKey);
return mozilla::AddToHash(hash, aKey->mRegion, aKey->mKeyIdx, aKey->mLang);
}
/* static */
nsRFPService* nsRFPService::GetOrCreate() {
if (!sInitialized) {

View file

@ -6,14 +6,13 @@
#ifndef __nsRFPService_h__
#define __nsRFPService_h__
#include "mozilla/Atomics.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Mutex.h"
#include "mozilla/dom/Document.h"
#include <cstdint>
#include "ErrorList.h"
#include "PLDHashTable.h"
#include "mozilla/BasicEvents.h"
#include "nsIObserver.h"
#include "nsDataHashtable.h"
#include "nsString.h"
#include "nsISupports.h"
#include "nsStringFwd.h"
// Defines regarding spoofed values of Navigator object. These spoofed values
// are returned when 'privacy.resistFingerprinting' is true.
@ -59,10 +58,18 @@
# define SPOOFED_HTTP_UA_OS "Windows NT 10.0"
#endif
struct JSContext;
template <class KeyClass, class DataType>
class nsDataHashtable;
// Forward declare LRUCache, defined in nsRFPService.cpp
class LRUCache;
namespace mozilla {
class WidgetKeyboardEvent;
namespace dom {
class Document;
}
enum KeyboardLang { EN = 0x01 };
@ -96,35 +103,19 @@ class KeyboardHashKey : public PLDHashEntryHdr {
typedef const KeyboardHashKey* KeyTypePointer;
KeyboardHashKey(const KeyboardLangs aLang, const KeyboardRegions aRegion,
const KeyNameIndexType aKeyIdx, const nsAString& aKey)
: mLang(aLang), mRegion(aRegion), mKeyIdx(aKeyIdx), mKey(aKey) {}
const KeyNameIndexType aKeyIdx, const nsAString& aKey);
explicit KeyboardHashKey(KeyTypePointer aOther)
: mLang(aOther->mLang),
mRegion(aOther->mRegion),
mKeyIdx(aOther->mKeyIdx),
mKey(aOther->mKey) {}
explicit KeyboardHashKey(KeyTypePointer aOther);
KeyboardHashKey(KeyboardHashKey&& aOther)
: PLDHashEntryHdr(std::move(aOther)),
mLang(std::move(aOther.mLang)),
mRegion(std::move(aOther.mRegion)),
mKeyIdx(std::move(aOther.mKeyIdx)),
mKey(std::move(aOther.mKey)) {}
KeyboardHashKey(KeyboardHashKey&& aOther);
~KeyboardHashKey() = default;
~KeyboardHashKey();
bool KeyEquals(KeyTypePointer aOther) const {
return mLang == aOther->mLang && mRegion == aOther->mRegion &&
mKeyIdx == aOther->mKeyIdx && mKey == aOther->mKey;
}
bool KeyEquals(KeyTypePointer aOther) const;
static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
static KeyTypePointer KeyToPointer(KeyType aKey);
static PLDHashNumber HashKey(KeyTypePointer aKey) {
PLDHashNumber hash = mozilla::HashString(aKey->mKey);
return mozilla::AddToHash(hash, aKey->mRegion, aKey->mKeyIdx, aKey->mLang);
}
static PLDHashNumber HashKey(KeyTypePointer aKey);
enum { ALLOW_MEMMOVE = true };

View file

@ -11,7 +11,6 @@
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/Document.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIURI.h"
@ -21,6 +20,10 @@
class nsPIDOMWindowInner;
namespace mozilla {
namespace dom {
class Document;
}
namespace docshell {
class OfflineCacheUpdateChild : public nsIOfflineCacheUpdate,

View file

@ -12,7 +12,6 @@
#import <Cocoa/Cocoa.h>
#include "mozilla/dom/Document.h"
#include "nsTouchBarInput.h"
#include "nsTouchBarNativeAPIDefines.h"
#include "IconLoaderHelperCocoa.h"
@ -23,6 +22,10 @@ class nsIURI;
class nsIPrincipal;
class imgRequestProxy;
namespace mozilla::dom {
class Document;
}
class nsTouchBarInputIcon : public mozilla::widget::IconLoaderListenerCocoa {
public:
explicit nsTouchBarInputIcon(RefPtr<Document> aDocument,