From 01acfa4327ea0614e051e2b21bc950c0ee8efa77 Mon Sep 17 00:00:00 2001 From: Arnold <40414978+PatriceJiang@users.noreply.github.com> Date: Mon, 29 Oct 2018 18:17:44 +0800 Subject: [PATCH] XMLHttpRequest fix readyState during onabort callback (#1567) * fix http request readyState after abort() * ignoreonreadystatechange when abort --- .../cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp b/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp index 762ce3a372..2cb58a6e3c 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_xmlhttprequest.cpp @@ -244,7 +244,7 @@ void XMLHttpRequest::abort() _isAborted = true; - setReadyState(ReadyState::UNSENT); + setReadyState(ReadyState::DONE); if (onabort != nullptr) { @@ -256,6 +256,8 @@ void XMLHttpRequest::abort() { onloadend(); } + + _readyState = ReadyState::UNSENT; } void XMLHttpRequest::setReadyState(ReadyState readyState)