lookChar refactoring
Download PDF from cache for non-Firefox add-on

This feature relies on URL.createObjectURL, which is supported by
- Firefox 4
- Chrome 8
- Opera 15
- Internet Explorer 10

If the feature is missing, it falls back to downloading from the server.

The environment-specific code are put in ifdef's. Two methods are
defined:
- noData
  This function is used as a fallback in case of failure, it triggers
  a download directly from the server.
- triggerSaveAs(String url, optional String blob)
  This function attempts to show a Save As dialog for a given URL.
  It attempts to use the a.download attribute, if available, and
  falls back to window.open(<url>, '_parent') if unavailable.

See also http://caniuse.com/download
Put URL = URL || webkitURL in compatibility.js

Declares the URL variable globally. If the feature is not
supported, the variable will still be declared, but have the
"undefined" value.

Supported by:

- Firefox 4
  Firefox 21 in Web worker

- Chrome 8  (prefixed as webkitURL), 23+ unprefixed
  Chrome 10 (prefixed as webkitURL) in Web Worker, 23+ unprefixed

- Opera 15
  Opera 15 in Web Worker

- Internet Explorer 10
  Internet Explorer 11 in Web Worker

- Safari 6 (prefixed as webkitURL)
  Safari 6 (prefixed as webkitURL) in Web Worker
Limit image size to 1024*1024 for b2g.
Improve suggested filename on download

For all of the following URLs, "file.pdf" will be suggested:
http://.../file.pdf
http://.../download.aspx?file=file.pdf&whatever
http://.../get.pdf?name=file.pdf&whatever
http://.../single-page-app#view=file.pdf
http://.../download.aspx?file=%2Fpath%2Fto%2Ffile.pdf&whatever

Fixes #3161
Download PDF from cache for IE10 / IE11

IE9 falls back to downloading from the original URL.
Merge pull request #3437 from Rob--W/download-from-cache

Download PDF from cache for non-Firefox add-on
Always declare window.URL even if undefined

Otherwise it breaks feature detection,
"ReferenceError: Can't find variabl: URL" in Safari 5.1
Merge pull request #3459 from Rob--W/define-URL

Always declare window.URL even if undefined
Merge pull request #3424 from yurydelendik/lookChar

lookChar refactoring
Merge pull request #3456 from brendandahl/cap-image-size

Limit image size to 1024*1024 for b2g.