Fix two bugs with spurious dirtyFlagChange events:
- Document ctor always fires it, even though isDirty stays false whole time
- Calling refreshText() always fires a pair of isDirty->true,->false
  (causing bug #502)

Add unit tests for various cases around Document dirty/undo state
Merge branch 'master' into pflynn/spurious-dirtyflag
reuse test window in Document-test
add check for dangling documents
disable unit test
Merge pull request #5112 from adobe/randy/issue-5093-temp

Disable unit test for #5093
Merge pull request #4994 from adobe/pflynn/spurious-dirtyflag

Fix bugs with spurious dirtyFlagChange events