/// <summary>Clears all code.</summary>
        public void ClearCode()
        {
            Engines         = null;
            FinishedParsing = false;

            // Clear any running intervals:
            UITimer.OnUnload(this);
        }
        public void OnApplicationQuit()
        {
            // Run OnBeforeUnload, if an event is still attached:
            if (UI.document != null)
            {
                // Run onbeforeunload (always trusted):
                UI.document.window.dispatchEvent(new BeforeUnloadEvent());
            }

            // Make sure all timers are halted:
            UITimer.OnUnload(null);
        }