Module: wine Branch: master Commit: dd4a92bc259c5bddcf5265d608231646215496fd URL: https://source.winehq.org/git/wine.git/?a=commit;h=dd4a92bc259c5bddcf5265d60...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Mon Jun 6 15:24:14 2022 +0300
mshtml: Implement withCredentials for XMLHttpRequest.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mshtml/tests/xhr.js | 6 ++++++ dlls/mshtml/xmlhttprequest.c | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/tests/xhr.js b/dlls/mshtml/tests/xhr.js index 0f11b786555..c450384e931 100644 --- a/dlls/mshtml/tests/xhr.js +++ b/dlls/mshtml/tests/xhr.js @@ -57,6 +57,12 @@ function test_xhr() {
xhr.open("POST", "echo.php", true); xhr.setRequestHeader("X-Test", "True"); + if("withCredentials" in xhr) { + ok(xhr.withCredentials === false, "default withCredentials = " + xhr.withCredentials); + xhr.withCredentials = true; + ok(xhr.withCredentials === true, "withCredentials = " + xhr.withCredentials); + xhr.withCredentials = false; + } xhr.send("Testing..."); }
diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index d12a98d5615..8fa91e9960b 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -941,18 +941,24 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_put_withCredentials(IWineXMLHtt { HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface);
- FIXME("(%p)->(%x)\n", This, v); + TRACE("(%p)->(%x)\n", This, v);
- return E_NOTIMPL; + return map_nsresult(nsIXMLHttpRequest_SetWithCredentials(This->nsxhr, !!v)); }
static HRESULT WINAPI HTMLXMLHttpRequest_private_get_withCredentials(IWineXMLHttpRequestPrivate *iface, VARIANT_BOOL *p) { HTMLXMLHttpRequest *This = impl_from_IWineXMLHttpRequestPrivate(iface); + nsresult nsres; + cpp_bool b;
- FIXME("(%p)->(%p)\n", This, p); + TRACE("(%p)->(%p)\n", This, p);
- return E_NOTIMPL; + nsres = nsIXMLHttpRequest_GetWithCredentials(This->nsxhr, &b); + if(NS_FAILED(nsres)) + return map_nsresult(nsres); + *p = b ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; }
static HRESULT WINAPI HTMLXMLHttpRequest_private_overrideMimeType(IWineXMLHttpRequestPrivate *iface, BSTR mimeType)