mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[quickjs] Check undefined in xhr.open
And null in statusText getter.
This commit is contained in:
parent
66dcf19139
commit
b8dd815e10
@ -709,6 +709,10 @@ xhr_statustext_get(JSContext *ctx, JSValueConst this_val)
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
if (!x->status_text) {
|
||||
return JS_NULL;
|
||||
}
|
||||
|
||||
return JS_NewString(ctx, x->status_text);
|
||||
}
|
||||
|
||||
@ -1080,16 +1084,17 @@ xhr_open(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
|
||||
if (!x->uri) {
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
char *username = NULL;
|
||||
char *password = NULL;
|
||||
|
||||
if (argc > 3) {
|
||||
if (argc > 3 && !JS_IsUndefined(argv[3])) {
|
||||
username = (char *)JS_ToCString(ctx, argv[3]);
|
||||
}
|
||||
if (argc > 4) {
|
||||
|
||||
if (argc > 4 && !JS_IsUndefined(argv[4])) {
|
||||
password = (char *)JS_ToCString(ctx, argv[4]);
|
||||
}
|
||||
|
||||
if (username || password) {
|
||||
if (username) {
|
||||
x->uri->user = username;
|
||||
|
Loading…
Reference in New Issue
Block a user