From: Kohei Yoshino Date: Wed, 9 Oct 2019 13:28:07 +0000 (-0400) Subject: Bug 1587133 - Crash panel sizing incorrect when first opened X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e386c62828dd90e3bd3ccf2388ccbe340b012ce;p=thirdparty%2Fbugzilla.git Bug 1587133 - Crash panel sizing incorrect when first opened --- diff --git a/extensions/BMO/web/js/firefox-crash-table.js b/extensions/BMO/web/js/firefox-crash-table.js index 23e94250f..1f547cfe1 100644 --- a/extensions/BMO/web/js/firefox-crash-table.js +++ b/extensions/BMO/web/js/firefox-crash-table.js @@ -247,7 +247,6 @@ window.addEventListener('DOMContentLoaded', () => { addUpdateSFButton(statusFlagsSelects); } }); - iframe.setAttribute("src", crashStopLink); iframe.setAttribute("id", "crash-stop-iframe"); iframe.setAttribute("tabindex", "0"); iframe.setAttribute("style", "display:block;width:100%;height:100%;margin-top:8px;border:0px;"); @@ -259,6 +258,23 @@ window.addEventListener('DOMContentLoaded', () => { spinner.setAttribute("tabindex", "0"); spinner.setAttribute("style", "padding-right:5px;cursor:pointer;"); + const load_iframe = () => iframe.src = crashStopLink; + + // Load the iframe once it becomes visible in the viewport, otherwise the height passed by + // *hidden* iframe through `postMessage()` will be 25px, hiding most of the content + if ('IntersectionObserver' in window) { + const observer = new IntersectionObserver(entries => entries.forEach(entry => { + if (entry.intersectionRatio > 0) { + observer.unobserve(iframe); + load_iframe(); + } + }), { root: document.querySelector('#bugzilla-body') }); + + observer.observe(iframe); + } else { + load_iframe(); + } + function hide() { spinner.innerText = "▸"; spinner.setAttribute("aria-expanded", "false");