diff --git a/docshell/shistory/SessionHistoryEntry.cpp b/docshell/shistory/SessionHistoryEntry.cpp index e955fd016e3b..2de1b260457b 100644 --- a/docshell/shistory/SessionHistoryEntry.cpp +++ b/docshell/shistory/SessionHistoryEntry.cpp @@ -715,6 +715,12 @@ SessionHistoryEntry::SetPostData(nsIInputStream* aPostData) { return NS_OK; } +NS_IMETHODIMP +SessionHistoryEntry::GetHasPostData(bool* aResult) { + *aResult = mInfo->HasPostData(); + return NS_OK; +} + NS_IMETHODIMP SessionHistoryEntry::GetLayoutHistoryState( nsILayoutHistoryState** aLayoutHistoryState) { diff --git a/docshell/shistory/nsISHEntry.idl b/docshell/shistory/nsISHEntry.idl index cdbaeaf83dc0..28161e888527 100644 --- a/docshell/shistory/nsISHEntry.idl +++ b/docshell/shistory/nsISHEntry.idl @@ -128,6 +128,7 @@ interface nsISHEntry : nsISupports /** Post Data for the document */ [infallible] attribute nsIInputStream postData; + [infallible] readonly attribute boolean hasPostData; /** LayoutHistoryState for scroll position and form values */ [infallible] attribute nsILayoutHistoryState layoutHistoryState; diff --git a/docshell/shistory/nsSHEntry.cpp b/docshell/shistory/nsSHEntry.cpp index b384d7f609a9..c3a737dbc54d 100644 --- a/docshell/shistory/nsSHEntry.cpp +++ b/docshell/shistory/nsSHEntry.cpp @@ -244,6 +244,12 @@ nsSHEntry::SetPostData(nsIInputStream* aPostData) { return NS_OK; } +NS_IMETHODIMP +nsSHEntry::GetHasPostData(bool* aResult) { + *aResult = !!mPostData; + return NS_OK; +} + NS_IMETHODIMP nsSHEntry::GetLayoutHistoryState(nsILayoutHistoryState** aResult) { *aResult = mShared->mLayoutHistoryState; diff --git a/toolkit/components/extensions/ExtensionDNR.sys.mjs b/toolkit/components/extensions/ExtensionDNR.sys.mjs index 227ff8e3d778..96f20390a9d8 100644 --- a/toolkit/components/extensions/ExtensionDNR.sys.mjs +++ b/toolkit/components/extensions/ExtensionDNR.sys.mjs @@ -1368,7 +1368,7 @@ class RequestDetails { // See the above comment for more info. initiatorURI: parentPrin?.isContentPrincipal ? parentPrin.URI : null, type: isTop ? "main_frame" : "sub_frame", - method: bc.activeSessionHistoryEntry?.postData ? "post" : "get", + method: bc.activeSessionHistoryEntry?.hasPostData ? "post" : "get", tabId: this.tabId, // In this loop we are already explicitly accounting for ancestors, so // we intentionally omit browsingContext even though we have |bc|. If