Improved crbug.com/375297 workaround

This commit is contained in:
Eli Grey
2014-07-25 20:48:15 -04:00
parent d9a5ac1d93
commit 1e7251f2d4
+8 -3
View File
@@ -1,6 +1,6 @@
/* FileSaver.js /* FileSaver.js
* A saveAs() FileSaver implementation. * A saveAs() FileSaver implementation.
* 2014-07-21 * 2014-07-25
* *
* By Eli Grey, http://eligrey.com * By Eli Grey, http://eligrey.com
* License: X11/MIT * License: X11/MIT
@@ -53,13 +53,18 @@ var saveAs = saveAs
// the reasoning behind the timeout and revocation flow // the reasoning behind the timeout and revocation flow
, arbitrary_revoke_timeout = 10 , arbitrary_revoke_timeout = 10
, revoke = function(file) { , revoke = function(file) {
setTimeout(function() { var revoker = function() {
if (typeof file === "string") { // file is an object URL if (typeof file === "string") { // file is an object URL
get_URL().revokeObjectURL(file); get_URL().revokeObjectURL(file);
} else { // file is a File } else { // file is a File
file.remove(); file.remove();
} }
}, arbitrary_revoke_timeout); };
if (view.chrome) {
revoker();
} else {
setTimeout(revoker, arbitrary_revoke_timeout);
}
} }
, dispatch = function(filesaver, event_types, event) { , dispatch = function(filesaver, event_types, event) {
event_types = [].concat(event_types); event_types = [].concat(event_types);