aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library.js10
-rw-r--r--src/shell.js2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js
index b7abae24..594ba931 100644
--- a/src/library.js
+++ b/src/library.js
@@ -318,14 +318,18 @@ LibraryManager.library = {
xhr.send(null);
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
var datalength = Number(xhr.getResponseHeader("Content-length"));
- var header;
+ var header;
var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
+#if SMALL_CHUNKS
+ var chunkSize = 1024; // Chunk size in bytes
+#else
var chunkSize = 1024*1024; // Chunk size in bytes
- if (!hasByteServing) chunkSize = datalength;
+#endif
+ if (!hasByteServing) chunkSize = datalength;
// Function to get a range from the remote URL.
var doXHR = (function(from, to) {
- if (from >= to) throw new Error("invalid range or no bytes requested!");
+ if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!");
// TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
diff --git a/src/shell.js b/src/shell.js
index 065462e1..3fb6cdbb 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -66,7 +66,7 @@ if (ENVIRONMENT_IS_SHELL) {
}
}
-if (ENVIRONMENT_IS_WEB) {
+if (ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER) {
if (!Module['print']) {
Module['print'] = function(x) {
console.log(x);