Closed Bug 1741058 Opened 3 years ago Closed 6 months ago

iframe content disappears right after it is displayed

Categories

(Core :: DOM: Navigation, defect, P2)

Firefox 82
Desktop
All
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox-esr91 --- fix-optional
firefox94 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- fix-optional

People

(Reporter: alice0775, Unassigned)

References

(Depends on 1 open bug, Regression, )

Details

(Keywords: nightly-community, parity-chrome, regression)

Attachments

(1 file)

Steps to reproduce:

  1. https://code-kitchen.dev/html/button/
  2. optional , reload (F5)

Actual results:
The iframe content disappears right after it is displayed.

Expected results:
The iframe content should not disappear.
Chrome works as expected.

Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=26510fca112eff4a2f8a714f4c2a6079103fc6a7&tochange=e763b6e09a4914247ab86b3600acac8562e6c1d1

Has Regression Range: --- → yes
Has STR: --- → yes

Initial observation - I can't reproduce this on mac for Firefox 96.0a1 (2021-11-15) with or without fission. I should check if this can be reproduced on linux.

needinfo'ing kmag because he said he would investigate.

Flags: needinfo?(kmaglione+bmo)

I can also reproduce the issue in Nightly96.0a1(20211115215316) Ubuntu20.04.

OS: Windows 10 → All
Severity: -- → S2
Priority: -- → P2

This doesn't reproduce for me on the current nightly on OSX unless I have the devtools open, and even then only intermittently. That implies there's a timing/race issue here, which superficially sounds a lot like bug 1736570.. And digging in deeper, it does seem to be triggered the same way as bug 1736570:

  1. The iframe is in the source markup to begin with: <iframe class="browser__content iframe-tag" data-v-5cf017ac></iframe>
  2. As one of the page's JS component mounts, they set the still-empty iframe's innerHTML:
      mounted: function () {
        var html = this.$el.querySelector('#slot-html code').innerText,
        style = '';
        this.$slots.css && (style = this.getStyleTag());
        var iframe = this.$el.querySelector('.iframe-tag'),
        t = iframe.contentDocument || iframe.contentWindow.document;
        t.getElementsByTagName('body') [0].innerHTML = this.unescapeHtml('<div id="main-content">'.concat(html, '</div>').concat(style).concat('<style>img { max-width: 100%; } body { font-family: UI Gothic, Meiryo, sans-serif; }</style>')),
        this.height ? iframe.style.height = ''.concat(this.height, 'px') : setTimeout((function () {
          var e = t.getElementById('main-content').clientHeight;
          iframe.style.height = ''.concat(e + 50, 'px')
        }), 1000)
      },
  1. Somehow the document for that iframe becomes blank after this point (it has no body innerHTML).

Even when I add a breakpoint on the line immediately after the one which sets the frame's innerHTML, the problem still intermittently reproduces, so it seems like the page itself isn't triggering this behavior.

Indeed, if I log the value of the iframe's document's readyState (t.readyState in that function above), it's uninitialized when the iframe is broken, and complete when it is not. Also, when I similarly log the value of t, both it and its body element are no longer attached by the time I inspect them, when the iframe is broken (otherwise the devtools take me to the expected point in the inspector when it's working).

So it seems that this is the same issue we're seeing in bug 1736570.

I can still reproduce the problem in Nightly98.0a1(20220202093701) Ubuntu20.04.
And I confirmed that the try build of Bug 1736570 Comment#76 solved this problem too.

Now that bug 1736570 was landed, I cannot reproduce this problem.
Would you please help verify? Thank you!

Flags: needinfo?(kmaglione+bmo) → needinfo?(alice0775)

(In reply to Hsin-Yi Tsai [:hsinyi] from comment #7)

Now that bug 1736570 was landed, I cannot reproduce this problem.
Would you please help verify? Thank you!

Oh, NO ... it's getting harder to reproduce. But if I reload the page more times, I still encounter this issue.

Flags: needinfo?(alice0775)

And I found a more reliable STR for the latest Nightly 99.0a1.

STR:

  1. Open https://code-kitchen.dev/html/button/ in first tab
  2. Open new tab
  3. Close the first tab
  4. Reopen closed tab

Actual results:
The iframe content disappears right after it is displayed.

Hmm, "Reopen closed tab" smells like session (re)store.

FYI, On the good build(i.e, before Bug 1589102), it works as expected with STR of comment#9.

It seems to be much easier for me to reproduce, if I open https://code-kitchen.dev/html/button/ in the first tab. (How would the position of the tab matters? Is it just a coincidence?) Then press F5 to reload. Repeat pressing F5 several times (about 5 times). The issue is reproduced.

Flags: needinfo?(hsivonen)

Changing the severity to S3 as the situation has been mitigated after bug 1736570. Please let me know if you see this differently.

Severity: S2 → S3

Clear some old NI requested by me.

Flags: needinfo?(hsivonen)

WFM on 115esr as well as 121.0a1.

Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: