mshtml: Support X-UA-Compatible HTTP header.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Jacek Caban 2018-02-26 18:21:11 +01:00 committed by Alexandre Julliard
parent 216ad43f18
commit 9ae8b8c00f
3 changed files with 45 additions and 1 deletions

View File

@ -147,6 +147,7 @@ HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD) DECLSPEC_HIDDEN;
HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,request_data_t*,IHTMLWindow2**) DECLSPEC_HIDDEN;
HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*,DWORD) DECLSPEC_HIDDEN;
HRESULT submit_form(HTMLOuterWindow*,const WCHAR*,IUri*,nsIInputStream*) DECLSPEC_HIDDEN;
void process_document_response_headers(HTMLDocumentNode*,IBinding*) DECLSPEC_HIDDEN;
void init_bscallback(BSCallback*,const BSCallbackVtbl*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,BOOL,nsChannelBSC**) DECLSPEC_HIDDEN;

View File

@ -29,6 +29,7 @@
#include "winreg.h"
#include "ole2.h"
#include "shlguid.h"
#include "wininet.h"
#include "mshtml_private.h"
#include "htmlscript.h"
@ -394,6 +395,8 @@ static BOOL parse_ua_compatible(const WCHAR *p, compat_mode_t *r)
static const WCHAR edgeW[] = {'e','d','g','e',0};
TRACE("%s\n", debugstr_w(p));
if(p[0] != 'I' || p[1] != 'E' || p[2] != '=')
return FALSE;
p += 3;
@ -432,6 +435,39 @@ static BOOL parse_ua_compatible(const WCHAR *p, compat_mode_t *r)
return TRUE;
}
void process_document_response_headers(HTMLDocumentNode *doc, IBinding *binding)
{
IWinInetHttpInfo *http_info;
char buf[1024];
DWORD size;
HRESULT hres;
hres = IBinding_QueryInterface(binding, &IID_IWinInetHttpInfo, (void**)&http_info);
if(FAILED(hres)) {
TRACE("No IWinInetHttpInfo\n");
return;
}
size = sizeof(buf);
strcpy(buf, "X-UA-Compatible");
hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
if(hres == S_OK && size) {
compat_mode_t document_mode;
WCHAR *header;
TRACE("size %u\n", size);
header = heap_strdupAtoW(buf);
if(header && parse_ua_compatible(header, &document_mode)) {
TRACE("setting document mode %d\n", document_mode);
doc->document_mode = document_mode;
}
heap_free(header);
}
IWinInetHttpInfo_Release(http_info);
}
static void process_meta_element(HTMLDocumentNode *doc, nsIDOMHTMLMetaElement *meta_element)
{
nsAString http_equiv_str, content_str;

View File

@ -1003,9 +1003,16 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
}
if(This->is_doc_channel) {
HRESULT hres;
if(!This->bsc.window)
return E_ABORT; /* Binding aborted in OnStartRequest call. */
update_window_doc(This->bsc.window);
hres = update_window_doc(This->bsc.window);
if(FAILED(hres))
return hres;
if(This->bsc.binding)
process_document_response_headers(This->bsc.window->doc, This->bsc.binding);
if(This->bsc.window->base.outer_window->readystate != READYSTATE_LOADING)
set_ready_state(This->bsc.window->base.outer_window, READYSTATE_LOADING);
}