mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 635977. Make sure to always send OnStartRequest to our listener from nsIndexedToHTML. r=jduell, a=bsmedberg
This commit is contained in:
parent
3c84b0f955
commit
908c57b9ab
@ -151,6 +151,29 @@ nsIndexedToHTML::AsyncConvertData(const char *aFromType,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
||||
nsString buffer;
|
||||
nsresult rv = DoOnStartRequest(request, aContext, buffer);
|
||||
if (NS_FAILED(rv)) {
|
||||
request->Cancel(rv);
|
||||
}
|
||||
|
||||
rv = mListener->OnStartRequest(request, aContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// The request may have been canceled, and if that happens, we want to
|
||||
// suppress calls to OnDataAvailable.
|
||||
request->GetStatus(&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Push our buffer to the listener.
|
||||
|
||||
rv = FormatInputStream(request, aContext, buffer);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
nsString& aBuffer) {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
|
||||
@ -670,18 +693,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
||||
" </thead>\n");
|
||||
buffer.AppendLiteral(" <tbody>\n");
|
||||
|
||||
// Push buffer to the listener now, so the initial HTML will not
|
||||
// be parsed in OnDataAvailable().
|
||||
|
||||
rv = mListener->OnStartRequest(request, aContext);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// The request may have been canceled, and if that happens, we want to
|
||||
// suppress calls to OnDataAvailable.
|
||||
request->GetStatus(&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = FormatInputStream(request, aContext, buffer);
|
||||
aBuffer = buffer;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,10 @@ public:
|
||||
protected:
|
||||
|
||||
void FormatSizeString(PRInt64 inSize, nsString& outSizeString);
|
||||
nsresult FormatInputStream(nsIRequest* aRequest, nsISupports *aContext, const nsAString &aBuffer);
|
||||
nsresult FormatInputStream(nsIRequest* aRequest, nsISupports *aContext, const nsAString &aBuffer);
|
||||
// Helper to properly implement OnStartRequest
|
||||
nsresult DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
|
||||
nsString& aBuffer);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDirIndexParser> mParser;
|
||||
|
Loading…
Reference in New Issue
Block a user