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 580c8e42f6
commit 3a42475049
3 changed files with 30 additions and 15 deletions

View File

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

View File

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

View File

@ -173,6 +173,8 @@ interface nsIDocShell : nsIDocShellTreeItem
* @param aFileName - Non-null when the link should be downloaded as
the given filename.
* @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 aLoadFlags - Flags to modify load behaviour. Flags are defined
* in nsIWebNavigation.
@ -198,6 +200,7 @@ interface nsIDocShell : nsIDocShellTreeItem
in string aTypeHint,
in AString aFileName,
in nsIInputStream aPostDataStream,
in long long aPostDataStreamLength,
in nsIInputStream aHeadersStream,
in unsigned long aLoadFlags,
in nsISHEntry aSHEntry,