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

[spidermonkey] Set async in xhr_open

This commit is contained in:
Witold Filipczyk 2022-09-21 20:05:45 +02:00
parent 17b3c58b96
commit 2b4368aee3

View File

@ -105,6 +105,7 @@ struct xhr {
char *responseURL;
char *statusText;
char *upload;
bool async;
bool withCredentials;
int method;
int readyState;
@ -278,6 +279,10 @@ xhr_open(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
if (argc < 2) {
return false;
}
if (!comp) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -343,6 +348,12 @@ xhr_open(JSContext *ctx, unsigned int argc, JS::Value *rval)
if (!xhr->uri) {
return false;
}
if (argc > 2) {
xhr->async = args[2].toBoolean();
} else {
xhr->async = true;
}
args.rval().setUndefined();
return true;