Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
13d25529
Commit
13d25529
authored
Feb 27, 2023
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Mar 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Track readyState in XHRs and report it manually.
So it can be forced to specific values during synchronous XHRs. Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
06b1679e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
40 deletions
+31
-40
xmlhttprequest.c
dlls/mshtml/xmlhttprequest.c
+31
-40
No files found.
dlls/mshtml/xmlhttprequest.c
View file @
13d25529
...
...
@@ -137,6 +137,7 @@ struct HTMLXMLHttpRequest {
IWineXMLHttpRequestPrivate
IWineXMLHttpRequestPrivate_iface
;
IProvideClassInfo2
IProvideClassInfo2_iface
;
LONG
ref
;
LONG
ready_state
;
response_type_t
response_type
;
nsIXMLHttpRequest
*
nsxhr
;
XMLHttpReqEventListener
*
event_listener
;
...
...
@@ -220,6 +221,7 @@ static nsrefcnt NSAPI XMLHttpReqEventListener_Release(nsIDOMEventListener *iface
static
nsresult
NSAPI
XMLHttpReqEventListener_HandleEvent
(
nsIDOMEventListener
*
iface
,
nsIDOMEvent
*
nsevent
)
{
XMLHttpReqEventListener
*
This
=
impl_from_nsIDOMEventListener
(
iface
);
UINT16
ready_state
;
DOMEvent
*
event
;
HRESULT
hres
;
...
...
@@ -228,6 +230,9 @@ static nsresult NSAPI XMLHttpReqEventListener_HandleEvent(nsIDOMEventListener *i
if
(
!
This
->
xhr
)
return
NS_OK
;
if
(
NS_SUCCEEDED
(
nsIXMLHttpRequest_GetReadyState
(
This
->
xhr
->
nsxhr
,
&
ready_state
)))
This
->
xhr
->
ready_state
=
ready_state
;
hres
=
create_event_from_nsevent
(
nsevent
,
dispex_compat_mode
(
&
This
->
xhr
->
event_target
.
dispex
),
&
event
);
if
(
SUCCEEDED
(
hres
)
){
dispatch_event
(
&
This
->
xhr
->
event_target
,
event
);
...
...
@@ -339,19 +344,12 @@ static HRESULT WINAPI HTMLXMLHttpRequest_Invoke(IHTMLXMLHttpRequest *iface, DISP
static
HRESULT
WINAPI
HTMLXMLHttpRequest_get_readyState
(
IHTMLXMLHttpRequest
*
iface
,
LONG
*
p
)
{
HTMLXMLHttpRequest
*
This
=
impl_from_IHTMLXMLHttpRequest
(
iface
);
UINT16
val
;
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
!
p
)
return
E_POINTER
;
nsres
=
nsIXMLHttpRequest_GetReadyState
(
This
->
nsxhr
,
&
val
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"nsIXMLHttpRequest_GetReadyState failed: %08lx
\n
"
,
nsres
);
return
E_FAIL
;
}
*
p
=
val
;
*
p
=
This
->
ready_state
;
return
S_OK
;
}
...
...
@@ -373,6 +371,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseText(IHTMLXMLHttpRequest *i
if
(
!
p
)
return
E_POINTER
;
if
(
This
->
ready_state
<
READYSTATE_INTERACTIVE
)
{
*
p
=
NULL
;
return
S_OK
;
}
nsAString_Init
(
&
nsstr
,
NULL
);
nsres
=
nsIXMLHttpRequest_GetResponseText
(
This
->
nsxhr
,
&
nsstr
);
return
return_nsstr
(
nsres
,
&
nsstr
,
p
);
...
...
@@ -389,6 +392,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *if
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
This
->
ready_state
<
READYSTATE_COMPLETE
)
{
*
p
=
NULL
;
return
S_OK
;
}
if
(
dispex_compat_mode
(
&
This
->
event_target
.
dispex
)
>=
COMPAT_MODE_IE10
)
{
nsIDOMDocument
*
nsdoc
;
nsresult
nsres
;
...
...
@@ -443,6 +451,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_status(IHTMLXMLHttpRequest *iface,
if
(
!
p
)
return
E_POINTER
;
if
(
This
->
ready_state
<
READYSTATE_LOADED
)
{
*
p
=
0
;
return
E_FAIL
;
}
nsres
=
nsIXMLHttpRequest_GetStatus
(
This
->
nsxhr
,
&
val
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"nsIXMLHttpRequest_GetStatus failed: %08lx
\n
"
,
nsres
);
...
...
@@ -460,19 +473,13 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_statusText(IHTMLXMLHttpRequest *ifa
HTMLXMLHttpRequest
*
This
=
impl_from_IHTMLXMLHttpRequest
(
iface
);
nsACString
nscstr
;
nsresult
nsres
;
HRESULT
hres
;
LONG
state
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
!
p
)
return
E_POINTER
;
hres
=
IHTMLXMLHttpRequest_get_readyState
(
iface
,
&
state
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
state
<
2
)
{
if
(
This
->
ready_state
<
READYSTATE_LOADED
)
{
*
p
=
NULL
;
return
E_FAIL
;
}
...
...
@@ -503,6 +510,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_get_onreadystatechange(IHTMLXMLHttpRequ
static
HRESULT
WINAPI
HTMLXMLHttpRequest_abort
(
IHTMLXMLHttpRequest
*
iface
)
{
HTMLXMLHttpRequest
*
This
=
impl_from_IHTMLXMLHttpRequest
(
iface
);
UINT16
ready_state
;
nsresult
nsres
;
TRACE
(
"(%p)->()
\n
"
,
This
);
...
...
@@ -513,6 +521,10 @@ static HRESULT WINAPI HTMLXMLHttpRequest_abort(IHTMLXMLHttpRequest *iface)
return
E_FAIL
;
}
/* Gecko changed to READYSTATE_UNINITIALIZED if it did abort */
nsres
=
nsIXMLHttpRequest_GetReadyState
(
This
->
nsxhr
,
&
ready_state
);
if
(
NS_SUCCEEDED
(
nsres
))
This
->
ready_state
=
ready_state
;
return
S_OK
;
}
...
...
@@ -656,19 +668,13 @@ static HRESULT WINAPI HTMLXMLHttpRequest_getAllResponseHeaders(IHTMLXMLHttpReque
HTMLXMLHttpRequest
*
This
=
impl_from_IHTMLXMLHttpRequest
(
iface
);
nsACString
nscstr
;
nsresult
nsres
;
HRESULT
hres
;
LONG
state
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
!
p
)
return
E_POINTER
;
hres
=
IHTMLXMLHttpRequest_get_readyState
(
iface
,
&
state
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
state
<
2
)
{
if
(
This
->
ready_state
<
READYSTATE_LOADED
)
{
*
p
=
NULL
;
return
E_FAIL
;
}
...
...
@@ -684,8 +690,6 @@ static HRESULT WINAPI HTMLXMLHttpRequest_getResponseHeader(IHTMLXMLHttpRequest *
nsACString
header
,
ret
;
char
*
cstr
;
nsresult
nsres
;
HRESULT
hres
;
LONG
state
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
bstrHeader
),
p
);
if
(
!
p
)
...
...
@@ -693,11 +697,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_getResponseHeader(IHTMLXMLHttpRequest *
if
(
!
bstrHeader
)
return
E_INVALIDARG
;
hres
=
IHTMLXMLHttpRequest_get_readyState
(
iface
,
&
state
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
state
<
2
)
{
if
(
This
->
ready_state
<
READYSTATE_LOADED
)
{
*
p
=
NULL
;
return
E_FAIL
;
}
...
...
@@ -938,8 +938,6 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_get_response(IWineXMLHttpReques
{
HTMLXMLHttpRequest
*
This
=
impl_from_IWineXMLHttpRequestPrivate
(
iface
);
HRESULT
hres
=
S_OK
;
nsresult
nsres
;
UINT16
state
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
...
...
@@ -957,8 +955,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_get_response(IWineXMLHttpReques
case
response_type_arraybuf
:
case
response_type_blob
:
nsres
=
nsIXMLHttpRequest_GetReadyState
(
This
->
nsxhr
,
&
state
);
if
(
NS_FAILED
(
nsres
)
||
state
<
4
)
{
if
(
This
->
ready_state
<
READYSTATE_COMPLETE
)
{
V_VT
(
p
)
=
VT_EMPTY
;
break
;
}
...
...
@@ -985,17 +982,11 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_put_responseType(IWineXMLHttpRe
HTMLXMLHttpRequest
*
This
=
impl_from_IWineXMLHttpRequestPrivate
(
iface
);
nsAString
nsstr
;
nsresult
nsres
;
HRESULT
hres
;
unsigned
i
;
LONG
state
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
v
));
hres
=
IHTMLXMLHttpRequest_get_readyState
(
&
This
->
IHTMLXMLHttpRequest_iface
,
&
state
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
state
<
1
||
state
>
2
)
{
if
(
This
->
ready_state
<
READYSTATE_LOADING
||
This
->
ready_state
>
READYSTATE_INTERACTIVE
)
{
/* FIXME: Return InvalidStateError */
return
E_FAIL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment