third: Remove FormData polyfill.

It has no effect in our supported browsers including IE11.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-07-01 16:49:27 -07:00 committed by Tim Abbott
parent 438c7c46ed
commit d8ed1d4553
3 changed files with 0 additions and 43 deletions

View File

@ -112,11 +112,6 @@ Files: static/generated/emoji/images/emoji/unicode/* tools/setup/emoji/*.ttf
Copyright: Google, Inc.
License: Apache-2.0
Files: static/third/html5-formdata/formdata.js
Copyright: 2010 François de Metz
License: Expat
Comment: See https://github.com/francois2metz/html5-formdata
Files: src/zulip/static/third/jquery/*
Copyright: 2011, John Resig
2011, The Dojo Foundation

View File

@ -2,7 +2,6 @@ import "js/bundles/commons.js";
// Import Third party libraries
import "third/bootstrap-notify/js/bootstrap-notify.js";
import "third/html5-formdata/formdata.js";
import "third/jquery-filedrop/jquery.filedrop.js";
import "jquery-caret-plugin/src/jquery.caret.js";
import "third/jquery-idle/jquery.idle.js";

View File

@ -1,37 +0,0 @@
/**
* Emulate FormData for some browsers
* MIT License
* (c) 2010 François de Metz
*/
(function(w) {
if (w.FormData)
return;
function FormData() {
this.fake = true;
this.boundary = "--------FormData" + Math.random();
this._fields = [];
}
FormData.prototype.append = function(key, value) {
this._fields.push([key, value]);
}
FormData.prototype.toString = function() {
var boundary = this.boundary;
var body = "";
this._fields.forEach(function(field) {
body += "--" + boundary + "\r\n";
// file upload
if (field[1].name) {
var file = field[1];
body += "Content-Disposition: form-data; name=\""+ field[0] +"\"; filename=\""+ file.name +"\"\r\n";
body += "Content-Type: "+ file.type +"\r\n\r\n";
body += file.getAsBinary() + "\r\n";
} else {
body += "Content-Disposition: form-data; name=\""+ field[0] +"\";\r\n\r\n";
body += field[1] + "\r\n";
}
});
body += "--" + boundary +"--";
return body;
}
w.FormData = FormData;
})(window);