aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-03-15 14:07:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-03-15 14:07:04 -0700
commitbe1631232551386af02b424eb40d236215696e4a (patch)
treecd61496f94065e20f9ae92f5850a54f458bc6ffa /src/library.js
parent38b121aff6b48f724023d837fd164836c3f7fb69 (diff)
add file preloading in browsers
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/library.js b/src/library.js
index 7cda8bbb..8f4e5799 100644
--- a/src/library.js
+++ b/src/library.js
@@ -255,23 +255,7 @@ LibraryManager.library = {
var success = true;
if (typeof XMLHttpRequest !== 'undefined') {
// Browser.
- // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available.
- var xhr = new XMLHttpRequest();
- xhr.open('GET', obj.url, false);
-
- // Some hints to the browser that we want binary data.
- if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer';
- if (xhr.overrideMimeType) {
- xhr.overrideMimeType('text/plain; charset=x-user-defined');
- }
-
- xhr.send(null);
- if (xhr.status != 200 && xhr.status != 0) success = false;
- if (xhr.response !== undefined) {
- obj.contents = new Uint8Array(xhr.response || []);
- } else {
- obj.contents = intArrayFromString(xhr.responseText || '', true);
- }
+ assert('Cannot do synchronous binary XHRs in modern browsers. Use --embed-file or --preload-file in emcc');
} else if (typeof read !== 'undefined') {
// Command-line.
try {