Fix dirty handling and crashes with the comment dialog.

Review Request #2483 — Created July 17, 2011 and submitted

chipx86
Review Board
reviewboard
Fix dirty handling and crashes with the comment dialog.

Pressing control-enter to save a comment dialog would result in setting
the dialog as dirty. This happened because keyup would get the request
mid-flight while saving the comment, and would reset the flag back to dirty.

The process of updating the dirty flag would also trigger a window resize,
but the elements were going away (in the process of animating to invisible).
This could cause a JavaScript error. This seems to be local to Chrome.

Both of these issues would result in a "Are you sure you want to leave the
page?" if you pressed control-enter. In the first case, we'd be dirty.
In the second, we'd crash and had no chance of resetting back to 0 anyway.
Of course, in the second case, whole new problems could be hit.

The solution is to just specify that we're ignoring the key up event. This
is set/cleared on every key press, and we use it to determine if we're
going to ignore the keyup event.

We also don't trigger a resize if invisible.
Pressed control-enter on Chrome, with the JavaScript debug console open and
some debug output added. The edit count reset back to 0 (and reloading the
page didn't trigger a dialog), and it no longer caused JavaScript errors.
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Committed to master (f704b41)
Loading...