From 8d778449a66a5b5223931b035544588b4de9a7d5 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 24 Jun 2024 20:36:09 +0200 Subject: [PATCH] [ecmascript] Compare the first character of url with slash It did not load '_static/something.json'. --- src/ecmascript/mujs/xhr.c | 2 +- src/ecmascript/quickjs/xhr.c | 2 +- src/ecmascript/spidermonkey/xhr.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ecmascript/mujs/xhr.c b/src/ecmascript/mujs/xhr.c index 3907230a..21cacbae 100644 --- a/src/ecmascript/mujs/xhr.c +++ b/src/ecmascript/mujs/xhr.c @@ -416,7 +416,7 @@ mjs_xhr_open(js_State *J) return; } - if (!strchr(xhr->responseURL, '/')) { + if (xhr->responseURL[0] != '/') { char *ref = get_uri_string(vs->uri, URI_DIR_LOCATION | URI_PATH); if (ref) { diff --git a/src/ecmascript/quickjs/xhr.c b/src/ecmascript/quickjs/xhr.c index 37222233..967699f6 100644 --- a/src/ecmascript/quickjs/xhr.c +++ b/src/ecmascript/quickjs/xhr.c @@ -1058,7 +1058,7 @@ xhr_open(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx); struct view_state *vs = interpreter->vs; - if (!strchr(x->responseURL, '/')) { + if (x->responseURL[0] != '/') { char *ref = get_uri_string(vs->uri, URI_DIR_LOCATION | URI_PATH); if (ref) { diff --git a/src/ecmascript/spidermonkey/xhr.cpp b/src/ecmascript/spidermonkey/xhr.cpp index 28e0359f..0505e4fc 100644 --- a/src/ecmascript/spidermonkey/xhr.cpp +++ b/src/ecmascript/spidermonkey/xhr.cpp @@ -608,7 +608,7 @@ xhr_open(JSContext *ctx, unsigned int argc, JS::Value *rval) return false; } - if (!strchr(xhr->responseURL, '/')) { + if (xhr->responseURL[0] != '/') { char *ref = get_uri_string(vs->uri, URI_DIR_LOCATION | URI_PATH); if (ref) {