Update onerror for client. Add onerror for output stream. Handle abort instruction. Track streams by index.

This commit is contained in:
Michael Jumper committed 2013-10-16 16:38:08 -07:00
1 parent 8481254273
commit 3c5c7fccf7
2 files changed
+56 -4

No files matched your search

@@ -1104,12 +1104,21 @@ GuacUI.Client.attach = function(guac) {
// Open file for writing
var stream = GuacUI.Client.attachedClient.createFileStream(file.type, file.name);
var valid = true;
var bytes = new Uint8Array(reader.result);
var offset = 0;
// Invalidate stream on all errors
stream.onerror = function() {
valid = false;
};
// Create upload callback
function continueUpload() {
// Abort upload if stream is invalid
if (!valid) return false;
// Encode packet as base64
var slice = bytes.subarray(offset, offset+4096);
var base64 = _get_base64(slice);