mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 783562 - blob: protocol wrong Content-Type header. r=sicking
This commit is contained in:
parent
8da33ddcbd
commit
db9770f171
@ -77,6 +77,7 @@
|
|||||||
#include "DictionaryHelpers.h"
|
#include "DictionaryHelpers.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsIPermissionManager.h"
|
#include "nsIPermissionManager.h"
|
||||||
|
#include "nsMimeTypes.h"
|
||||||
|
|
||||||
#include "nsWrapperCacheInlines.h"
|
#include "nsWrapperCacheInlines.h"
|
||||||
#include "nsStreamListenerWrapper.h"
|
#include "nsStreamListenerWrapper.h"
|
||||||
@ -3087,9 +3088,15 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Since we expect XML data, set the type hint accordingly
|
// Since we expect XML data, set the type hint accordingly
|
||||||
|
// if the channel doesn't know any content type.
|
||||||
// This means that we always try to parse local files as XML
|
// This means that we always try to parse local files as XML
|
||||||
// ignoring return value, as this is not critical
|
// ignoring return value, as this is not critical
|
||||||
mChannel->SetContentType(NS_LITERAL_CSTRING("application/xml"));
|
nsCAutoString contentType;
|
||||||
|
if (NS_FAILED(mChannel->GetContentType(contentType)) ||
|
||||||
|
contentType.IsEmpty() ||
|
||||||
|
contentType.Equals(UNKNOWN_CONTENT_TYPE)) {
|
||||||
|
mChannel->SetContentType(NS_LITERAL_CSTRING("application/xml"));
|
||||||
|
}
|
||||||
|
|
||||||
// We're about to send the request. Start our timeout.
|
// We're about to send the request. Start our timeout.
|
||||||
mRequestSentTime = PR_Now();
|
mRequestSentTime = PR_Now();
|
||||||
|
@ -189,7 +189,8 @@ nsJARInputThunk::IsNonBlocking(bool *nonBlocking)
|
|||||||
|
|
||||||
|
|
||||||
nsJARChannel::nsJARChannel()
|
nsJARChannel::nsJARChannel()
|
||||||
: mAppURI(nullptr)
|
: mOpened(false)
|
||||||
|
, mAppURI(nullptr)
|
||||||
, mContentLength(-1)
|
, mContentLength(-1)
|
||||||
, mLoadFlags(LOAD_NORMAL)
|
, mLoadFlags(LOAD_NORMAL)
|
||||||
, mStatus(NS_OK)
|
, mStatus(NS_OK)
|
||||||
@ -581,7 +582,15 @@ nsJARChannel::GetSecurityInfo(nsISupports **aSecurityInfo)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsJARChannel::GetContentType(nsACString &result)
|
nsJARChannel::GetContentType(nsACString &result)
|
||||||
{
|
{
|
||||||
|
// If the Jar file has not been open yet,
|
||||||
|
// We return application/x-unknown-content-type
|
||||||
|
if (!mOpened) {
|
||||||
|
result.Assign(UNKNOWN_CONTENT_TYPE);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (mContentType.IsEmpty()) {
|
if (mContentType.IsEmpty()) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// generate content type and set it
|
// generate content type and set it
|
||||||
//
|
//
|
||||||
@ -710,6 +719,8 @@ nsJARChannel::Open(nsIInputStream **stream)
|
|||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
NS_ADDREF(*stream = mJarInput);
|
NS_ADDREF(*stream = mJarInput);
|
||||||
|
|
||||||
|
mOpened = true;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,6 +765,7 @@ nsJARChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx)
|
|||||||
if (mLoadGroup)
|
if (mLoadGroup)
|
||||||
mLoadGroup->AddRequest(this, nullptr);
|
mLoadGroup->AddRequest(this, nullptr);
|
||||||
|
|
||||||
|
mOpened = true;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ private:
|
|||||||
nsCString mSpec;
|
nsCString mSpec;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool mOpened;
|
||||||
|
|
||||||
nsCOMPtr<nsIJARURI> mJarURI;
|
nsCOMPtr<nsIJARURI> mJarURI;
|
||||||
nsCOMPtr<nsIURI> mOriginalURI;
|
nsCOMPtr<nsIURI> mOriginalURI;
|
||||||
nsCOMPtr<nsIURI> mAppURI;
|
nsCOMPtr<nsIURI> mAppURI;
|
||||||
|
Loading…
Reference in New Issue
Block a user