Improve iframe load handling in Activity Stream to prevent null body errors

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Dashboard & Gadgets
    • None
    • 1

      Summary

      Make iframe loading checks in Activity Stream gadget more resilient (avoid JS error when body is not yet available).

      Environment

      • Jira Data Center 9.12.26
      • Browser: Firefox (latest at the time of testing)
      • Extension: NoScript enabled

      Current Behavior

      When the Activity Stream gadget loads in Firefox with the NoScript extension enabled (even with the Jira domain fully whitelisted), the following error appears in the console:

      Uncaught TypeError: can't access property "hasChildNodes", iframe.contentDocument.querySelector("body") is null

      The gadget fails to load until a layout event is triggered (e.g., resizing the browser window).

      Expected Behavior

      The gadget should degrade gracefully and not throw errors if the iframe’s <body> is not yet available.
      For example, checking for the existence of the body element before accessing it, or attaching a listener to the iframe loadevent.

      Impact

      • Users running security extensions such as NoScript encounter broken Activity Stream gadgets even if the Jira domain is fully whitelisted.
      • While this is an edge case, making the check more robust would also reduce the chance of timing issues in other scenarios (e.g., lazy loading, slower browsers, or unusual network conditions).

      Suggested Fix

      Update the iframe handling logic in the Activity Stream to:

      • Verify that iframe.contentDocument.querySelector("body") is not null before accessing .hasChildNodes().
      • Optionally wait for the iframe’s load event before running DOM checks.

            Assignee:
            Unassigned
            Reporter:
            Vasti Marucci
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: