mozilla/pdf.js — pull request #4607 by Rob--W (2014-04-11 21:29:52+00:00)
Title: Remove a bunch of unused local variables from web/ and src/

After temporarily adding `"unused": "vars"` to `.jshintrc`, I discovered many unused local variables.
I've identified some obviously redundant variables, and removed these in the first two commits. To see that this is correct, just look through the changes (and see that the variable declarations had no side effects) and run `node make lint` to see that no used variable was removed.

I've also spotted three unused global variables in `src/core/fonts.js`, so I've removed these as well. (third commit). I was not 100% sure about their purpose, so if they should indeed be removed, then I will squash it with the second commit.

Finally, I have added two TODOs in a temporary (4th) commit.

- In `src/core/bidi.js`, there is a local function that is unused. Should it be removed, or should it be kept, so that its logic in the future?
- In `src/shared/fonts_utils.js`, an index is incremented, used to access an array element and stored in a local variable. But this variable is never used. If it's an oversight, then it needs to be fixed. If the variable is redundant, then I suggest to replace it with `++i;`, and add a comment explaining why the index is skipped if needed.

---

To prevent such dead code from appearing again, adding [`"unused": "vars"`](http://www.jshint.com/docs/options/#unused) to `.jshintrc` and fixing *all* unused variables could be useful. Global variables that are not used within the file, but by other files can be marked as used via the `/* exported varname1, varname2 */` directive.
What do you think?