mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 04:49:47 +00:00
mshtml: Respect LOAD_CALL_CONTENT_SNIFFERS when using detected mime type.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
parent
59f1fdaf7f
commit
06e8d06be7
|
@ -1670,7 +1670,8 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCW
|
||||||
This->nschannel = NULL;
|
This->nschannel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!This->nschannel)
|
if(!This->nschannel ||
|
||||||
|
(This->nschannel->content_type && !(This->nschannel->load_flags & LOAD_CALL_CONTENT_SNIFFERS)))
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
heap_free(This->nschannel->content_type);
|
heap_free(This->nschannel->content_type);
|
||||||
|
|
|
@ -797,6 +797,16 @@ async_test("detached_img_error_event", function() {
|
||||||
img.src = "about:blank";
|
img.src = "about:blank";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async_test("img_wrong_content_type", function() {
|
||||||
|
var img = new Image();
|
||||||
|
img.onload = function() {
|
||||||
|
ok(img.width === 2, "width = " + img.width);
|
||||||
|
ok(img.height === 2, "height = " + img.height);
|
||||||
|
next_test();
|
||||||
|
}
|
||||||
|
img.src = "img.png?content-type=image/jpeg";
|
||||||
|
});
|
||||||
|
|
||||||
async_test("message event", function() {
|
async_test("message event", function() {
|
||||||
var listener_called = false;
|
var listener_called = false;
|
||||||
|
|
||||||
|
|
BIN
dlls/mshtml/tests/img.png
Normal file
BIN
dlls/mshtml/tests/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 74 B |
|
@ -80,3 +80,6 @@ res.html test "jstest.html"
|
||||||
|
|
||||||
/* @makedep: jstest.html */
|
/* @makedep: jstest.html */
|
||||||
dir/dir2/res.html test "jstest.html"
|
dir/dir2/res.html test "jstest.html"
|
||||||
|
|
||||||
|
/* @makedep: img.png */
|
||||||
|
img.png PNG "img.png"
|
||||||
|
|
|
@ -3043,6 +3043,7 @@ typedef struct {
|
||||||
IInternetProtocolSink *sink;
|
IInternetProtocolSink *sink;
|
||||||
BINDINFO bind_info;
|
BINDINFO bind_info;
|
||||||
|
|
||||||
|
BSTR content_type;
|
||||||
IStream *stream;
|
IStream *stream;
|
||||||
char *data;
|
char *data;
|
||||||
ULONG size;
|
ULONG size;
|
||||||
|
@ -3068,6 +3069,7 @@ static void report_data(ProtocolHandler *This)
|
||||||
IServiceProvider *service_provider;
|
IServiceProvider *service_provider;
|
||||||
IHttpNegotiate *http_negotiate;
|
IHttpNegotiate *http_negotiate;
|
||||||
WCHAR *addl_headers = NULL;
|
WCHAR *addl_headers = NULL;
|
||||||
|
WCHAR headers_buf[128];
|
||||||
BSTR headers, url;
|
BSTR headers, url;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
@ -3091,7 +3093,10 @@ static void report_data(ProtocolHandler *This)
|
||||||
|
|
||||||
CoTaskMemFree(addl_headers);
|
CoTaskMemFree(addl_headers);
|
||||||
|
|
||||||
headers = SysAllocString(L"HTTP/1.1 200 OK\r\n\r\n");
|
if(This->content_type)
|
||||||
|
swprintf(headers_buf, ARRAY_SIZE(headers_buf), L"HTTP/1.1 200 OK\r\nContent-Type: %s\r\n", This->content_type);
|
||||||
|
|
||||||
|
headers = SysAllocString(This->content_type ? headers_buf : L"HTTP/1.1 200 OK\r\n\r\n");
|
||||||
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, headers, NULL, NULL);
|
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, headers, NULL, NULL);
|
||||||
ok(hres == S_OK, "OnResponse failed: %08lx\n", hres);
|
ok(hres == S_OK, "OnResponse failed: %08lx\n", hres);
|
||||||
SysFreeString(headers);
|
SysFreeString(headers);
|
||||||
|
@ -3250,6 +3255,7 @@ static ULONG WINAPI Protocol_Release(IInternetProtocolEx *iface)
|
||||||
if(This->uri)
|
if(This->uri)
|
||||||
IUri_Release(This->uri);
|
IUri_Release(This->uri);
|
||||||
ReleaseBindInfo(&This->bind_info);
|
ReleaseBindInfo(&This->bind_info);
|
||||||
|
SysFreeString(This->content_type);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3397,7 +3403,8 @@ static HRESULT WINAPI ProtocolEx_StartEx(IInternetProtocolEx *iface, IUri *uri,
|
||||||
This->data = empty_data;
|
This->data = empty_data;
|
||||||
This->size = strlen(This->data);
|
This->size = strlen(This->data);
|
||||||
}else {
|
}else {
|
||||||
src = FindResourceW(NULL, *path == '/' ? path+1 : path, (const WCHAR*)RT_HTML);
|
const WCHAR *type = (SysStringLen(path) > 4 && !wcsicmp(path + SysStringLen(path) - 4, L".png")) ? L"PNG" : (const WCHAR*)RT_HTML;
|
||||||
|
src = FindResourceW(NULL, *path == '/' ? path+1 : path, type);
|
||||||
if(src) {
|
if(src) {
|
||||||
This->size = SizeofResource(NULL, src);
|
This->size = SizeofResource(NULL, src);
|
||||||
This->data = LoadResource(NULL, src);
|
This->data = LoadResource(NULL, src);
|
||||||
|
@ -3424,6 +3431,8 @@ static HRESULT WINAPI ProtocolEx_StartEx(IInternetProtocolEx *iface, IUri *uri,
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
if(!lstrcmpW(query, L"?delay"))
|
if(!lstrcmpW(query, L"?delay"))
|
||||||
This->delay = 1000;
|
This->delay = 1000;
|
||||||
|
else if(!wcsncmp(query, L"?content-type=", sizeof("?content-type=")-1))
|
||||||
|
This->content_type = SysAllocString(query + sizeof("?content-type=")-1);
|
||||||
SysFreeString(query);
|
SysFreeString(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue