aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lauxlib.js5
-rw-r--r--src/loadlib.js2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 0db125e..1314d34 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -808,11 +808,12 @@ if (!WEB) {
let xhr = new XMLHttpRequest();
xhr.open("GET", jsfilename, false);
- xhr.responseType = "arraybuffer";
+ // TODO: find a way to load bytes instead of js string
xhr.send();
if (xhr.status >= 200 && xhr.status <= 299) {
- lf.f = new Uint8Array(xhr.response);
+ /* TODO: Synchronous xhr alway return a js string */
+ lf.f = new Uint8Array(lua.to_luastring(xhr.response));
} else {
lf.err = xhr.status;
return errfile(L, "open", fnameindex, xhr.status);
diff --git a/src/loadlib.js b/src/loadlib.js
index 7458704..7562cea 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -100,7 +100,7 @@ if (!WEB) {
readable = function(filename) {
/* TODO: do a GET and store it somewhere to avoid doing two roundtrips ? */
let xhr = new XMLHttpRequest();
- xhr.open("HEAD", filename, false);
+ xhr.open("HEAD", lua.to_jsstring(filename), false);
xhr.send();
/* TODO: subresource integrity check? */