From: Darren Date: Wed, 22 Oct 2014 19:19:52 +0000 (+0100) Subject: document unload promise resolving correctly with promise shim X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=89ae7bbf8158aed4687da6eaed767e9292ba0ee6;p=KiwiIRC.git document unload promise resolving correctly with promise shim --- diff --git a/client/src/index.html.tmpl b/client/src/index.html.tmpl index 71c1d00..a47084c 100644 --- a/client/src/index.html.tmpl +++ b/client/src/index.html.tmpl @@ -471,6 +471,12 @@ } onload_promise = new Promise(function (resolve) { + // Document may already be loaded if we had to load the Promise shim seperately + if (document.readyState === 'complete') { + resolve(); + return; + } + window.onload = resolve; });