From 824917c2aac39c6ad43bd674ae25d4b262705871 Mon Sep 17 00:00:00 2001 From: Bogdan-Hasanov <47710368+Bogdan-Hasanov@users.noreply.github.com> Date: Wed, 2 Mar 2022 21:27:53 +0200 Subject: [PATCH] fix(oauth2): addEventListener only if document state is not 'loading' (#7828) Co-authored-by: Tim Lai --- dev-helpers/oauth2-redirect.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev-helpers/oauth2-redirect.html b/dev-helpers/oauth2-redirect.html index 72fbf81b..0f4d4953 100644 --- a/dev-helpers/oauth2-redirect.html +++ b/dev-helpers/oauth2-redirect.html @@ -66,7 +66,11 @@ window.close(); } - window.addEventListener('DOMContentLoaded', function () { + if( document.readyState !== 'loading' ) { run(); - }); + } else { + document.addEventListener('DOMContentLoaded', function () { + run(); + }); + }