Bug 1398733 - nsIDocShell::internalLoad should know the size of the post data inputStream, r=smaug

This commit is contained in:
Andrea Marchesini
2017-09-22 08:10:41 +02:00
parent f2387d65c0
commit d7a91a07c0
3 changed files with 30 additions and 15 deletions

View File

@@ -1611,6 +1611,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
nullptr, // No type hint nullptr, // No type hint
VoidString(), // No forced download VoidString(), // No forced download
postStream, postStream,
-1, // XXXbaku
headersStream, headersStream,
loadType, loadType,
nullptr, // No SHEntry nullptr, // No SHEntry
@@ -5488,9 +5489,9 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL,
mozilla::net::RP_Unset, mozilla::net::RP_Unset,
nsContentUtils::GetSystemPrincipal(), nullptr, nsContentUtils::GetSystemPrincipal(), nullptr,
INTERNAL_LOAD_FLAGS_NONE, EmptyString(), INTERNAL_LOAD_FLAGS_NONE, EmptyString(),
nullptr, VoidString(), nullptr, nullptr, LOAD_ERROR_PAGE, nullptr, VoidString(), nullptr, -1, nullptr,
nullptr, true, VoidString(), this, nullptr, false, LOAD_ERROR_PAGE, nullptr, true, VoidString(), this,
nullptr, nullptr); nullptr, false, nullptr, nullptr);
} }
NS_IMETHODIMP NS_IMETHODIMP
@@ -5591,6 +5592,7 @@ nsDocShell::Reload(uint32_t aReloadFlags)
NS_LossyConvertUTF16toASCII(contentTypeHint).get(), NS_LossyConvertUTF16toASCII(contentTypeHint).get(),
VoidString(), // No forced download VoidString(), // No forced download
nullptr, // No post data nullptr, // No post data
-1, // No post data length
nullptr, // No headers data nullptr, // No headers data
loadType, // Load type loadType, // Load type
nullptr, // No SHEntry nullptr, // No SHEntry
@@ -9709,6 +9711,7 @@ public:
uint32_t aFlags, uint32_t aFlags,
const char* aTypeHint, const char* aTypeHint,
nsIInputStream* aPostData, nsIInputStream* aPostData,
int64_t aPostDataLength,
nsIInputStream* aHeadersData, nsIInputStream* aHeadersData,
uint32_t aLoadType, uint32_t aLoadType,
nsISHEntry* aSHEntry, nsISHEntry* aSHEntry,
@@ -9729,6 +9732,7 @@ public:
, mTriggeringPrincipal(aTriggeringPrincipal) , mTriggeringPrincipal(aTriggeringPrincipal)
, mPrincipalToInherit(aPrincipalToInherit) , mPrincipalToInherit(aPrincipalToInherit)
, mPostData(aPostData) , mPostData(aPostData)
, mPostDataLength(aPostDataLength)
, mHeadersData(aHeadersData) , mHeadersData(aHeadersData)
, mSHEntry(aSHEntry) , mSHEntry(aSHEntry)
, mFlags(aFlags) , mFlags(aFlags)
@@ -9757,10 +9761,11 @@ public:
mFlags, EmptyString(), mFlags, EmptyString(),
mTypeHint.IsVoid() ? nullptr mTypeHint.IsVoid() ? nullptr
: mTypeHint.get(), : mTypeHint.get(),
VoidString(), mPostData, mHeadersData, VoidString(), mPostData, mPostDataLength,
mLoadType, mSHEntry, mFirstParty, mHeadersData, mLoadType, mSHEntry,
mSrcdoc, mSourceDocShell, mBaseURI, mFirstParty, mSrcdoc, mSourceDocShell,
mCheckForPrerender, nullptr, nullptr); mBaseURI, mCheckForPrerender, nullptr,
nullptr);
} }
private: private:
@@ -9777,6 +9782,7 @@ private:
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal; nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
nsCOMPtr<nsIPrincipal> mPrincipalToInherit; nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
nsCOMPtr<nsIInputStream> mPostData; nsCOMPtr<nsIInputStream> mPostData;
int64_t mPostDataLength;
nsCOMPtr<nsIInputStream> mHeadersData; nsCOMPtr<nsIInputStream> mHeadersData;
nsCOMPtr<nsISHEntry> mSHEntry; nsCOMPtr<nsISHEntry> mSHEntry;
uint32_t mFlags; uint32_t mFlags;
@@ -9828,6 +9834,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
const char* aTypeHint, const char* aTypeHint,
const nsAString& aFileName, const nsAString& aFileName,
nsIInputStream* aPostData, nsIInputStream* aPostData,
int64_t aPostDataLength,
nsIInputStream* aHeadersData, nsIInputStream* aHeadersData,
uint32_t aLoadType, uint32_t aLoadType,
nsISHEntry* aSHEntry, nsISHEntry* aSHEntry,
@@ -10228,6 +10235,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
aTypeHint, aTypeHint,
VoidString(), // No forced download VoidString(), // No forced download
aPostData, aPostData,
aPostDataLength,
aHeadersData, aHeadersData,
aLoadType, aLoadType,
aSHEntry, aSHEntry,
@@ -10319,9 +10327,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
new InternalLoadEvent(this, aURI, aOriginalURI, aResultPrincipalURI, new InternalLoadEvent(this, aURI, aOriginalURI, aResultPrincipalURI,
aLoadReplace, aReferrer, aReferrerPolicy, aLoadReplace, aReferrer, aReferrerPolicy,
aTriggeringPrincipal, principalToInherit, aTriggeringPrincipal, principalToInherit,
aFlags, aTypeHint, aPostData, aHeadersData, aFlags, aTypeHint, aPostData, aPostDataLength,
aLoadType, aSHEntry, aFirstParty, aSrcdoc, aHeadersData, aLoadType, aSHEntry, aFirstParty,
aSourceDocShell, aBaseURI, false); aSrcdoc, aSourceDocShell, aBaseURI, false);
return DispatchToTabGroup(TaskCategory::Other, ev.forget()); return DispatchToTabGroup(TaskCategory::Other, ev.forget());
} }
@@ -10705,9 +10713,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
new InternalLoadEvent(this, aURI, aOriginalURI, aResultPrincipalURI, new InternalLoadEvent(this, aURI, aOriginalURI, aResultPrincipalURI,
aLoadReplace, aReferrer, aReferrerPolicy, aLoadReplace, aReferrer, aReferrerPolicy,
aTriggeringPrincipal, principalToInherit, aTriggeringPrincipal, principalToInherit,
aFlags, aTypeHint, aPostData, aHeadersData, aFlags, aTypeHint, aPostData, aPostDataLength,
aLoadType, aSHEntry, aFirstParty, aSrcdoc, aHeadersData, aLoadType, aSHEntry, aFirstParty,
aSourceDocShell, aBaseURI, false); aSrcdoc, aSourceDocShell, aBaseURI, false);
// We don't need any success handler since in that case // We don't need any success handler since in that case
// OnPartialSHistoryDeactive would be called, and it would ensure // OnPartialSHistoryDeactive would be called, and it would ensure
// docshell loads about:blank. // docshell loads about:blank.
@@ -10858,7 +10866,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER), !(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
aReferrerPolicy, aReferrerPolicy,
aTriggeringPrincipal, principalToInherit, aTypeHint, aTriggeringPrincipal, principalToInherit, aTypeHint,
aFileName, aPostData, aHeadersData, aFileName, aPostData, aPostDataLength, aHeadersData,
aFirstParty, aDocShell, getter_AddRefs(req), aFirstParty, aDocShell, getter_AddRefs(req),
(aFlags & INTERNAL_LOAD_FLAGS_FIRST_LOAD) != 0, (aFlags & INTERNAL_LOAD_FLAGS_FIRST_LOAD) != 0,
(aFlags & INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER) != 0, (aFlags & INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER) != 0,
@@ -11000,6 +11008,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
const char* aTypeHint, const char* aTypeHint,
const nsAString& aFileName, const nsAString& aFileName,
nsIInputStream* aPostData, nsIInputStream* aPostData,
int64_t aPostDataLength,
nsIInputStream* aHeadersData, nsIInputStream* aHeadersData,
bool aFirstParty, bool aFirstParty,
nsIDocShell** aDocShell, nsIDocShell** aDocShell,
@@ -11426,7 +11435,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
} }
// we really need to have a content type associated with this stream!! // we really need to have a content type associated with this stream!!
postChannel->SetUploadStream(aPostData, EmptyCString(), -1); postChannel->SetUploadStream(aPostData, EmptyCString(), aPostDataLength);
} }
/* If there is a valid postdata *and* it is a History Load, /* If there is a valid postdata *and* it is a History Load,
@@ -12886,6 +12895,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType)
contentType.get(), // Type hint contentType.get(), // Type hint
VoidString(), // No forced file download VoidString(), // No forced file download
postData, // Post data stream postData, // Post data stream
-1, // Post data stream length
nullptr, // No headers stream nullptr, // No headers stream
aLoadType, // Load type aLoadType, // Load type
aEntry, // SHEntry aEntry, // SHEntry
@@ -14450,6 +14460,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
NS_LossyConvertUTF16toASCII(typeHint).get(), NS_LossyConvertUTF16toASCII(typeHint).get(),
aFileName, // Download as file aFileName, // Download as file
aPostDataStream, // Post data stream aPostDataStream, // Post data stream
-1, // Post data stream length XXXbaku
aHeadersDataStream, // Headers stream aHeadersDataStream, // Headers stream
LOAD_LINK, // Load type LOAD_LINK, // Load type
nullptr, // No SHEntry nullptr, // No SHEntry

View File

@@ -435,6 +435,7 @@ protected:
const char* aTypeHint, const char* aTypeHint,
const nsAString& aFileName, const nsAString& aFileName,
nsIInputStream* aPostData, nsIInputStream* aPostData,
int64_t aPostDataLength,
nsIInputStream* aHeadersData, nsIInputStream* aHeadersData,
bool aFirstParty, bool aFirstParty,
nsIDocShell** aDocShell, nsIDocShell** aDocShell,

View File

@@ -173,6 +173,8 @@ interface nsIDocShell : nsIDocShellTreeItem
* @param aFileName - Non-null when the link should be downloaded as * @param aFileName - Non-null when the link should be downloaded as
the given filename. the given filename.
* @param aPostDataStream - Post data stream (if POSTing) * @param aPostDataStream - Post data stream (if POSTing)
* @param aPostDataStreamLength - Post data stream length. Use -1 if the length
of the stream is unknown.
* @param aHeadersStream - Stream containing "extra" request headers... * @param aHeadersStream - Stream containing "extra" request headers...
* @param aLoadFlags - Flags to modify load behaviour. Flags are defined * @param aLoadFlags - Flags to modify load behaviour. Flags are defined
* in nsIWebNavigation. * in nsIWebNavigation.
@@ -198,6 +200,7 @@ interface nsIDocShell : nsIDocShellTreeItem
in string aTypeHint, in string aTypeHint,
in AString aFileName, in AString aFileName,
in nsIInputStream aPostDataStream, in nsIInputStream aPostDataStream,
in long long aPostDataStreamLength,
in nsIInputStream aHeadersStream, in nsIInputStream aHeadersStream,
in unsigned long aLoadFlags, in unsigned long aLoadFlags,
in nsISHEntry aSHEntry, in nsISHEntry aSHEntry,