eligrey/FileSaver.js — pull request #50 by minj (2013-10-20 21:33:29+00:00)
Title: Including FileSaver.js as a content script in Firefox for Android add-ons

First off all, thanks for the lib, we use it in a cross-browser add-on we maintain.
Supporting FF mobile is a pain but I got the time to debug issues with FileSaver.js

For starters, only `this` appears to be defined in that context and accessing any other object (like `self`, `navigator`) produces an exception. Consequently, Blob.js needs to be adapted accordingly.

Secondly, garbage collection is a pain here. Every DOM object seems to be recycled. This means references to `document` or `save_link` cannot be stored and relied upon. It enforced us to rewrite all the legacy code relying on XML to use JSON instead.

Last remark considers usage: you need to prefix `Blob` with `window.` in the actual event listeners.

I've added some comments in relevant places, I trust you'll figure out the best way to fix the situation, if at all.