Closed Bug 2022491 Opened 11 days ago Closed 2 days ago

[Nightly] Facebook on mobile hangs when clicking comments

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
150 Branch
Webcompat Priority P2
Webcompat Score 7
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox148 --- unaffected
firefox149 --- unaffected
firefox150 + fixed

People

(Reporter: smaug, Assigned: emilio)

References

(Regression, )

Details

(Keywords: regression, webcompat:needs-diagnosis, webcompat:site-report, Whiteboard: [webcompat:sightline][webcompat:japan][webcompat:core], [wptsync upstream])

User Story

platform:android
impact:workflow-broken
configuration:common
affects:all
branch:release
diagnosis-team:layout
user-impact-score:600

Attachments

(2 files)

Load Facebook on Android/Nightly, scroll to something which has comments, click the comment icon. Hang.

https://share.firefox.dev/4s7RBvp

Looks like most of the time happens in CSS parsing? Let's assign this to the layout team.

Severity: -- → S3
User Story: (updated)
Webcompat Priority: --- → P2
Webcompat Score: --- → 7
Priority: -- → P2
Whiteboard: [webcompat:sightline][webcompat:japan][webcompat:core]

I can reproduce in Nightly on my main Android device, as well as on desktop Nightly in responsive design mode with "Galaxy S10/S10+" device profile.

This also appears to be a regression (Nightly 2026-01-17 is "good", for example). I'll bisect.

The profile in comment 0 doesn't seem to be symbolicated -- so here's a new performance-profile with symbols & screenshots:
https://share.firefox.dev/4rzC3PO

This captures ~90 seconds of a hang; the hang appeared to continue indefinitely, though.

Emilio: given that bug 2020681 seems to have just been a "cleanup" patch with presumably no intended behavior-change, and it had this severe consequence, and Nightly 150 moves to beta in 1 week -- maybe safest to backout bug 2020681 for now to fix this issue, and investigate/address this hang as part of re-landing that bug?

Flags: needinfo?(emilio)

This is the function that's hanging:

function csb(a, b) {
  var c,
  d,
  e,
  f,
  g,
  h;
  a.getBoundingClientRect();
  e = a.style.height;
  d = a.offsetHeight;
  h = a.scrollHeight;
  f = a.style.overflow;
  if (d >= h) {
    g = a.style[hJe];
    a.style[hJe] = '';
    a.style.height = d + b + REe;
    a.style.overflow = BCe;
    if (h < a.scrollHeight) {
      while (a.offsetHeight >= a.scrollHeight) {
        a.style.height = (d -= b) + REe
      }
      while (a.offsetHeight < a.scrollHeight) {
        a.style.height = d++ + REe
      }
      a.style.height = e;
      a.style.overflow = f;
      a.style[hJe] = g;
      return d
    } else {
      A4b();
      c = (YQb(), YDd(nRb((hwd(true, lBe), XQb), mBe), 0));
      if (B4b(L4b(c), {
        l: ZAe,
        m: 361152,
        h: 262145
      }, false, (eCc(), dCc))) {
        a.style.height = e;
        a.style.overflow = f;
        a.style[hJe] = g
      }
    }
  }
  return h
}

I think my patch makes editor initialization not eager for <textarea> which probably changes layout subtly. In this function, a is a textarea, b is 22, hJe is padding, BCe is hidden, REe, h is 32 but a.scrollHeight and a.offsetHeight is 10 during the loop.

The textarea has the following styles:

style attribute {
  --font-size: 16px;
  font-size: 16px;
  color: rgb(0, 0, 0);
  --placeholder-color: #65686c;
  line-height: 22px;
  height: 10px;
  overflow: hidden;
}
.ssr .mentions-text textarea.native-input {
  z-index: 3;
  text-align: start;
  word-spacing: 0;
  text-indent: 0;
  letter-spacing: normal;
  -webkit-line-break: after-white-space;
  -webkit-user-select: text;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ssr textarea.native-input {
  resize: none;
  direction: inherit;
}
.ssr .input-box {
  border: none;
  background-color: transparent;
  width: 100%;
  height: 100%;
  pointer-events: auto !important;
  box-sizing: border-box;
}
html.unselectable input, html.unselectable textarea {
  -webkit-user-select: text;
}
html.unselectable * {
  -webkit-user-select: none;
}
.native-input {
  position: absolute;
  border: .5px solid lightgray;
  font-family: Roboto,sans-serif !important;
  padding: 0 6px;
  pointer-events: initial;
  box-sizing: border-box;
}
Attached file Test-case

Since we initialize the editor lazily now the <br> isn't there until editor initializes, and Facebook gets confused because scrollHeight collapses to 0 effectively.

Editor initialization already copes with it.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(emilio)
Keywords: regression
Regressed by: 2020681
Component: Site Reports → DOM: Core & HTML
Product: Web Compatibility → Core
OS: Android → All
Hardware: Unspecified → All
Whiteboard: [webcompat:sightline][webcompat:japan][webcompat:core] → [webcompat:sightline][webcompat:japan][webcompat:core], [wptsync upstream error]
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/58642 for changes under testing/web-platform/tests
Whiteboard: [webcompat:sightline][webcompat:japan][webcompat:core], [wptsync upstream error] → [webcompat:sightline][webcompat:japan][webcompat:core], [wptsync upstream]

The bug is marked as tracked for firefox150 (nightly). However, the bug still has low severity.

:hsinyi, could you please increase the severity for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(htsai)
Status: ASSIGNED → RESOLVED
Closed: 2 days ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
Upstream PR merged by moz-wptsync-bot

FWIW, seems to be working now. Thanks for fixing :)

Flags: needinfo?(htsai)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: