Steps to Reproduce
Run an embedded ZK app
Run the zEmbedded.destroy(containerId) command at client-side to destroy the ZK app
Current Result
zk.Desktop.all[dtid] still exists.
If an external script cause a global invocation of window listeners such as bookmark change or popHistoryState, since there is no valid desktop as target of the global invocation, the zAu.send function will loop over the Desktops in zk.Desktop.all and fire events to each, which include the currently removed desktop.
Expected Result
Destroyed desktops cannot receive events
Debug Information
https://github.com/zkoss/zk/blob/master/zk/src/archive/web/js/zk/au.ts#L460
Workaround
remove the desktop from zk.Desktop.all manually upon calling zEmbedded.destroy()