Another attempt to restore window from a weak reference to either a frame
or a window, in hope to make it work in FF10 (newer versions are ok)