kiwix-js
kiwix-js copied to clipboard
Rework the code on startup to prevent some alert/confirm popups overlaping
In app.js, there is some code that is always run on startup. Some of these steps might trigger an alert/confirm:
- restore parameters from settingsStore
- apply parameters from queryString
- apply theme
- set home key behavior
- set content injection mode
- define behavior of HTML elements (event listeners)
- handle and test DeviceStorage (this is Firefox OS specific)
- else (if not on Firefox OS), see if there is a selected file (it can only happen on Firefox). If yes, open this archive. Else go to configuration section
- load blank article in the iframe
- resize iFrame
There are at least steps 5, 7 and 8 that can trigger an alert/confirm. So the problem might occur here. To avoid this, we might move some of these synchronous steps to new functions, that would be called asynchronously, after the user closes the modal window.