Try harder to dumpWindowHierarchy

Improve #2519