Bug 1962710 - Part 1: Add source element to load state. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D249240
This commit is contained in:
Andreas Farre
2025-05-19 09:01:13 +00:00
committed by afarre@mozilla.com
parent a74508cc71
commit 51b4a22fa0
2 changed files with 13 additions and 0 deletions

View File

@@ -1402,3 +1402,11 @@ nsIURI* nsDocShellLoadState::GetUnstrippedURI() const { return mUnstrippedURI; }
void nsDocShellLoadState::SetUnstrippedURI(nsIURI* aUnstrippedURI) {
mUnstrippedURI = aUnstrippedURI;
}
void nsDocShellLoadState::SetSourceElement(mozilla::dom::Element* aElement) {
mSourceElement = do_GetWeakReference(aElement);
}
already_AddRefed<Element> nsDocShellLoadState::GetSourceElement() const {
nsCOMPtr<Element> element = do_QueryReferent(mSourceElement);
return element.forget();
}

View File

@@ -408,6 +408,9 @@ class nsDocShellLoadState final {
void MaybeStripTrackerQueryStrings(mozilla::dom::BrowsingContext* aContext);
void SetSourceElement(mozilla::dom::Element* aElement);
already_AddRefed<mozilla::dom::Element> GetSourceElement() const;
protected:
// Destructor can't be defaulted or inlined, as header doesn't have all type
// includes it needs to do so.
@@ -658,6 +661,8 @@ class nsDocShellLoadState final {
// Solely for the use of collecting Telemetry for HTTPS upgrades.
nsILoadInfo::HTTPSUpgradeTelemetryType mHttpsUpgradeTelemetry =
nsILoadInfo::NOT_INITIALIZED;
nsWeakPtr mSourceElement;
};
#endif /* nsDocShellLoadState_h__ */