ReactOS 0.4.16-dev-112-g52265ae
xmlhttprequest.c
Go to the documentation of this file.
1/*
2 * Copyright 2015 Zhenbo Li
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "mshtml_private.h"
20
22{
23 char *cstr = heap_strdupWtoU(bstr);
24 if(!cstr)
25 return E_OUTOFMEMORY;
26 nsACString_Init(str, cstr);
27 heap_free(cstr);
28 return S_OK;
29}
30
32{
33 switch(V_VT(&var)) {
34 case VT_NULL:
35 case VT_ERROR:
36 case VT_EMPTY:
38 return S_OK;
39 case VT_BSTR:
41 return S_OK;
42 default:
43 FIXME("Unsupported VARIANT: %s\n", debugstr_variant(&var));
44 return E_INVALIDARG;
45 }
46}
47
49{
50 const char *str;
51 int len;
52
53 if(NS_FAILED(nsres)) {
54 ERR("failed: %08x\n", nsres);
55 nsACString_Finish(nscstr);
56 return E_FAIL;
57 }
58
59 nsACString_GetData(nscstr, &str);
60
61 if(*str) {
62 len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
64 if(!*p) {
65 nsACString_Finish(nscstr);
66 return E_OUTOFMEMORY;
67 }
69 }else {
70 *p = NULL;
71 }
72
73 nsACString_Finish(nscstr);
74 return S_OK;
75}
76
78
79typedef struct {
81 IHTMLXMLHttpRequest IHTMLXMLHttpRequest_iface;
86
91};
92
94{
95 nsIDOMEventTarget *event_target;
97 nsresult nsres;
98
99 static const WCHAR readystatechangeW[] =
100 {'o','n','r','e','a','d','y','s','t','a','t','e','c','h','a','n','g','e',0};
101
102 nsres = nsIXMLHttpRequest_QueryInterface(event_listener->xhr->nsxhr, &IID_nsIDOMEventTarget, (void**)&event_target);
103 assert(nsres == NS_OK);
104
106 nsres = nsIDOMEventTarget_RemoveEventListener(event_target, &str, &event_listener->nsIDOMEventListener_iface, FALSE);
108 nsIDOMEventTarget_Release(event_target);
109
110 event_listener->xhr->event_listener = NULL;
111 event_listener->xhr = NULL;
112 nsIDOMEventListener_Release(&event_listener->nsIDOMEventListener_iface);
113}
114
115
117{
118 return CONTAINING_RECORD(iface, XMLHttpReqEventListener, nsIDOMEventListener_iface);
119}
120
122 nsIIDRef riid, void **result)
123{
125
126 if(IsEqualGUID(&IID_nsISupports, riid)) {
127 TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
128 *result = &This->nsIDOMEventListener_iface;
129 }else if(IsEqualGUID(&IID_nsIDOMEventListener, riid)) {
130 TRACE("(%p)->(IID_nsIDOMEventListener %p)\n", This, result);
131 *result = &This->nsIDOMEventListener_iface;
132 }else {
133 *result = NULL;
134 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
135 return NS_NOINTERFACE;
136 }
137
138 nsIDOMEventListener_AddRef(&This->nsIDOMEventListener_iface);
139 return NS_OK;
140}
141
143{
146
147 TRACE("(%p) ref=%d\n", This, ref);
148
149 return ref;
150}
151
153{
156
157 TRACE("(%p) ref=%d\n", This, ref);
158
159 if(!ref) {
160 assert(!This->xhr);
162 }
163
164 return ref;
165}
166
168{
170
171 TRACE("(%p)\n", This);
172
173 if(!This->xhr)
174 return NS_OK;
175
177 (IDispatch*)&This->xhr->IHTMLXMLHttpRequest_iface);
178 return NS_OK;
179}
180
181static const nsIDOMEventListenerVtbl XMLHttpReqEventListenerVtbl = {
186};
187
188static inline HTMLXMLHttpRequest *impl_from_IHTMLXMLHttpRequest(IHTMLXMLHttpRequest *iface)
189{
190 return CONTAINING_RECORD(iface, HTMLXMLHttpRequest, IHTMLXMLHttpRequest_iface);
191}
192
193static HRESULT WINAPI HTMLXMLHttpRequest_QueryInterface(IHTMLXMLHttpRequest *iface, REFIID riid, void **ppv)
194{
196
197 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
198
200 *ppv = &This->IHTMLXMLHttpRequest_iface;
201 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
202 *ppv = &This->IHTMLXMLHttpRequest_iface;
203 }else if(IsEqualGUID(&IID_IHTMLXMLHttpRequest, riid)) {
204 *ppv = &This->IHTMLXMLHttpRequest_iface;
205 }else if(dispex_query_interface(&This->event_target.dispex, riid, ppv)) {
206 return *ppv ? S_OK : E_NOINTERFACE;
207 }else {
208 *ppv = NULL;
209 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
210 return E_NOINTERFACE;
211 }
212
213 IUnknown_AddRef((IUnknown*)*ppv);
214 return S_OK;
215}
216
217static ULONG WINAPI HTMLXMLHttpRequest_AddRef(IHTMLXMLHttpRequest *iface)
218{
221
222 TRACE("(%p) ref=%d\n", This, ref);
223
224 return ref;
225}
226
227static ULONG WINAPI HTMLXMLHttpRequest_Release(IHTMLXMLHttpRequest *iface)
228{
231
232 TRACE("(%p) ref=%d\n", This, ref);
233
234 if(!ref) {
235 if(This->event_listener)
236 detach_xhr_event_listener(This->event_listener);
237 release_dispex(&This->event_target.dispex);
238 nsIXMLHttpRequest_Release(This->nsxhr);
240 }
241
242 return ref;
243}
244
245static HRESULT WINAPI HTMLXMLHttpRequest_GetTypeInfoCount(IHTMLXMLHttpRequest *iface, UINT *pctinfo)
246{
248 return IDispatchEx_GetTypeInfoCount(&This->event_target.dispex.IDispatchEx_iface, pctinfo);
249}
250
251static HRESULT WINAPI HTMLXMLHttpRequest_GetTypeInfo(IHTMLXMLHttpRequest *iface, UINT iTInfo,
252 LCID lcid, ITypeInfo **ppTInfo)
253{
255
256 return IDispatchEx_GetTypeInfo(&This->event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
257}
258
259static HRESULT WINAPI HTMLXMLHttpRequest_GetIDsOfNames(IHTMLXMLHttpRequest *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
260 LCID lcid, DISPID *rgDispId)
261{
263
264 return IDispatchEx_GetIDsOfNames(&This->event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
265 lcid, rgDispId);
266}
267
268static HRESULT WINAPI HTMLXMLHttpRequest_Invoke(IHTMLXMLHttpRequest *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
269 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
270{
272
273 return IDispatchEx_Invoke(&This->event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
274 pDispParams, pVarResult, pExcepInfo, puArgErr);
275}
276
277static HRESULT WINAPI HTMLXMLHttpRequest_get_readyState(IHTMLXMLHttpRequest *iface, LONG *p)
278{
280 UINT16 val;
281 nsresult nsres;
282
283 TRACE("(%p)->(%p)\n", This, p);
284
285 if(!p)
286 return E_POINTER;
287 nsres = nsIXMLHttpRequest_GetReadyState(This->nsxhr, &val);
288 if(NS_FAILED(nsres)) {
289 ERR("nsIXMLHttpRequest_GetReadyState failed: %08x\n", nsres);
290 return E_FAIL;
291 }
292 *p = val;
293 return S_OK;
294}
295
296static HRESULT WINAPI HTMLXMLHttpRequest_get_responseBody(IHTMLXMLHttpRequest *iface, VARIANT *p)
297{
299 FIXME("(%p)->(%p)\n", This, p);
300 return E_NOTIMPL;
301}
302
303static HRESULT WINAPI HTMLXMLHttpRequest_get_responseText(IHTMLXMLHttpRequest *iface, BSTR *p)
304{
306 nsAString nsstr;
307 nsresult nsres;
308
309 TRACE("(%p)->(%p)\n", This, p);
310
311 if(!p)
312 return E_POINTER;
313
314 nsAString_Init(&nsstr, NULL);
315 nsres = nsIXMLHttpRequest_GetResponseText(This->nsxhr, &nsstr);
316 return return_nsstr(nsres, &nsstr, p);
317}
318
319static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *iface, IDispatch **p)
320{
322 FIXME("(%p)->(%p)\n", This, p);
323 return E_NOTIMPL;
324}
325
326static HRESULT WINAPI HTMLXMLHttpRequest_get_status(IHTMLXMLHttpRequest *iface, LONG *p)
327{
329 DWORD val;
330 nsresult nsres;
331 TRACE("(%p)->(%p)\n", This, p);
332
333 if(!p)
334 return E_POINTER;
335
336 nsres = nsIXMLHttpRequest_GetStatus(This->nsxhr, &val);
337 if(NS_FAILED(nsres)) {
338 ERR("nsIXMLHttpRequest_GetStatus failed: %08x\n", nsres);
339 return E_FAIL;
340 }
341 *p = val;
342 if(val == 0)
343 return E_FAIL; /* WinAPI thinks this is an error */
344
345 return S_OK;
346}
347
348static HRESULT WINAPI HTMLXMLHttpRequest_get_statusText(IHTMLXMLHttpRequest *iface, BSTR *p)
349{
351 nsACString nscstr;
352 nsresult nsres;
354 LONG state;
355
356 TRACE("(%p)->(%p)\n", This, p);
357
358 if(!p)
359 return E_POINTER;
360
361 hres = IHTMLXMLHttpRequest_get_readyState(iface, &state);
362 if(FAILED(hres))
363 return hres;
364
365 if(state < 2) {
366 *p = NULL;
367 return E_FAIL;
368 }
369
370 nsACString_Init(&nscstr, NULL);
371 nsres = nsIXMLHttpRequest_GetStatusText(This->nsxhr, &nscstr);
372 return return_nscstr(nsres, &nscstr, p);
373}
374
376{
378
379 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
380
381 return set_event_handler(&This->event_target, EVENTID_READYSTATECHANGE, &v);
382}
383
385{
387
388 TRACE("(%p)->(%p)\n", This, p);
389
390 return get_event_handler(&This->event_target, EVENTID_READYSTATECHANGE, p);
391}
392
393static HRESULT WINAPI HTMLXMLHttpRequest_abort(IHTMLXMLHttpRequest *iface)
394{
396 nsresult nsres;
397
398 TRACE("(%p)->()\n", This);
399
400 nsres = nsIXMLHttpRequest_SlowAbort(This->nsxhr);
401 if(NS_FAILED(nsres)) {
402 ERR("nsIXMLHttpRequest_SlowAbort failed: %08x\n", nsres);
403 return E_FAIL;
404 }
405
406 return S_OK;
407}
408
409static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR bstrMethod, BSTR bstrUrl, VARIANT varAsync, VARIANT varUser, VARIANT varPassword)
410{
414 nsresult nsres;
416
417 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl), debugstr_variant(&varAsync), debugstr_variant(&varUser), debugstr_variant(&varPassword));
418
419 if(V_VT(&varAsync) != VT_BOOL) {
420 FIXME("varAsync not supported: %s\n", debugstr_variant(&varAsync));
421 return E_FAIL;
422 }
423
424 /* Note: Starting with Gecko 30.0 (Firefox 30.0 / Thunderbird 30.0 / SeaMonkey 2.27),
425 * synchronous requests on the main thread have been deprecated due to the negative
426 * effects to the user experience.
427 */
428 if(!V_BOOL(&varAsync)) {
429 FIXME("Synchronous request is not supported yet\n");
430 return E_FAIL;
431 }
432
433 hres = variant_to_nsastr(varUser, &user);
434 if(FAILED(hres))
435 return hres;
436 hres = variant_to_nsastr(varPassword, &password);
437 if(FAILED(hres)) {
439 return hres;
440 }
441
442 hres = bstr_to_nsacstr(bstrMethod, &method);
443 if(FAILED(hres)) {
446 return hres;
447 }
448 hres = bstr_to_nsacstr(bstrUrl, &url);
449 if(FAILED(hres)) {
453 return hres;
454 }
455
456 nsres = nsIXMLHttpRequest_Open(This->nsxhr, &method, &url, TRUE,
457 &user, &password, 0);
458
463
464 if(NS_FAILED(nsres)) {
465 ERR("nsIXMLHttpRequest_Open failed: %08x\n", nsres);
466 return E_FAIL;
467 }
468
469 return S_OK;
470}
471
472static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody)
473{
475 nsresult nsres;
476
477 TRACE("(%p)->(%s)\n", This, debugstr_variant(&varBody));
478
479 switch(V_VT(&varBody)) {
480 case VT_NULL:
481 case VT_EMPTY:
482 case VT_ERROR:
483 break;
484 default:
485 FIXME("varBody(%s) unsupported\n", debugstr_variant(&varBody));
486 return E_FAIL;
487 }
488
489 nsres = nsIXMLHttpRequest_Send(This->nsxhr, NULL);
490
491 if(NS_FAILED(nsres)) {
492 ERR("nsIXMLHttpRequest_Send failed: %08x\n", nsres);
493 return E_FAIL;
494 }
495
496 return S_OK;
497}
498
500{
502 nsACString nscstr;
503 nsresult nsres;
505 LONG state;
506
507 TRACE("(%p)->(%p)\n", This, p);
508
509 if(!p)
510 return E_POINTER;
511
512 hres = IHTMLXMLHttpRequest_get_readyState(iface, &state);
513 if(FAILED(hres))
514 return hres;
515
516 if(state < 2) {
517 *p = NULL;
518 return E_FAIL;
519 }
520
521 nsACString_Init(&nscstr, NULL);
522 nsres = nsIXMLHttpRequest_GetAllResponseHeaders(This->nsxhr, &nscstr);
523 return return_nscstr(nsres, &nscstr, p);
524}
525
526static HRESULT WINAPI HTMLXMLHttpRequest_getResponseHeader(IHTMLXMLHttpRequest *iface, BSTR bstrHeader, BSTR *p)
527{
530 char *cstr;
531 nsresult nsres;
533 LONG state;
534 TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrHeader), p);
535
536 if(!p)
537 return E_POINTER;
538 if(!bstrHeader)
539 return E_INVALIDARG;
540
541 hres = IHTMLXMLHttpRequest_get_readyState(iface, &state);
542 if(FAILED(hres))
543 return hres;
544
545 if(state < 2) {
546 *p = NULL;
547 return E_FAIL;
548 }
549
550 cstr = heap_strdupWtoU(bstrHeader);
553
554 nsres = nsIXMLHttpRequest_GetResponseHeader(This->nsxhr, &header, &ret);
555
557 heap_free(cstr);
558 return return_nscstr(nsres, &ret, p);
559}
560
561static HRESULT WINAPI HTMLXMLHttpRequest_setRequestHeader(IHTMLXMLHttpRequest *iface, BSTR bstrHeader, BSTR bstrValue)
562{
564 FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrHeader), debugstr_w(bstrValue));
565 return E_NOTIMPL;
566}
567
568static const IHTMLXMLHttpRequestVtbl HTMLXMLHttpRequestVtbl = {
590};
591
593{
594 return CONTAINING_RECORD(iface, HTMLXMLHttpRequest, event_target.dispex);
595}
596
597static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, int eid)
598{
600 nsIDOMEventTarget *nstarget;
601 nsAString type_str;
602 nsresult nsres;
603
604 static const WCHAR readystatechangeW[] = {'r','e','a','d','y','s','t','a','t','e','c','h','a','n','g','e',0};
605
606 TRACE("(%p)\n", This);
607
609
610 if(This->event_listener)
611 return;
612
613 This->event_listener = heap_alloc(sizeof(*This->event_listener));
614 if(!This->event_listener)
615 return;
616
617 This->event_listener->nsIDOMEventListener_iface.lpVtbl = &XMLHttpReqEventListenerVtbl;
618 This->event_listener->ref = 1;
619 This->event_listener->xhr = This;
620
621 nsres = nsIXMLHttpRequest_QueryInterface(This->nsxhr, &IID_nsIDOMEventTarget, (void**)&nstarget);
622 assert(nsres == NS_OK);
623
625 nsres = nsIDOMEventTarget_AddEventListener(nstarget, &type_str, &This->event_listener->nsIDOMEventListener_iface, FALSE, TRUE, 2);
626 nsAString_Finish(&type_str);
627 nsIDOMEventTarget_Release(nstarget);
628 if(NS_FAILED(nsres))
629 ERR("AddEventListener failed: %08x\n", nsres);
630}
631
633 NULL,
634 NULL,
635 NULL,
636 NULL,
637 NULL,
639};
640
642 IHTMLXMLHttpRequest_tid,
643 0
644};
647 DispHTMLXMLHttpRequest_tid,
648 NULL,
650};
651
652
653/* IHTMLXMLHttpRequestFactory */
654static inline HTMLXMLHttpRequestFactory *impl_from_IHTMLXMLHttpRequestFactory(IHTMLXMLHttpRequestFactory *iface)
655{
656 return CONTAINING_RECORD(iface, HTMLXMLHttpRequestFactory, IHTMLXMLHttpRequestFactory_iface);
657}
658
659static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpRequestFactory *iface, REFIID riid, void **ppv)
660{
662
663 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
664
666 *ppv = &This->IHTMLXMLHttpRequestFactory_iface;
667 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
668 *ppv = &This->IHTMLXMLHttpRequestFactory_iface;
669 }else if(IsEqualGUID(&IID_IHTMLXMLHttpRequestFactory, riid)) {
670 *ppv = &This->IHTMLXMLHttpRequestFactory_iface;
671 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
672 return *ppv ? S_OK : E_NOINTERFACE;
673 }else {
674 *ppv = NULL;
675 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
676 return E_NOINTERFACE;
677 }
678
679 IUnknown_AddRef((IUnknown*)*ppv);
680 return S_OK;
681}
682
683static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory *iface)
684{
687
688 TRACE("(%p) ref=%d\n", This, ref);
689
690 return ref;
691}
692
693static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory *iface)
694{
697
698 TRACE("(%p) ref=%d\n", This, ref);
699
700 if(!ref) {
701 release_dispex(&This->dispex);
703 }
704
705 return ref;
706}
707
708static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfoCount(IHTMLXMLHttpRequestFactory *iface, UINT *pctinfo)
709{
711 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
712}
713
714static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfo(IHTMLXMLHttpRequestFactory *iface, UINT iTInfo,
715 LCID lcid, ITypeInfo **ppTInfo)
716{
718
719 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
720}
721
722static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetIDsOfNames(IHTMLXMLHttpRequestFactory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
723 LCID lcid, DISPID *rgDispId)
724{
726
727 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
728 lcid, rgDispId);
729}
730
731static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactory *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
732 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
733{
735
736 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
737 pDispParams, pVarResult, pExcepInfo, puArgErr);
738}
739
740static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p)
741{
744 nsIXMLHttpRequest *nsxhr;
745
746 TRACE("(%p)->(%p)\n", This, p);
747
748 nsxhr = create_nsxhr(This->window->base.outer_window->nswindow);
749 if(!nsxhr)
750 return E_FAIL;
751
752 ret = heap_alloc_zero(sizeof(*ret));
753 if(!ret) {
754 nsIXMLHttpRequest_Release(nsxhr);
755 return E_OUTOFMEMORY;
756 }
757 ret->nsxhr = nsxhr;
758
759 ret->IHTMLXMLHttpRequest_iface.lpVtbl = &HTMLXMLHttpRequestVtbl;
760 init_dispex(&ret->event_target.dispex, (IUnknown*)&ret->IHTMLXMLHttpRequest_iface,
762 ret->ref = 1;
763
764 *p = &ret->IHTMLXMLHttpRequest_iface;
765 return S_OK;
766}
767
768static const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = {
777};
778
780 IHTMLXMLHttpRequestFactory_tid,
781 0
782};
784 NULL,
785 IHTMLXMLHttpRequestFactory_tid,
786 NULL,
788};
789
791{
793
794 ret = heap_alloc(sizeof(*ret));
795 if(!ret)
796 return E_OUTOFMEMORY;
797
798 ret->IHTMLXMLHttpRequestFactory_iface.lpVtbl = &HTMLXMLHttpRequestFactoryVtbl;
799 ret->ref = 1;
800 ret->window = window;
801
802 init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLXMLHttpRequestFactory_iface,
804
805 *ret_ptr = ret;
806 return S_OK;
807}
unsigned short UINT16
static int state
Definition: maze.c:121
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
OLECHAR * BSTR
Definition: compat.h:2293
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_ERROR
Definition: compat.h:2305
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
static HRESULT WINAPI HTMLXMLHttpRequest_getResponseHeader(IHTMLXMLHttpRequest *iface, BSTR bstrHeader, BSTR *p)
static HRESULT WINAPI HTMLXMLHttpRequest_getAllResponseHeaders(IHTMLXMLHttpRequest *iface, BSTR *p)
static ULONG WINAPI HTMLXMLHttpRequest_Release(IHTMLXMLHttpRequest *iface)
static nsrefcnt NSAPI XMLHttpReqEventListener_AddRef(nsIDOMEventListener *iface)
static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfo(IHTMLXMLHttpRequestFactory *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static HRESULT WINAPI HTMLXMLHttpRequest_setRequestHeader(IHTMLXMLHttpRequest *iface, BSTR bstrHeader, BSTR bstrValue)
HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow *window, HTMLXMLHttpRequestFactory **ret_ptr)
static dispex_static_data_t HTMLXMLHttpRequestFactory_dispex
static dispex_static_data_t HTMLXMLHttpRequest_dispex
static ULONG WINAPI HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory *iface)
static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfoCount(IHTMLXMLHttpRequestFactory *iface, UINT *pctinfo)
static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody)
static HRESULT WINAPI HTMLXMLHttpRequest_GetIDsOfNames(IHTMLXMLHttpRequest *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
static HRESULT WINAPI HTMLXMLHttpRequest_get_status(IHTMLXMLHttpRequest *iface, LONG *p)
static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetIDsOfNames(IHTMLXMLHttpRequestFactory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
static void detach_xhr_event_listener(XMLHttpReqEventListener *event_listener)
static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR bstrMethod, BSTR bstrUrl, VARIANT varAsync, VARIANT varUser, VARIANT varPassword)
static HRESULT WINAPI HTMLXMLHttpRequest_put_onreadystatechange(IHTMLXMLHttpRequest *iface, VARIANT v)
static HRESULT WINAPI HTMLXMLHttpRequest_Invoke(IHTMLXMLHttpRequest *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
static nsresult NSAPI XMLHttpReqEventListener_QueryInterface(nsIDOMEventListener *iface, nsIIDRef riid, void **result)
static HRESULT WINAPI HTMLXMLHttpRequest_QueryInterface(IHTMLXMLHttpRequest *iface, REFIID riid, void **ppv)
static HRESULT WINAPI HTMLXMLHttpRequest_GetTypeInfoCount(IHTMLXMLHttpRequest *iface, UINT *pctinfo)
static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory *iface)
static HRESULT bstr_to_nsacstr(BSTR bstr, nsACString *str)
static HRESULT WINAPI HTMLXMLHttpRequest_abort(IHTMLXMLHttpRequest *iface)
static HRESULT WINAPI HTMLXMLHttpRequest_get_statusText(IHTMLXMLHttpRequest *iface, BSTR *p)
static const IHTMLXMLHttpRequestVtbl HTMLXMLHttpRequestVtbl
static const tid_t HTMLXMLHttpRequest_iface_tids[]
static const tid_t HTMLXMLHttpRequestFactory_iface_tids[]
static HRESULT WINAPI HTMLXMLHttpRequest_get_readyState(IHTMLXMLHttpRequest *iface, LONG *p)
static HRESULT variant_to_nsastr(VARIANT var, nsAString *ret)
static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *iface, IDispatch **p)
static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, int eid)
static ULONG WINAPI HTMLXMLHttpRequest_AddRef(IHTMLXMLHttpRequest *iface)
static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p)
static dispex_static_data_vtbl_t HTMLXMLHttpRequest_dispex_vtbl
static XMLHttpReqEventListener * impl_from_nsIDOMEventListener(nsIDOMEventListener *iface)
static HRESULT WINAPI HTMLXMLHttpRequest_GetTypeInfo(IHTMLXMLHttpRequest *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
static nsrefcnt NSAPI XMLHttpReqEventListener_Release(nsIDOMEventListener *iface)
static HTMLXMLHttpRequestFactory * impl_from_IHTMLXMLHttpRequestFactory(IHTMLXMLHttpRequestFactory *iface)
static const nsIDOMEventListenerVtbl XMLHttpReqEventListenerVtbl
static HTMLXMLHttpRequest * impl_from_DispatchEx(DispatchEx *iface)
static const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl
static HRESULT WINAPI HTMLXMLHttpRequest_get_responseBody(IHTMLXMLHttpRequest *iface, VARIANT *p)
static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactory *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
static HRESULT WINAPI HTMLXMLHttpRequest_get_onreadystatechange(IHTMLXMLHttpRequest *iface, VARIANT *p)
static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpRequestFactory *iface, REFIID riid, void **ppv)
static HRESULT return_nscstr(nsresult nsres, nsACString *nscstr, BSTR *p)
static nsresult NSAPI XMLHttpReqEventListener_HandleEvent(nsIDOMEventListener *iface, nsIDOMEvent *event)
static HTMLXMLHttpRequest * impl_from_IHTMLXMLHttpRequest(IHTMLXMLHttpRequest *iface)
static HRESULT WINAPI HTMLXMLHttpRequest_get_responseText(IHTMLXMLHttpRequest *iface, BSTR *p)
#define assert(x)
Definition: debug.h:53
method
Definition: dragdrop.c:54
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
const GLdouble * v
Definition: gl.h:2040
struct _cl_event * event
Definition: glext.h:7739
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
static const WCHAR readystatechangeW[]
Definition: htmlevent.c:106
HRESULT get_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var)
Definition: htmlevent.c:1447
void call_event_handlers(HTMLDocumentNode *doc, HTMLEventObj *event_obj, EventTarget *event_target, ConnectionPointContainer *cp_container, eventid_t eid, IDispatch *this_obj)
Definition: htmlevent.c:952
HRESULT set_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var)
Definition: htmlevent.c:1404
@ EVENTID_READYSTATECHANGE
Definition: htmlevent.h:47
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR url[]
Definition: encode.c:1432
const char * var
Definition: shader.c:5666
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
HRESULT hres
Definition: protocol.c:465
static IHTMLWindow2 * window
Definition: events.c:77
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
static WCHAR password[]
Definition: url.c:33
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
#define NS_OK
BOOL nsACString_Init(nsACString *str, const char *data) DECLSPEC_HIDDEN
Definition: nsembed.c:788
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
#define NSAPI
#define NS_NOINTERFACE
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
void nsACString_Finish(nsACString *) DECLSPEC_HIDDEN
Definition: nsembed.c:812
void nsACString_InitDepend(nsACString *, const char *) DECLSPEC_HIDDEN
Definition: nsembed.c:797
nsIXMLHttpRequest * create_nsxhr(nsIDOMWindow *nswindow) DECLSPEC_HIDDEN
Definition: nsembed.c:2156
static char * heap_strdupWtoU(const WCHAR *str)
#define NS_FAILED(res)
HRESULT return_nsstr(nsresult, nsAString *, BSTR *) DECLSPEC_HIDDEN
Definition: nsembed.c:841
UINT32 nsACString_GetData(const nsACString *, const char **) DECLSPEC_HIDDEN
Definition: nsembed.c:807
unsigned int UINT
Definition: ndis.h:50
REFIID nsIIDRef
Definition: nsiface.idl:45
ULONG nsrefcnt
Definition: nsiface.idl:40
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IDispatch
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
const WCHAR * str
DWORD LCID
Definition: nls.h:13
#define CP_UTF8
Definition: nls.h:20
#define TRACE(s)
Definition: solgame.cpp:4
IHTMLXMLHttpRequest IHTMLXMLHttpRequest_iface
EventTarget event_target
XMLHttpReqEventListener * event_listener
nsIXMLHttpRequest * nsxhr
HTMLXMLHttpRequest * xhr
nsIDOMEventListener nsIDOMEventListener_iface
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365
__wchar_t WCHAR
Definition: xmlstorage.h:180