Bug 1706615 - Part 2: Add UnstrippedURI in the nsDocShellLoadState. r=smaug

This patch adds an attribute UnstrippedURI in the nsDocShellLoadState.
The attribute will be set if the query stripping was happening.
Otherwise, it will stay a nullptr. This attribute will be propagated to
the loadInfo, so that we can revert the query stripping in the parent
process if the loading URI is in the content blocking allow list. We can
only revert the query stripping in the parent process because we cannot
access the permission of the content blocking allow list of a
cross-origin domain. So, we can only carry the unstripped URI in the
loadInfo and perform a interal redirect to revert the query stripping.

Differential Revision: https://phabricator.services.mozilla.com/D116109
This commit is contained in:
Tim Huang
2021-06-02 19:46:20 +00:00
parent dbcb20c765
commit 32531a50ee
3 changed files with 14 additions and 1 deletions

View File

@@ -247,6 +247,8 @@ class nsDocShellLoadState final {
void SetFileName(const nsAString& aFileName);
nsIURI* GetUnstrippedURI() const;
// Give the type of DocShell we're loading into (chrome/content/etc) and
// origin attributes for the URI we're loading, figure out if we should
// inherit our principal from the document the load was requested from, or
@@ -517,6 +519,10 @@ class nsDocShellLoadState final {
// True if the load was triggered by a meta refresh.
bool mIsMetaRefresh;
// The original URI before query stripping happened. If it's present, it shows
// the query stripping happened. Otherwise, it will be a nullptr.
nsCOMPtr<nsIURI> mUnstrippedURI;
};
#endif /* nsDocShellLoadState_h__ */