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

This commit is contained in:
Michael Jumper
2013-09-27 20:21:44 -07:00
parent 8481254273
commit 3c5c7fccf7
2 changed files with 56 additions and 4 deletions

View File

@@ -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);