diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-08-01 11:04:26 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-08-10 08:48:22 +0200 |
commit | c2c95f23d0a9adeb6a7c473461e74cfbbf8307eb (patch) | |
tree | 9950ff981e8ec23b2cc491455bcd2c67f418042a /src/loadlib.js | |
parent | 2211f8883ed4e2d8ac6ab20129b3d5954b2fd4fc (diff) | |
download | fengari-c2c95f23d0a9adeb6a7c473461e74cfbbf8307eb.tar.gz fengari-c2c95f23d0a9adeb6a7c473461e74cfbbf8307eb.tar.bz2 fengari-c2c95f23d0a9adeb6a7c473461e74cfbbf8307eb.zip |
Web require searcher
Diffstat (limited to 'src/loadlib.js')
-rw-r--r-- | src/loadlib.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/loadlib.js b/src/loadlib.js index dfa082a..7458704 100644 --- a/src/loadlib.js +++ b/src/loadlib.js @@ -95,6 +95,17 @@ if (!WEB) { return true; }; +} else { + /* TODO: use async/await ? */ + 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.send(); + /* TODO: subresource integrity check? */ + + return xhr.status >= 200 && xhr.status <= 299; + }; } |