1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_CanonicalBrowsingContext_h
8 #define mozilla_dom_CanonicalBrowsingContext_h
10 #include "mozilla/dom/BrowsingContext.h"
11 #include "mozilla/dom/MediaControlKeySource.h"
12 #include "mozilla/dom/BrowsingContextWebProgress.h"
13 #include "mozilla/dom/ProcessIsolation.h"
14 #include "mozilla/dom/Promise.h"
15 #include "mozilla/dom/SessionHistoryEntry.h"
16 #include "mozilla/dom/SessionStoreRestoreData.h"
17 #include "mozilla/dom/SessionStoreUtils.h"
18 #include "mozilla/dom/ipc/IdType.h"
19 #include "mozilla/RefPtr.h"
20 #include "mozilla/MozPromise.h"
21 #include "nsCycleCollectionParticipant.h"
22 #include "nsWrapperCache.h"
24 #include "nsTHashtable.h"
25 #include "nsHashKeys.h"
26 #include "nsISecureBrowserUI.h"
28 class nsIBrowserDOMWindow
;
31 class nsIPrintSettings
;
33 class nsBrowserStatusFilter
;
34 class nsSecureBrowserUI
;
35 class CallerWillNotifyHistoryIndexAndLengthChanges
;
40 class BounceTrackingState
;
47 class DocumentLoadListener
;
53 class BrowserBridgeParent
;
55 struct LoadURIOptions
;
56 class MediaController
;
57 struct LoadingSessionHistoryInfo
;
59 class WindowGlobalParent
;
60 class SessionStoreFormData
;
61 class SessionStoreScrollData
;
63 // CanonicalBrowsingContext is a BrowsingContext living in the parent
64 // process, with whatever extra data that a BrowsingContext in the
66 class CanonicalBrowsingContext final
: public BrowsingContext
{
68 NS_DECL_ISUPPORTS_INHERITED
69 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
70 CanonicalBrowsingContext
, BrowsingContext
)
72 static already_AddRefed
<CanonicalBrowsingContext
> Get(uint64_t aId
);
73 static CanonicalBrowsingContext
* Cast(BrowsingContext
* aContext
);
74 static const CanonicalBrowsingContext
* Cast(const BrowsingContext
* aContext
);
75 static already_AddRefed
<CanonicalBrowsingContext
> Cast(
76 already_AddRefed
<BrowsingContext
>&& aContext
);
78 bool IsOwnedByProcess(uint64_t aProcessId
) const {
79 return mProcessId
== aProcessId
;
81 bool IsEmbeddedInProcess(uint64_t aProcessId
) const {
82 return mEmbedderProcessId
== aProcessId
;
84 uint64_t OwnerProcessId() const { return mProcessId
; }
85 uint64_t EmbedderProcessId() const { return mEmbedderProcessId
; }
86 ContentParent
* GetContentParent() const;
88 void GetCurrentRemoteType(nsACString
& aRemoteType
, ErrorResult
& aRv
) const;
90 void SetOwnerProcessId(uint64_t aProcessId
);
92 // The ID of the BrowsingContext which caused this BrowsingContext to be
93 // opened, or `0` if this is unknown.
94 // Only set for toplevel content BrowsingContexts, and may be from a different
95 // BrowsingContextGroup.
96 uint64_t GetCrossGroupOpenerId() const { return mCrossGroupOpenerId
; }
97 void SetCrossGroupOpenerId(uint64_t aOpenerId
);
98 void SetCrossGroupOpener(CanonicalBrowsingContext
& aCrossGroupOpener
,
101 void GetWindowGlobals(nsTArray
<RefPtr
<WindowGlobalParent
>>& aWindows
);
103 // The current active WindowGlobal.
104 WindowGlobalParent
* GetCurrentWindowGlobal() const;
106 // Same as the methods on `BrowsingContext`, but with the types already cast
107 // to the parent process type.
108 CanonicalBrowsingContext
* GetParent() {
109 return Cast(BrowsingContext::GetParent());
111 CanonicalBrowsingContext
* Top() { return Cast(BrowsingContext::Top()); }
112 WindowGlobalParent
* GetParentWindowContext();
113 WindowGlobalParent
* GetTopWindowContext();
115 already_AddRefed
<nsIWidget
> GetParentProcessWidgetContaining();
116 already_AddRefed
<nsIBrowserDOMWindow
> GetBrowserDOMWindow();
118 // Same as `GetParentWindowContext`, but will also cross <browser> and
119 // content/chrome boundaries.
120 already_AddRefed
<WindowGlobalParent
> GetEmbedderWindowGlobal() const;
122 CanonicalBrowsingContext
* GetParentCrossChromeBoundary();
123 CanonicalBrowsingContext
* TopCrossChromeBoundary();
124 Nullable
<WindowProxyHolder
> GetTopChromeWindow();
126 nsISHistory
* GetSessionHistory();
127 SessionHistoryEntry
* GetActiveSessionHistoryEntry();
128 void SetActiveSessionHistoryEntry(SessionHistoryEntry
* aEntry
);
130 bool ManuallyManagesActiveness() const;
132 UniquePtr
<LoadingSessionHistoryInfo
> CreateLoadingSessionHistoryEntryForLoad(
133 nsDocShellLoadState
* aLoadState
, SessionHistoryEntry
* aExistingEntry
,
134 nsIChannel
* aChannel
);
136 UniquePtr
<LoadingSessionHistoryInfo
> ReplaceLoadingSessionHistoryEntryForLoad(
137 LoadingSessionHistoryInfo
* aInfo
, nsIChannel
* aNewChannel
);
140 MozPromise
<MaybeDiscardedBrowsingContext
, nsresult
, false>;
141 MOZ_CAN_RUN_SCRIPT RefPtr
<PrintPromise
> Print(nsIPrintSettings
*);
142 MOZ_CAN_RUN_SCRIPT already_AddRefed
<Promise
> PrintJS(nsIPrintSettings
*,
144 MOZ_CAN_RUN_SCRIPT RefPtr
<PrintPromise
> PrintWithNoContentAnalysis(
145 nsIPrintSettings
* aPrintSettings
, bool aForceStaticDocument
,
146 const MaybeDiscardedBrowsingContext
& aClonedStaticBrowsingContext
);
147 MOZ_CAN_RUN_SCRIPT
void ReleaseClonedPrint(
148 const MaybeDiscardedBrowsingContext
& aClonedStaticBrowsingContext
);
149 // Call the given callback on all top-level descendant BrowsingContexts.
150 // Return Callstate::Stop from the callback to stop calling further children.
152 // If aIncludeNestedBrowsers is true, then all top descendants are included,
153 // even those inside a nested top browser.
154 void CallOnAllTopDescendants(
155 const FunctionRef
<CallState(CanonicalBrowsingContext
*)>& aCallback
,
156 bool aIncludeNestedBrowsers
);
158 void SessionHistoryCommit(uint64_t aLoadId
, const nsID
& aChangeID
,
159 uint32_t aLoadType
, bool aPersist
,
160 bool aCloneEntryChildren
, bool aChannelExpired
,
163 // Calls the session history listeners' OnHistoryReload, storing the result in
164 // aCanReload. If aCanReload is set to true and we have an active or a loading
165 // entry then aLoadState will be initialized from that entry, and
166 // aReloadActiveEntry will be true if we have an active entry. If aCanReload
167 // is true and aLoadState and aReloadActiveEntry are not set then we should
168 // attempt to reload based on the current document in the docshell.
169 void NotifyOnHistoryReload(
170 bool aForceReload
, bool& aCanReload
,
171 Maybe
<NotNull
<RefPtr
<nsDocShellLoadState
>>>& aLoadState
,
172 Maybe
<bool>& aReloadActiveEntry
);
174 // See BrowsingContext::SetActiveSessionHistoryEntry.
175 void SetActiveSessionHistoryEntry(const Maybe
<nsPoint
>& aPreviousScrollPos
,
176 SessionHistoryInfo
* aInfo
,
178 uint32_t aUpdatedCacheKey
,
179 const nsID
& aChangeID
);
181 void ReplaceActiveSessionHistoryEntry(SessionHistoryInfo
* aInfo
);
183 void RemoveDynEntriesFromActiveSessionHistoryEntry();
185 void RemoveFromSessionHistory(const nsID
& aChangeID
);
187 Maybe
<int32_t> HistoryGo(int32_t aOffset
, uint64_t aHistoryEpoch
,
188 bool aRequireUserInteraction
, bool aUserActivation
,
189 Maybe
<ContentParentId
> aContentId
);
191 JSObject
* WrapObject(JSContext
* aCx
,
192 JS::Handle
<JSObject
*> aGivenProto
) override
;
194 // Dispatches a wheel zoom change to the embedder element.
195 void DispatchWheelZoomChange(bool aIncrease
);
197 // This function is used to start the autoplay media which are delayed to
198 // start. If needed, it would also notify the content browsing context which
199 // are related with the canonical browsing content tree to start delayed
201 void NotifyStartDelayedAutoplayMedia();
203 // This function is used to mute or unmute all media within a tab. It would
204 // set the media mute property for the top level window and propagate it to
205 // other top level windows in other processes.
206 void NotifyMediaMutedChanged(bool aMuted
, ErrorResult
& aRv
);
208 // Return the number of unique site origins by iterating all given BCs,
209 // including their subtrees.
210 static uint32_t CountSiteOrigins(
211 GlobalObject
& aGlobal
,
212 const Sequence
<mozilla::OwningNonNull
<BrowsingContext
>>& aRoots
);
214 // Return true if a private browsing session is active.
215 static bool IsPrivateBrowsingActive();
217 // This function would propogate the action to its all child browsing contexts
218 // in content processes.
219 void UpdateMediaControlAction(const MediaControlAction
& aAction
);
221 // Triggers a load in the process
222 using BrowsingContext::LoadURI
;
223 void FixupAndLoadURIString(const nsAString
& aURI
,
224 const LoadURIOptions
& aOptions
,
225 ErrorResult
& aError
);
226 void LoadURI(nsIURI
* aURI
, const LoadURIOptions
& aOptions
,
227 ErrorResult
& aError
);
229 void GoBack(const Optional
<int32_t>& aCancelContentJSEpoch
,
230 bool aRequireUserInteraction
, bool aUserActivation
);
231 void GoForward(const Optional
<int32_t>& aCancelContentJSEpoch
,
232 bool aRequireUserInteraction
, bool aUserActivation
);
233 void GoToIndex(int32_t aIndex
, const Optional
<int32_t>& aCancelContentJSEpoch
,
234 bool aUserActivation
);
235 void Reload(uint32_t aReloadFlags
);
236 void Stop(uint32_t aStopFlags
);
238 // Get the publicly exposed current URI loaded in this BrowsingContext.
239 already_AddRefed
<nsIURI
> GetCurrentURI() const;
240 void SetCurrentRemoteURI(nsIURI
* aCurrentRemoteURI
);
242 BrowserParent
* GetBrowserParent() const;
243 void SetCurrentBrowserParent(BrowserParent
* aBrowserParent
);
245 // Internal method to change which process a BrowsingContext is being loaded
246 // in. The returned promise will resolve when the process switch is completed.
248 // A NOT_REMOTE_TYPE aRemoteType argument will perform a process switch into
249 // the parent process, and the method will resolve with a null BrowserParent.
250 using RemotenessPromise
= MozPromise
<RefPtr
<BrowserParent
>, nsresult
, false>;
251 RefPtr
<RemotenessPromise
> ChangeRemoteness(
252 const NavigationIsolationOptions
& aOptions
, uint64_t aPendingSwitchId
);
254 // Return a media controller from the top-level browsing context that can
255 // control all media belonging to this browsing context tree. Return nullptr
256 // if the top-level browsing context has been discarded.
257 MediaController
* GetMediaController();
258 bool HasCreatedMediaController() const;
260 // Attempts to start loading the given load state in this BrowsingContext,
261 // without requiring any communication from a docshell. This will handle
262 // computing the right process to load in, and organising handoff to
263 // the right docshell when we get a response.
264 bool LoadInParent(nsDocShellLoadState
* aLoadState
, bool aSetNavigating
);
266 // Attempts to start loading the given load state in this BrowsingContext,
267 // in parallel with a DocumentChannelChild being created in the docshell.
268 // Requires the DocumentChannel to connect with this load for it to
269 // complete successfully.
270 bool AttemptSpeculativeLoadInParent(nsDocShellLoadState
* aLoadState
);
272 // Get or create a secure browser UI for this BrowsingContext
273 nsISecureBrowserUI
* GetSecureBrowserUI();
275 BrowsingContextWebProgress
* GetWebProgress() { return mWebProgress
; }
277 // Called when the current URI changes (from an
278 // nsIWebProgressListener::OnLocationChange event, so that we
279 // can update our security UI for the new location, or when the
280 // mixed content/https-only state for our current window is changed.
281 void UpdateSecurityState();
283 void MaybeAddAsProgressListener(nsIWebProgress
* aWebProgress
);
285 // Called when a navigation forces us to recreate our browsing
286 // context (for example, when switching in or out of the parent
288 // aNewContext is the newly created BrowsingContext that is replacing
290 void ReplacedBy(CanonicalBrowsingContext
* aNewContext
,
291 const NavigationIsolationOptions
& aRemotenessOptions
);
293 bool HasHistoryEntry(nsISHEntry
* aEntry
);
294 bool HasLoadingHistoryEntry(nsISHEntry
* aEntry
) {
295 for (const LoadingSessionHistoryEntry
& loading
: mLoadingEntries
) {
296 if (loading
.mEntry
== aEntry
) {
303 void SwapHistoryEntries(nsISHEntry
* aOldEntry
, nsISHEntry
* aNewEntry
);
305 void AddLoadingSessionHistoryEntry(uint64_t aLoadId
,
306 SessionHistoryEntry
* aEntry
);
308 void GetLoadingSessionHistoryInfoFromParent(
309 Maybe
<LoadingSessionHistoryInfo
>& aLoadingInfo
);
311 void HistoryCommitIndexAndLength();
313 void SynchronizeLayoutHistoryState();
315 void ResetScalingZoom();
317 void SetContainerFeaturePolicy(FeaturePolicy
* aContainerFeaturePolicy
);
318 FeaturePolicy
* GetContainerFeaturePolicy() const {
319 return mContainerFeaturePolicy
;
322 void SetRestoreData(SessionStoreRestoreData
* aData
, ErrorResult
& aError
);
323 void ClearRestoreState();
324 MOZ_CAN_RUN_SCRIPT_BOUNDARY
void RequestRestoreTabContent(
325 WindowGlobalParent
* aWindow
);
326 already_AddRefed
<Promise
> GetRestorePromise();
328 nsresult
WriteSessionStorageToSessionStore(
329 const nsTArray
<SSCacheCopy
>& aSesssionStorage
, uint32_t aEpoch
);
331 void UpdateSessionStoreSessionStorage(const std::function
<void()>& aDone
);
333 static void UpdateSessionStoreForStorage(uint64_t aBrowsingContextId
);
335 // Called when a BrowserParent for this BrowsingContext has been fully
336 // destroyed (i.e. `ActorDestroy` was called).
337 void BrowserParentDestroyed(BrowserParent
* aBrowserParent
,
338 bool aAbnormalShutdown
);
340 void StartUnloadingHost(uint64_t aChildID
);
341 void ClearUnloadingHost(uint64_t aChildID
);
343 bool AllowedInBFCache(const Maybe
<uint64_t>& aChannelId
, nsIURI
* aNewURI
);
345 // Methods for getting and setting the active state for top level
346 // browsing contexts, for the process priority manager.
347 bool IsPriorityActive() const {
348 MOZ_RELEASE_ASSERT(IsTop());
349 return mPriorityActive
;
351 void SetPriorityActive(bool aIsActive
) {
352 MOZ_RELEASE_ASSERT(IsTop());
353 mPriorityActive
= aIsActive
;
356 void SetIsActive(bool aIsActive
, ErrorResult
& aRv
) {
357 MOZ_ASSERT(ManuallyManagesActiveness(),
358 "Shouldn't be setting active status of this browsing context if "
359 "not manually managed");
360 SetIsActiveInternal(aIsActive
, aRv
);
363 void SetIsActiveInternal(bool aIsActive
, ErrorResult
& aRv
) {
364 SetExplicitActive(aIsActive
? ExplicitActiveStatus::Active
365 : ExplicitActiveStatus::Inactive
,
369 void SetTouchEventsOverride(dom::TouchEventsOverride
, ErrorResult
& aRv
);
370 void SetTargetTopLevelLinkClicksToBlank(bool aTargetTopLevelLinkClicksToBlank
,
373 bool IsReplaced() const { return mIsReplaced
; }
375 const JS::Heap
<JS::Value
>& PermanentKey() { return mPermanentKey
; }
376 void ClearPermanentKey() { mPermanentKey
.setNull(); }
377 void MaybeSetPermanentKey(Element
* aEmbedder
);
379 // When request for page awake, it would increase a count that is used to
380 // prevent whole browsing context tree from being suspended. The request can
381 // be called multiple times. When calling the revoke, it would decrease the
382 // count and once the count reaches to zero, the browsing context tree could
383 // be suspended when the tree is inactive.
384 void AddPageAwakeRequest();
385 void RemovePageAwakeRequest();
387 void CloneDocumentTreeInto(CanonicalBrowsingContext
* aSource
,
388 const nsACString
& aRemoteType
,
389 embedding::PrintData
&& aPrintData
);
391 // Returns a Promise which resolves when cloning documents for printing
392 // finished if this browsing context is cloning document tree.
393 RefPtr
<GenericNonExclusivePromise
> GetClonePromise() const {
394 return mClonePromise
;
397 bool StartApzAutoscroll(float aAnchorX
, float aAnchorY
, nsViewID aScrollId
,
398 uint32_t aPresShellId
);
399 void StopApzAutoscroll(nsViewID aScrollId
, uint32_t aPresShellId
);
401 void AddFinalDiscardListener(std::function
<void(uint64_t)>&& aListener
);
403 bool ForceAppWindowActive() const { return mForceAppWindowActive
; }
404 void SetForceAppWindowActive(bool, ErrorResult
&);
405 void RecomputeAppWindowVisibility();
407 already_AddRefed
<nsISHEntry
> GetMostRecentLoadingSessionHistoryEntry();
409 already_AddRefed
<BounceTrackingState
> GetBounceTrackingState();
412 // Called when the browsing context is being discarded.
413 void CanonicalDiscard();
415 // Called when the browsing context is being attached.
416 void CanonicalAttach();
418 // Called when the browsing context private mode is changed after
419 // being attached, but before being discarded.
420 void AdjustPrivateBrowsingCount(bool aPrivateBrowsing
);
422 using Type
= BrowsingContext::Type
;
423 CanonicalBrowsingContext(WindowContext
* aParentWindow
,
424 BrowsingContextGroup
* aGroup
,
425 uint64_t aBrowsingContextId
,
426 uint64_t aOwnerProcessId
,
427 uint64_t aEmbedderProcessId
, Type aType
,
428 FieldValues
&& aInit
);
431 friend class BrowsingContext
;
433 virtual ~CanonicalBrowsingContext();
435 class PendingRemotenessChange
{
437 NS_INLINE_DECL_REFCOUNTING(PendingRemotenessChange
)
439 PendingRemotenessChange(CanonicalBrowsingContext
* aTarget
,
440 RemotenessPromise::Private
* aPromise
,
441 uint64_t aPendingSwitchId
,
442 const NavigationIsolationOptions
& aOptions
);
444 void Cancel(nsresult aRv
);
447 friend class CanonicalBrowsingContext
;
449 ~PendingRemotenessChange();
450 void ProcessLaunched();
455 nsresult
FinishTopContent();
456 nsresult
FinishSubframe();
458 RefPtr
<CanonicalBrowsingContext
> mTarget
;
459 RefPtr
<RemotenessPromise::Private
> mPromise
;
460 RefPtr
<ContentParent
> mContentParent
;
461 RefPtr
<BrowsingContextGroup
> mSpecificGroup
;
463 bool mProcessReady
= false;
464 bool mWaitingForPrepareToChange
= false;
466 uint64_t mPendingSwitchId
;
467 NavigationIsolationOptions mOptions
;
470 struct RestoreState
{
471 NS_INLINE_DECL_REFCOUNTING(RestoreState
)
473 void ClearData() { mData
= nullptr; }
476 RefPtr
<SessionStoreRestoreData
> mData
;
477 RefPtr
<Promise
> mPromise
;
478 uint32_t mRequests
= 0;
479 uint32_t mResolves
= 0;
482 ~RestoreState() = default;
485 friend class net::DocumentLoadListener
;
486 // Called when a DocumentLoadListener is created to start a load for
487 // this browsing context. Returns false if a higher priority load is
488 // already in-progress and the new one has been rejected.
489 bool StartDocumentLoad(net::DocumentLoadListener
* aLoad
);
490 // Called once DocumentLoadListener completes handling a load, and it
491 // is either complete, or handed off to the final channel to deliver
492 // data to the destination docshell.
493 // If aContinueNavigating it set, the reference to the DocumentLoadListener
494 // will be cleared to prevent it being cancelled, however the current load ID
495 // will be preserved until `EndDocumentLoad` is called again.
496 void EndDocumentLoad(bool aContinueNavigating
);
498 bool SupportsLoadingInParent(nsDocShellLoadState
* aLoadState
,
499 uint64_t* aOuterWindowId
);
501 void HistoryCommitIndexAndLength(
502 const nsID
& aChangeID
,
503 const CallerWillNotifyHistoryIndexAndLengthChanges
& aProofOfCaller
);
505 struct UnloadingHost
{
507 nsTArray
<std::function
<void()>> mCallbacks
;
509 nsTArray
<UnloadingHost
>::iterator
FindUnloadingHost(uint64_t aChildID
);
511 // Called when we want to show the subframe crashed UI as our previous browser
512 // has become unloaded for one reason or another.
513 void ShowSubframeCrashedUI(BrowserBridgeParent
* aBridge
);
515 void MaybeScheduleSessionStoreUpdate();
517 void CancelSessionStoreUpdate();
519 void AddPendingDiscard();
521 void RemovePendingDiscard();
523 bool ShouldAddEntryForRefresh(const SessionHistoryEntry
* aEntry
) {
524 return ShouldAddEntryForRefresh(aEntry
->Info().GetURI(),
525 aEntry
->Info().HasPostData());
527 bool ShouldAddEntryForRefresh(nsIURI
* aNewURI
, bool aHasPostData
) {
528 nsCOMPtr
<nsIURI
> currentURI
= GetCurrentURI();
529 return BrowsingContext::ShouldAddEntryForRefresh(currentURI
, aNewURI
,
533 already_AddRefed
<nsDocShellLoadState
> CreateLoadInfo(
534 SessionHistoryEntry
* aEntry
);
536 // XXX(farre): Store a ContentParent pointer here rather than mProcessId?
537 // Indicates which process owns the docshell.
540 // Indicates which process owns the embedder element.
541 uint64_t mEmbedderProcessId
;
543 uint64_t mCrossGroupOpenerId
= 0;
545 // This function will make the top window context reset its
546 // "SHEntryHasUserInteraction" cache that prevents documents from repeatedly
547 // setting user interaction on SH entries. Should be called anytime SH
548 // entries are added or replaced.
549 void ResetSHEntryHasUserInteractionCache();
551 RefPtr
<BrowserParent
> mCurrentBrowserParent
;
553 nsTArray
<UnloadingHost
> mUnloadingHosts
;
555 // The current URI loaded in this BrowsingContext. This value is only set for
556 // BrowsingContexts loaded in content processes.
557 nsCOMPtr
<nsIURI
> mCurrentRemoteURI
;
559 // The current remoteness change which is in a pending state.
560 RefPtr
<PendingRemotenessChange
> mPendingRemotenessChange
;
562 RefPtr
<nsSHistory
> mSessionHistory
;
564 // Tab media controller is used to control all media existing in the same
565 // browsing context tree, so it would only exist in the top level browsing
567 RefPtr
<MediaController
> mTabMediaController
;
569 RefPtr
<net::DocumentLoadListener
> mCurrentLoad
;
571 struct LoadingSessionHistoryEntry
{
572 uint64_t mLoadId
= 0;
573 RefPtr
<SessionHistoryEntry
> mEntry
;
575 nsTArray
<LoadingSessionHistoryEntry
> mLoadingEntries
;
576 RefPtr
<SessionHistoryEntry
> mActiveEntry
;
578 RefPtr
<nsSecureBrowserUI
> mSecureBrowserUI
;
579 RefPtr
<BrowsingContextWebProgress
> mWebProgress
;
581 nsCOMPtr
<nsIWebProgressListener
> mDocShellProgressBridge
;
582 RefPtr
<nsBrowserStatusFilter
> mStatusFilter
;
584 RefPtr
<FeaturePolicy
> mContainerFeaturePolicy
;
586 friend class BrowserSessionStore
;
587 WeakPtr
<SessionStoreFormData
>& GetSessionStoreFormDataRef() {
590 WeakPtr
<SessionStoreScrollData
>& GetSessionStoreScrollDataRef() {
594 WeakPtr
<SessionStoreFormData
> mFormdata
;
595 WeakPtr
<SessionStoreScrollData
> mScroll
;
597 RefPtr
<RestoreState
> mRestoreState
;
599 nsCOMPtr
<nsITimer
> mSessionStoreSessionStorageUpdateTimer
;
601 // If this is a top level context, this is true if our browser ID is marked as
602 // active in the process priority manager.
603 bool mPriorityActive
= false;
605 // See CanonicalBrowsingContext.forceAppWindowActive.
606 bool mForceAppWindowActive
= false;
608 bool mIsReplaced
= false;
610 // A Promise created when cloning documents for printing.
611 RefPtr
<GenericNonExclusivePromise
> mClonePromise
;
613 JS::Heap
<JS::Value
> mPermanentKey
;
615 uint32_t mPendingDiscards
= 0;
617 bool mFullyDiscarded
= false;
619 nsTArray
<std::function
<void(uint64_t)>> mFullyDiscardedListeners
;
623 } // namespace mozilla
625 #endif // !defined(mozilla_dom_CanonicalBrowsingContext_h)