diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h index 71c477ab138..f754bad7630 100644 --- a/dlls/mshtml/binding.h +++ b/dlls/mshtml/binding.h @@ -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; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index 4e1e053026c..555a99bdaf4 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -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; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index a8d333015b1..9d6076d77e6 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -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); }