Files
tubestation/dom/navigation/NavigationHistoryEntry.h
Andreas Farre e6dd45c1ae Bug 1948254 - Part 4: Implement #navigate-event-firing. r=webidl,smaug,jjaschke
This includes:

* #fire-a-traverse-navigate-event
* #fire-a-push/replace/reload-navigate-event
* #fire-a-download-request-navigate-event

which are all implemented in terms of #inner-navigate-event-firing-algorithm.

Actually calling any of the above is only added for History.pushState and
History.replaceState using #fire-a-push/replace/reload-navigate-event.

Differential Revision: https://phabricator.services.mozilla.com/D238786
2025-03-19 13:23:26 +00:00

67 lines
2.0 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_NavigationHistoryEntry_h___
#define mozilla_dom_NavigationHistoryEntry_h___
#include "mozilla/DOMEventTargetHelper.h"
class nsIGlobalObject;
class nsStructuredCloneContainer;
namespace mozilla::dom {
class SessionHistoryInfo;
// https://html.spec.whatwg.org/#navigationhistoryentry
class NavigationHistoryEntry final : public DOMEventTargetHelper {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(NavigationHistoryEntry,
DOMEventTargetHelper)
NavigationHistoryEntry(nsIGlobalObject* aGlobal,
const SessionHistoryInfo* aSHInfo, int64_t aIndex);
void GetUrl(nsAString& aResult) const;
void GetKey(nsAString& aResult) const;
void GetId(nsAString& aResult) const;
int64_t Index() const;
bool SameDocument() const;
void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
ErrorResult& aRv) const;
void SetState(nsStructuredCloneContainer* aState);
IMPL_EVENT_HANDLER(dispose);
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
bool IsSameEntry(const SessionHistoryInfo* aSHInfo) const;
bool SharesDocumentWith(const SessionHistoryInfo& aSHInfo) const;
const nsID& Key() const;
nsStructuredCloneContainer* GetNavigationState() const;
private:
~NavigationHistoryEntry();
Document* GetCurrentDocument() const;
bool HasActiveDocument() const;
// https://html.spec.whatwg.org/#nhe-she
UniquePtr<SessionHistoryInfo> mSHInfo;
int64_t mIndex;
};
} // namespace mozilla::dom
#endif // mozilla_dom_NavigationHistoryEntry_h___