]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1587133 - Crash panel sizing incorrect when first opened
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 9 Oct 2019 13:28:07 +0000 (09:28 -0400)
committerdklawren <dklawren@users.noreply.github.com>
Wed, 9 Oct 2019 13:28:07 +0000 (09:28 -0400)
extensions/BMO/web/js/firefox-crash-table.js

index 23e94250f2fa1da5ca42f2c95dc6d3e93686bd8a..1f547cfe10f05a39f3c1f3b566a0f3a37810014a 100644 (file)
@@ -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");