no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / base / CanonicalBrowsingContext.h
blob132c9f21578c81368a7bcdd4eea986410cec07c1
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"
23 #include "nsTArray.h"
24 #include "nsTHashtable.h"
25 #include "nsHashKeys.h"
26 #include "nsISecureBrowserUI.h"
28 class nsIBrowserDOMWindow;
29 class nsISHistory;
30 class nsIWidget;
31 class nsIPrintSettings;
32 class nsSHistory;
33 class nsBrowserStatusFilter;
34 class nsSecureBrowserUI;
35 class CallerWillNotifyHistoryIndexAndLengthChanges;
36 class nsITimer;
38 namespace mozilla {
39 enum class CallState;
40 class BounceTrackingState;
42 namespace embedding {
43 class PrintData;
46 namespace net {
47 class DocumentLoadListener;
50 namespace dom {
52 class BrowserParent;
53 class BrowserBridgeParent;
54 class FeaturePolicy;
55 struct LoadURIOptions;
56 class MediaController;
57 struct LoadingSessionHistoryInfo;
58 class SSCacheCopy;
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
65 // parent needs.
66 class CanonicalBrowsingContext final : public BrowsingContext {
67 public:
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,
99 ErrorResult& aRv);
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);
139 using PrintPromise = MozPromise</* unused */ bool, nsresult, false>;
140 MOZ_CAN_RUN_SCRIPT RefPtr<PrintPromise> Print(nsIPrintSettings*);
141 MOZ_CAN_RUN_SCRIPT already_AddRefed<Promise> PrintJS(nsIPrintSettings*,
142 ErrorResult&);
144 // Call the given callback on all top-level descendant BrowsingContexts.
145 // Return Callstate::Stop from the callback to stop calling further children.
147 // If aIncludeNestedBrowsers is true, then all top descendants are included,
148 // even those inside a nested top browser.
149 void CallOnAllTopDescendants(
150 const FunctionRef<CallState(CanonicalBrowsingContext*)>& aCallback,
151 bool aIncludeNestedBrowsers);
153 void SessionHistoryCommit(uint64_t aLoadId, const nsID& aChangeID,
154 uint32_t aLoadType, bool aPersist,
155 bool aCloneEntryChildren, bool aChannelExpired,
156 uint32_t aCacheKey);
158 // Calls the session history listeners' OnHistoryReload, storing the result in
159 // aCanReload. If aCanReload is set to true and we have an active or a loading
160 // entry then aLoadState will be initialized from that entry, and
161 // aReloadActiveEntry will be true if we have an active entry. If aCanReload
162 // is true and aLoadState and aReloadActiveEntry are not set then we should
163 // attempt to reload based on the current document in the docshell.
164 void NotifyOnHistoryReload(
165 bool aForceReload, bool& aCanReload,
166 Maybe<NotNull<RefPtr<nsDocShellLoadState>>>& aLoadState,
167 Maybe<bool>& aReloadActiveEntry);
169 // See BrowsingContext::SetActiveSessionHistoryEntry.
170 void SetActiveSessionHistoryEntry(const Maybe<nsPoint>& aPreviousScrollPos,
171 SessionHistoryInfo* aInfo,
172 uint32_t aLoadType,
173 uint32_t aUpdatedCacheKey,
174 const nsID& aChangeID);
176 void ReplaceActiveSessionHistoryEntry(SessionHistoryInfo* aInfo);
178 void RemoveDynEntriesFromActiveSessionHistoryEntry();
180 void RemoveFromSessionHistory(const nsID& aChangeID);
182 Maybe<int32_t> HistoryGo(int32_t aOffset, uint64_t aHistoryEpoch,
183 bool aRequireUserInteraction, bool aUserActivation,
184 Maybe<ContentParentId> aContentId);
186 JSObject* WrapObject(JSContext* aCx,
187 JS::Handle<JSObject*> aGivenProto) override;
189 // Dispatches a wheel zoom change to the embedder element.
190 void DispatchWheelZoomChange(bool aIncrease);
192 // This function is used to start the autoplay media which are delayed to
193 // start. If needed, it would also notify the content browsing context which
194 // are related with the canonical browsing content tree to start delayed
195 // autoplay media.
196 void NotifyStartDelayedAutoplayMedia();
198 // This function is used to mute or unmute all media within a tab. It would
199 // set the media mute property for the top level window and propagate it to
200 // other top level windows in other processes.
201 void NotifyMediaMutedChanged(bool aMuted, ErrorResult& aRv);
203 // Return the number of unique site origins by iterating all given BCs,
204 // including their subtrees.
205 static uint32_t CountSiteOrigins(
206 GlobalObject& aGlobal,
207 const Sequence<mozilla::OwningNonNull<BrowsingContext>>& aRoots);
209 // Return true if a private browsing session is active.
210 static bool IsPrivateBrowsingActive();
212 // This function would propogate the action to its all child browsing contexts
213 // in content processes.
214 void UpdateMediaControlAction(const MediaControlAction& aAction);
216 // Triggers a load in the process
217 using BrowsingContext::LoadURI;
218 void FixupAndLoadURIString(const nsAString& aURI,
219 const LoadURIOptions& aOptions,
220 ErrorResult& aError);
221 void LoadURI(nsIURI* aURI, const LoadURIOptions& aOptions,
222 ErrorResult& aError);
224 void GoBack(const Optional<int32_t>& aCancelContentJSEpoch,
225 bool aRequireUserInteraction, bool aUserActivation);
226 void GoForward(const Optional<int32_t>& aCancelContentJSEpoch,
227 bool aRequireUserInteraction, bool aUserActivation);
228 void GoToIndex(int32_t aIndex, const Optional<int32_t>& aCancelContentJSEpoch,
229 bool aUserActivation);
230 void Reload(uint32_t aReloadFlags);
231 void Stop(uint32_t aStopFlags);
233 // Get the publicly exposed current URI loaded in this BrowsingContext.
234 already_AddRefed<nsIURI> GetCurrentURI() const;
235 void SetCurrentRemoteURI(nsIURI* aCurrentRemoteURI);
237 BrowserParent* GetBrowserParent() const;
238 void SetCurrentBrowserParent(BrowserParent* aBrowserParent);
240 // Internal method to change which process a BrowsingContext is being loaded
241 // in. The returned promise will resolve when the process switch is completed.
243 // A NOT_REMOTE_TYPE aRemoteType argument will perform a process switch into
244 // the parent process, and the method will resolve with a null BrowserParent.
245 using RemotenessPromise = MozPromise<RefPtr<BrowserParent>, nsresult, false>;
246 RefPtr<RemotenessPromise> ChangeRemoteness(
247 const NavigationIsolationOptions& aOptions, uint64_t aPendingSwitchId);
249 // Return a media controller from the top-level browsing context that can
250 // control all media belonging to this browsing context tree. Return nullptr
251 // if the top-level browsing context has been discarded.
252 MediaController* GetMediaController();
253 bool HasCreatedMediaController() const;
255 // Attempts to start loading the given load state in this BrowsingContext,
256 // without requiring any communication from a docshell. This will handle
257 // computing the right process to load in, and organising handoff to
258 // the right docshell when we get a response.
259 bool LoadInParent(nsDocShellLoadState* aLoadState, bool aSetNavigating);
261 // Attempts to start loading the given load state in this BrowsingContext,
262 // in parallel with a DocumentChannelChild being created in the docshell.
263 // Requires the DocumentChannel to connect with this load for it to
264 // complete successfully.
265 bool AttemptSpeculativeLoadInParent(nsDocShellLoadState* aLoadState);
267 // Get or create a secure browser UI for this BrowsingContext
268 nsISecureBrowserUI* GetSecureBrowserUI();
270 BrowsingContextWebProgress* GetWebProgress() { return mWebProgress; }
272 // Called when the current URI changes (from an
273 // nsIWebProgressListener::OnLocationChange event, so that we
274 // can update our security UI for the new location, or when the
275 // mixed content/https-only state for our current window is changed.
276 void UpdateSecurityState();
278 void MaybeAddAsProgressListener(nsIWebProgress* aWebProgress);
280 // Called when a navigation forces us to recreate our browsing
281 // context (for example, when switching in or out of the parent
282 // process).
283 // aNewContext is the newly created BrowsingContext that is replacing
284 // us.
285 void ReplacedBy(CanonicalBrowsingContext* aNewContext,
286 const NavigationIsolationOptions& aRemotenessOptions);
288 bool HasHistoryEntry(nsISHEntry* aEntry);
289 bool HasLoadingHistoryEntry(nsISHEntry* aEntry) {
290 for (const LoadingSessionHistoryEntry& loading : mLoadingEntries) {
291 if (loading.mEntry == aEntry) {
292 return true;
295 return false;
298 void SwapHistoryEntries(nsISHEntry* aOldEntry, nsISHEntry* aNewEntry);
300 void AddLoadingSessionHistoryEntry(uint64_t aLoadId,
301 SessionHistoryEntry* aEntry);
303 void GetLoadingSessionHistoryInfoFromParent(
304 Maybe<LoadingSessionHistoryInfo>& aLoadingInfo);
306 void HistoryCommitIndexAndLength();
308 void SynchronizeLayoutHistoryState();
310 void ResetScalingZoom();
312 void SetContainerFeaturePolicy(FeaturePolicy* aContainerFeaturePolicy);
313 FeaturePolicy* GetContainerFeaturePolicy() const {
314 return mContainerFeaturePolicy;
317 void SetRestoreData(SessionStoreRestoreData* aData, ErrorResult& aError);
318 void ClearRestoreState();
319 MOZ_CAN_RUN_SCRIPT_BOUNDARY void RequestRestoreTabContent(
320 WindowGlobalParent* aWindow);
321 already_AddRefed<Promise> GetRestorePromise();
323 nsresult WriteSessionStorageToSessionStore(
324 const nsTArray<SSCacheCopy>& aSesssionStorage, uint32_t aEpoch);
326 void UpdateSessionStoreSessionStorage(const std::function<void()>& aDone);
328 static void UpdateSessionStoreForStorage(uint64_t aBrowsingContextId);
330 // Called when a BrowserParent for this BrowsingContext has been fully
331 // destroyed (i.e. `ActorDestroy` was called).
332 void BrowserParentDestroyed(BrowserParent* aBrowserParent,
333 bool aAbnormalShutdown);
335 void StartUnloadingHost(uint64_t aChildID);
336 void ClearUnloadingHost(uint64_t aChildID);
338 bool AllowedInBFCache(const Maybe<uint64_t>& aChannelId, nsIURI* aNewURI);
340 // Methods for getting and setting the active state for top level
341 // browsing contexts, for the process priority manager.
342 bool IsPriorityActive() const {
343 MOZ_RELEASE_ASSERT(IsTop());
344 return mPriorityActive;
346 void SetPriorityActive(bool aIsActive) {
347 MOZ_RELEASE_ASSERT(IsTop());
348 mPriorityActive = aIsActive;
351 void SetIsActive(bool aIsActive, ErrorResult& aRv) {
352 MOZ_ASSERT(ManuallyManagesActiveness(),
353 "Shouldn't be setting active status of this browsing context if "
354 "not manually managed");
355 SetIsActiveInternal(aIsActive, aRv);
358 void SetIsActiveInternal(bool aIsActive, ErrorResult& aRv) {
359 SetExplicitActive(aIsActive ? ExplicitActiveStatus::Active
360 : ExplicitActiveStatus::Inactive,
361 aRv);
364 void SetTouchEventsOverride(dom::TouchEventsOverride, ErrorResult& aRv);
365 void SetTargetTopLevelLinkClicksToBlank(bool aTargetTopLevelLinkClicksToBlank,
366 ErrorResult& aRv);
368 bool IsReplaced() const { return mIsReplaced; }
370 const JS::Heap<JS::Value>& PermanentKey() { return mPermanentKey; }
371 void ClearPermanentKey() { mPermanentKey.setNull(); }
372 void MaybeSetPermanentKey(Element* aEmbedder);
374 // When request for page awake, it would increase a count that is used to
375 // prevent whole browsing context tree from being suspended. The request can
376 // be called multiple times. When calling the revoke, it would decrease the
377 // count and once the count reaches to zero, the browsing context tree could
378 // be suspended when the tree is inactive.
379 void AddPageAwakeRequest();
380 void RemovePageAwakeRequest();
382 void CloneDocumentTreeInto(CanonicalBrowsingContext* aSource,
383 const nsACString& aRemoteType,
384 embedding::PrintData&& aPrintData);
386 // Returns a Promise which resolves when cloning documents for printing
387 // finished if this browsing context is cloning document tree.
388 RefPtr<GenericNonExclusivePromise> GetClonePromise() const {
389 return mClonePromise;
392 bool StartApzAutoscroll(float aAnchorX, float aAnchorY, nsViewID aScrollId,
393 uint32_t aPresShellId);
394 void StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId);
396 void AddFinalDiscardListener(std::function<void(uint64_t)>&& aListener);
398 bool ForceAppWindowActive() const { return mForceAppWindowActive; }
399 void SetForceAppWindowActive(bool, ErrorResult&);
400 void RecomputeAppWindowVisibility();
402 already_AddRefed<nsISHEntry> GetMostRecentLoadingSessionHistoryEntry();
404 already_AddRefed<BounceTrackingState> GetBounceTrackingState();
406 protected:
407 // Called when the browsing context is being discarded.
408 void CanonicalDiscard();
410 // Called when the browsing context is being attached.
411 void CanonicalAttach();
413 // Called when the browsing context private mode is changed after
414 // being attached, but before being discarded.
415 void AdjustPrivateBrowsingCount(bool aPrivateBrowsing);
417 using Type = BrowsingContext::Type;
418 CanonicalBrowsingContext(WindowContext* aParentWindow,
419 BrowsingContextGroup* aGroup,
420 uint64_t aBrowsingContextId,
421 uint64_t aOwnerProcessId,
422 uint64_t aEmbedderProcessId, Type aType,
423 FieldValues&& aInit);
425 private:
426 friend class BrowsingContext;
428 virtual ~CanonicalBrowsingContext();
430 class PendingRemotenessChange {
431 public:
432 NS_INLINE_DECL_REFCOUNTING(PendingRemotenessChange)
434 PendingRemotenessChange(CanonicalBrowsingContext* aTarget,
435 RemotenessPromise::Private* aPromise,
436 uint64_t aPendingSwitchId,
437 const NavigationIsolationOptions& aOptions);
439 void Cancel(nsresult aRv);
441 private:
442 friend class CanonicalBrowsingContext;
444 ~PendingRemotenessChange();
445 void ProcessLaunched();
446 void ProcessReady();
447 void MaybeFinish();
448 void Clear();
450 nsresult FinishTopContent();
451 nsresult FinishSubframe();
453 RefPtr<CanonicalBrowsingContext> mTarget;
454 RefPtr<RemotenessPromise::Private> mPromise;
455 RefPtr<ContentParent> mContentParent;
456 RefPtr<BrowsingContextGroup> mSpecificGroup;
458 bool mProcessReady = false;
459 bool mWaitingForPrepareToChange = false;
461 uint64_t mPendingSwitchId;
462 NavigationIsolationOptions mOptions;
465 struct RestoreState {
466 NS_INLINE_DECL_REFCOUNTING(RestoreState)
468 void ClearData() { mData = nullptr; }
469 void Resolve();
471 RefPtr<SessionStoreRestoreData> mData;
472 RefPtr<Promise> mPromise;
473 uint32_t mRequests = 0;
474 uint32_t mResolves = 0;
476 private:
477 ~RestoreState() = default;
480 friend class net::DocumentLoadListener;
481 // Called when a DocumentLoadListener is created to start a load for
482 // this browsing context. Returns false if a higher priority load is
483 // already in-progress and the new one has been rejected.
484 bool StartDocumentLoad(net::DocumentLoadListener* aLoad);
485 // Called once DocumentLoadListener completes handling a load, and it
486 // is either complete, or handed off to the final channel to deliver
487 // data to the destination docshell.
488 // If aContinueNavigating it set, the reference to the DocumentLoadListener
489 // will be cleared to prevent it being cancelled, however the current load ID
490 // will be preserved until `EndDocumentLoad` is called again.
491 void EndDocumentLoad(bool aContinueNavigating);
493 bool SupportsLoadingInParent(nsDocShellLoadState* aLoadState,
494 uint64_t* aOuterWindowId);
496 void HistoryCommitIndexAndLength(
497 const nsID& aChangeID,
498 const CallerWillNotifyHistoryIndexAndLengthChanges& aProofOfCaller);
500 struct UnloadingHost {
501 uint64_t mChildID;
502 nsTArray<std::function<void()>> mCallbacks;
504 nsTArray<UnloadingHost>::iterator FindUnloadingHost(uint64_t aChildID);
506 // Called when we want to show the subframe crashed UI as our previous browser
507 // has become unloaded for one reason or another.
508 void ShowSubframeCrashedUI(BrowserBridgeParent* aBridge);
510 void MaybeScheduleSessionStoreUpdate();
512 void CancelSessionStoreUpdate();
514 void AddPendingDiscard();
516 void RemovePendingDiscard();
518 bool ShouldAddEntryForRefresh(const SessionHistoryEntry* aEntry) {
519 return ShouldAddEntryForRefresh(aEntry->Info().GetURI(),
520 aEntry->Info().HasPostData());
522 bool ShouldAddEntryForRefresh(nsIURI* aNewURI, bool aHasPostData) {
523 nsCOMPtr<nsIURI> currentURI = GetCurrentURI();
524 return BrowsingContext::ShouldAddEntryForRefresh(currentURI, aNewURI,
525 aHasPostData);
528 already_AddRefed<nsDocShellLoadState> CreateLoadInfo(
529 SessionHistoryEntry* aEntry);
531 // XXX(farre): Store a ContentParent pointer here rather than mProcessId?
532 // Indicates which process owns the docshell.
533 uint64_t mProcessId;
535 // Indicates which process owns the embedder element.
536 uint64_t mEmbedderProcessId;
538 uint64_t mCrossGroupOpenerId = 0;
540 // This function will make the top window context reset its
541 // "SHEntryHasUserInteraction" cache that prevents documents from repeatedly
542 // setting user interaction on SH entries. Should be called anytime SH
543 // entries are added or replaced.
544 void ResetSHEntryHasUserInteractionCache();
546 RefPtr<BrowserParent> mCurrentBrowserParent;
548 nsTArray<UnloadingHost> mUnloadingHosts;
550 // The current URI loaded in this BrowsingContext. This value is only set for
551 // BrowsingContexts loaded in content processes.
552 nsCOMPtr<nsIURI> mCurrentRemoteURI;
554 // The current remoteness change which is in a pending state.
555 RefPtr<PendingRemotenessChange> mPendingRemotenessChange;
557 RefPtr<nsSHistory> mSessionHistory;
559 // Tab media controller is used to control all media existing in the same
560 // browsing context tree, so it would only exist in the top level browsing
561 // context.
562 RefPtr<MediaController> mTabMediaController;
564 RefPtr<net::DocumentLoadListener> mCurrentLoad;
566 struct LoadingSessionHistoryEntry {
567 uint64_t mLoadId = 0;
568 RefPtr<SessionHistoryEntry> mEntry;
570 nsTArray<LoadingSessionHistoryEntry> mLoadingEntries;
571 RefPtr<SessionHistoryEntry> mActiveEntry;
573 RefPtr<nsSecureBrowserUI> mSecureBrowserUI;
574 RefPtr<BrowsingContextWebProgress> mWebProgress;
576 nsCOMPtr<nsIWebProgressListener> mDocShellProgressBridge;
577 RefPtr<nsBrowserStatusFilter> mStatusFilter;
579 RefPtr<FeaturePolicy> mContainerFeaturePolicy;
581 friend class BrowserSessionStore;
582 WeakPtr<SessionStoreFormData>& GetSessionStoreFormDataRef() {
583 return mFormdata;
585 WeakPtr<SessionStoreScrollData>& GetSessionStoreScrollDataRef() {
586 return mScroll;
589 WeakPtr<SessionStoreFormData> mFormdata;
590 WeakPtr<SessionStoreScrollData> mScroll;
592 RefPtr<RestoreState> mRestoreState;
594 nsCOMPtr<nsITimer> mSessionStoreSessionStorageUpdateTimer;
596 // If this is a top level context, this is true if our browser ID is marked as
597 // active in the process priority manager.
598 bool mPriorityActive = false;
600 // See CanonicalBrowsingContext.forceAppWindowActive.
601 bool mForceAppWindowActive = false;
603 bool mIsReplaced = false;
605 // A Promise created when cloning documents for printing.
606 RefPtr<GenericNonExclusivePromise> mClonePromise;
608 JS::Heap<JS::Value> mPermanentKey;
610 uint32_t mPendingDiscards = 0;
612 bool mFullyDiscarded = false;
614 nsTArray<std::function<void(uint64_t)>> mFullyDiscardedListeners;
617 } // namespace dom
618 } // namespace mozilla
620 #endif // !defined(mozilla_dom_CanonicalBrowsingContext_h)