Module: wine Branch: master Commit: 9ae8b8c00f2cca205fdf4ce76e221778b7dfbea7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=9ae8b8c00f2cca205fdf4ce76...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Feb 26 18:21:11 2018 +0100
mshtml: Support X-UA-Compatible HTTP header.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/binding.h | 1 + dlls/mshtml/mutation.c | 36 ++++++++++++++++++++++++++++++++++++ dlls/mshtml/navigate.c | 9 ++++++++- 3 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h index 71c477a..f754bad 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 4e1e053..555a99b 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 a8d3330..9d6076d 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); }