use `window.onbeforeunload=` for nav-away warning

Firefox 22 broke `$(window).on("beforeunload")` somehow, for some reason,
resulting in always showing a dialog, regardless of the function's return value.

The only fix I could find was resorting to the basic low-level API.
Merge pull request #3510 from minrk/ffisbroken

use `window.onbeforeunload=` for nav-away warning

Firefox 22 broke `$(window).on("beforeunload")` somehow, for some reason, resulting in always showing a dialog, regardless of the function's return value.

closes #3509

The only fix I could find was resorting to the basic low-level API.
Get Tracer working after ipapi.get replaced with get_ipython

Commit 790f731 replaced `ipapi.get` with a `get_ipython` function,
that changed the API slightly, returning None when no InteractiveShell
instance has been registered.
Merge pull request #3511 from punchagan/fix-tracer

Get Tracer working when no IPython instance is running