1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-03 08:07:17 -05:00

[xhr] call onreadystatechange when DONE

This commit is contained in:
Witold Filipczyk 2022-10-18 19:16:49 +02:00
parent 45c725f709
commit df02b88d7b

View File

@ -700,7 +700,10 @@ xhr_loading_callback(struct download *download, struct xhr *xhr)
#endif #endif
if (is_in_state(download->state, S_TIMEOUT)) { if (is_in_state(download->state, S_TIMEOUT)) {
if (xhr->readyState != DONE) {
xhr->readyState = DONE; xhr->readyState = DONE;
register_bottom_half(onreadystatechange_run, xhr);
}
register_bottom_half(ontimeout_run, xhr); register_bottom_half(ontimeout_run, xhr);
register_bottom_half(onloadend_run, xhr); register_bottom_half(onloadend_run, xhr);
} else if (is_in_result_state(download->state)) { } else if (is_in_result_state(download->state)) {
@ -769,7 +772,10 @@ xhr_loading_callback(struct download *download, struct xhr *xhr)
} }
mem_free_set(&xhr->responseText, memacpy(fragment->data, fragment->length)); mem_free_set(&xhr->responseText, memacpy(fragment->data, fragment->length));
mem_free_set(&xhr->responseType, stracpy("")); mem_free_set(&xhr->responseType, stracpy(""));
if (xhr->readyState != DONE) {
xhr->readyState = DONE; xhr->readyState = DONE;
register_bottom_half(onreadystatechange_run, xhr);
}
register_bottom_half(onload_run, xhr); register_bottom_half(onload_run, xhr);
register_bottom_half(onloadend_run, xhr); register_bottom_half(onloadend_run, xhr);
} }