Chrome onbeforeunload bug

Steps to reproduce

  1. Click the button a couple of times, notice the log being filled.
  2. Reload the page or try to close the window or tab.
  3. Choose to "Stay on this page".
  4. Click the button again, notice the log is no longer being filled.


    
    

The bug is fixed (as far as I can tell) if the internal jQuery function now() is modified like so:

// original: 
function now() {
    return (new Date).getTime();
}
    
// modified: 
function now() {
    return (new Date).valueOf();
}