Skip to content

Commit

Permalink
Added NOP to stop breakage on browsers that don't support FormData (a…
Browse files Browse the repository at this point in the history
…ndroid 2.x)
  • Loading branch information
beatgammit committed Jan 5, 2012
1 parent 6161ef6 commit a784c91
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/options.js
Expand Up @@ -8,7 +8,6 @@
, querystring = require('querystring')
, File = require('File')
, FileList = require('FileList')
, FormData = require('FormData')
, atob = require('atob')
, utils = require('./utils')
, location
Expand All @@ -18,6 +17,21 @@
, objectToLowerCase
;

/*
* Some browsers don't yet have support for FormData.
* This isn't a real fix, but it stops stuff from crashing.
*
* This should probably be replaced with a real FormData impl, but whatever.
*/
function FormData() {
}

try {
FormData = require('FormData');
} catch (e) {
console.warn('FormData does not exist; using a NOP instead');
}

// TODO get the "root" dir... somehow
try {
location = require('./location');
Expand Down

0 comments on commit a784c91

Please sign in to comment.