fix no-use-before-define lint warnings
Merge pull request #1161 from emkay/no-use-before-define-lint

fix no-use-before-define lint warnings
use self everywhere in request.js
use self in the cookies.js
change some variable names for clarity