Fix stale observation crash in LazyLoadMediaObserver on media element removal [chromium/src : main]

0 views
Skip to first unread message

Iris Zhou (Gerrit)

unread,
May 6, 2026, 12:23:31 PM (6 days ago) May 6
to Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
Attention needed from Piet Schouten

Iris Zhou added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Iris Zhou . resolved

Hey PH, mind taking a look at this when you have the chance, before I add upstream reviewers?

Open in Gerrit

Related details

Attention is currently required from:
  • Piet Schouten
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
Gerrit-Change-Number: 7819221
Gerrit-PatchSet: 1
Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
Gerrit-Comment-Date: Wed, 06 May 2026 16:23:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Piet Schouten (Gerrit)

unread,
May 7, 2026, 8:19:48 PM (5 days ago) May 7
to Iris Zhou, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
Attention needed from Iris Zhou

Piet Schouten added 3 comments

File third_party/blink/renderer/core/html/media/html_media_element.cc
Line 877, Patchset 1 (Latest): if (RuntimeEnabledFeatures::LazyLoadVideoAndAudioEnabled() &&
Piet Schouten . unresolved

nit: The `InsertedInto` method above checks `insertion_point.isConnected()` before the call to `StartMonitoring`. Even though `StartMonitoring` and `StopMonitoring` check for document validity with `GetRootDocumentOrNull`, should the conditional here mirror what `InsertedInto` does and also call `insertion_point.isConnected()`?

File third_party/blink/renderer/core/html/media/lazy_load_media_observer_test.cc
Line 643, Patchset 1 (Latest): EXPECT_GT(observer.GetObservationCountForTesting(), 0u);
Piet Schouten . unresolved
nit: since there should only be 1 observer (please correct me if I'm wrong), could this check be tightened to the following to catch any other related bugs?
```suggestion
EXPECT_EQ(observer.GetObservationCountForTesting(), 1u);
```
Line 654, Patchset 1 (Latest):}
Piet Schouten . unresolved

nit: You mentioned in the comment above that "If the element is re-inserted, InsertedInto() will restart monitoring.". Would it be beneficial to re-insert the element to make sure this statement is correct? Perhaps something like:


```suggestion
GetDocument().body()->AppendChild(video);
EXPECT_EQ(observer.GetObservationCountForTesting(), 1u);
}
```
Open in Gerrit

Related details

Attention is currently required from:
  • Iris Zhou
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
    Gerrit-Change-Number: 7819221
    Gerrit-PatchSet: 1
    Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
    Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
    Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
    Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
    Gerrit-Attention: Iris Zhou <irz...@microsoft.com>
    Gerrit-Comment-Date: Fri, 08 May 2026 00:19:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Iris Zhou (Gerrit)

    unread,
    May 8, 2026, 1:22:14 PM (4 days ago) May 8
    to Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
    Attention needed from Piet Schouten

    Iris Zhou added 3 comments

    File third_party/blink/renderer/core/html/media/html_media_element.cc
    Line 877, Patchset 1: if (RuntimeEnabledFeatures::LazyLoadVideoAndAudioEnabled() &&
    Piet Schouten . resolved

    nit: The `InsertedInto` method above checks `insertion_point.isConnected()` before the call to `StartMonitoring`. Even though `StartMonitoring` and `StopMonitoring` check for document validity with `GetRootDocumentOrNull`, should the conditional here mirror what `InsertedInto` does and also call `insertion_point.isConnected()`?

    Iris Zhou

    I took a look, seems like `isConnected()` could be either `true` (direct removal) or `false` (subtree removal, e.g. removing a `<div>` that contains the video). We want to stop monitoring here either way, so I don't think we want the check here.

    File third_party/blink/renderer/core/html/media/lazy_load_media_observer_test.cc
    Line 643, Patchset 1: EXPECT_GT(observer.GetObservationCountForTesting(), 0u);
    Piet Schouten . resolved
    nit: since there should only be 1 observer (please correct me if I'm wrong), could this check be tightened to the following to catch any other related bugs?
    ```suggestion
    EXPECT_EQ(observer.GetObservationCountForTesting(), 1u);
    ```
    Iris Zhou

    Done

    Line 654, Patchset 1:}
    Piet Schouten . resolved

    nit: You mentioned in the comment above that "If the element is re-inserted, InsertedInto() will restart monitoring.". Would it be beneficial to re-insert the element to make sure this statement is correct? Perhaps something like:


    ```suggestion
    GetDocument().body()->AppendChild(video);
    EXPECT_EQ(observer.GetObservationCountForTesting(), 1u);
    }
    ```
    Iris Zhou

    Done. Thanks, great for thoroughness!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Piet Schouten
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
      Gerrit-Change-Number: 7819221
      Gerrit-PatchSet: 2
      Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
      Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
      Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
      Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
      Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
      Gerrit-Comment-Date: Fri, 08 May 2026 17:22:04 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Piet Schouten <Piet.S...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Iris Zhou (Gerrit)

      unread,
      May 11, 2026, 12:12:31 PM (yesterday) May 11
      to Dale Curtis, Helmut Januschka, Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
      Attention needed from Dale Curtis, Helmut Januschka and Piet Schouten

      Iris Zhou added 1 comment

      Patchset-level comments
      File-level comment, Patchset 2 (Latest):
      Iris Zhou . resolved

      Hi Dale and Helmut, adding the two of you because you were on the original crbug for HTML video element lazy-loading. Please take a look when you have a chance, thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dale Curtis
      • Helmut Januschka
      • Piet Schouten
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
      Gerrit-Change-Number: 7819221
      Gerrit-PatchSet: 2
      Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
      Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
      Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
      Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
      Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
      Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
      Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
      Gerrit-Comment-Date: Mon, 11 May 2026 16:12:22 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dale Curtis (Gerrit)

      unread,
      May 11, 2026, 12:45:40 PM (yesterday) May 11
      to Iris Zhou, Helmut Januschka, Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
      Attention needed from Helmut Januschka, Iris Zhou and Piet Schouten

      Dale Curtis voted and added 1 comment

      Votes added by Dale Curtis

      Code-Review+1

      1 comment

      Patchset-level comments
      Iris Zhou . unresolved

      Hi Dale and Helmut, adding the two of you because you were on the original crbug for HTML video element lazy-loading. Please take a look when you have a chance, thanks!

      Dale Curtis

      Thanks! This looks right to me, but please let Helmut weigh in.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Helmut Januschka
      • Iris Zhou
      • Piet Schouten
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
      Gerrit-Change-Number: 7819221
      Gerrit-PatchSet: 2
      Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
      Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
      Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
      Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
      Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
      Gerrit-Attention: Iris Zhou <irz...@microsoft.com>
      Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
      Gerrit-Comment-Date: Mon, 11 May 2026 16:45:22 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Iris Zhou <irz...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Helmut Januschka (Gerrit)

      unread,
      May 11, 2026, 2:19:13 PM (yesterday) May 11
      to Iris Zhou, Helmut Januschka, Dale Curtis, Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
      Attention needed from Iris Zhou and Piet Schouten

      Helmut Januschka voted and added 2 comments

      Votes added by Helmut Januschka

      Code-Review+1

      2 comments

      Patchset-level comments
      Helmut Januschka . resolved

      awesome! looking good thanks for looping me in, and thanks for fixing the bug!

      File third_party/blink/renderer/core/html/media/html_media_element.cc
      Line 876, Patchset 2 (Latest): // InsertedInto() will restart monitoring.
      Helmut Januschka . unresolved

      optional nit: i'd remove this comment

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Iris Zhou
      • Piet Schouten
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
        Gerrit-Change-Number: 7819221
        Gerrit-PatchSet: 2
        Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
        Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
        Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
        Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
        Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
        Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
        Gerrit-Attention: Iris Zhou <irz...@microsoft.com>
        Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
        Gerrit-Comment-Date: Mon, 11 May 2026 18:18:54 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Iris Zhou (Gerrit)

        unread,
        May 11, 2026, 2:53:00 PM (yesterday) May 11
        to Helmut Januschka, Dale Curtis, Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
        Attention needed from Dale Curtis, Helmut Januschka and Piet Schouten

        Iris Zhou voted and added 1 comment

        Votes added by Iris Zhou

        Auto-Submit+1
        Commit-Queue+1

        1 comment

        File third_party/blink/renderer/core/html/media/html_media_element.cc
        Line 876, Patchset 2: // InsertedInto() will restart monitoring.
        Helmut Januschka . resolved

        optional nit: i'd remove this comment

        Iris Zhou

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Dale Curtis
        • Helmut Januschka
        • Piet Schouten
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
          Gerrit-Change-Number: 7819221
          Gerrit-PatchSet: 3
          Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
          Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
          Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
          Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
          Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
          Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Comment-Date: Mon, 11 May 2026 18:52:54 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Helmut Januschka <hel...@januschka.com>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Iris Zhou (Gerrit)

          unread,
          May 11, 2026, 2:54:35 PM (yesterday) May 11
          to Helmut Januschka, Dale Curtis, Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
          Attention needed from Dale Curtis, Helmut Januschka and Piet Schouten

          Iris Zhou added 1 comment

          Patchset-level comments

          Hi Dale and Helmut, adding the two of you because you were on the original crbug for HTML video element lazy-loading. Please take a look when you have a chance, thanks!

          Dale Curtis

          Thanks! This looks right to me, but please let Helmut weigh in.

          Iris Zhou

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Dale Curtis
          • Helmut Januschka
          • Piet Schouten
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
            Gerrit-Change-Number: 7819221
            Gerrit-PatchSet: 3
            Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
            Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
            Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
            Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
            Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
            Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
            Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
            Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
            Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
            Gerrit-Comment-Date: Mon, 11 May 2026 18:54:27 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Iris Zhou <irz...@microsoft.com>
            Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Dale Curtis (Gerrit)

            unread,
            May 11, 2026, 3:37:08 PM (yesterday) May 11
            to Iris Zhou, Helmut Januschka, Piet Schouten, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
            Attention needed from Helmut Januschka, Iris Zhou and Piet Schouten

            Dale Curtis voted Code-Review+1

            Code-Review+1
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Helmut Januschka
            • Iris Zhou
            • Piet Schouten
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
            Gerrit-Change-Number: 7819221
            Gerrit-PatchSet: 3
            Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
            Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
            Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
            Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
            Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
            Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
            Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
            Gerrit-Attention: Iris Zhou <irz...@microsoft.com>
            Gerrit-Attention: Piet Schouten <Piet.S...@microsoft.com>
            Gerrit-Comment-Date: Mon, 11 May 2026 19:36:56 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Piet Schouten (Gerrit)

            unread,
            May 11, 2026, 4:49:52 PM (yesterday) May 11
            to Iris Zhou, Dale Curtis, Helmut Januschka, Chromium LUCI CQ, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org
            Attention needed from Helmut Januschka and Iris Zhou

            Piet Schouten voted

            Code-Review+1
            Commit-Queue+2
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Helmut Januschka
            • Iris Zhou
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement satisfiedCode-Owners
              • requirement satisfiedCode-Review
              • requirement satisfiedReview-Enforcement
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
              Gerrit-Change-Number: 7819221
              Gerrit-PatchSet: 3
              Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
              Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
              Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
              Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
              Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
              Gerrit-CC: srirama chandra sekhar <srir...@samsung.com>
              Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
              Gerrit-Attention: Iris Zhou <irz...@microsoft.com>
              Gerrit-Comment-Date: Mon, 11 May 2026 20:49:46 +0000
              Gerrit-HasComments: No
              Gerrit-Has-Labels: Yes
              satisfied_requirement
              open
              diffy

              Chromium LUCI CQ (Gerrit)

              unread,
              May 11, 2026, 5:59:12 PM (yesterday) May 11
              to Iris Zhou, Piet Schouten, Dale Curtis, Helmut Januschka, chromium...@chromium.org, srirama chandra sekhar, blink-rev...@chromium.org, blink-...@chromium.org, eric.c...@apple.com, feature-me...@chromium.org

              Chromium LUCI CQ submitted the change

              Change information

              Commit message:
              Fix stale observation crash in LazyLoadMediaObserver on media element removal

              The LazyLoadVideoAndAudio feature (crbug.com/469111735) added media
              elements to LazyLoadMediaObserver but did not add cleanup in
              HTMLMediaElement::RemovedFrom. When a <video loading="lazy"> element
              is removed from the DOM, its IntersectionObservation remains in the
              observer. If garbage collection later collects the element while the
              observation is held alive by active_observations_, a subsequent call
              to LoadAllImagesAndBlockLoadEvent (e.g. via print preview) can
              dereference the null target, causing an ACCESS_VIOLATION crash.

              This crash is non-deterministic, depending on GC timing relative to
              intersection computation and notification delivery.

              This CL:
              - Calls LazyMediaHelper::StopMonitoring in
              HTMLMediaElement::RemovedFrom when the element is in the deferred
              lazy-load state, matching the cleanup that ImageLoader already does
              for images.
              - Adds a regression test verifying that the observation is cleaned up
              after removal.
              Bug: 510024516
              Co-authored-by: Copilot <22355621...@users.noreply.github.com>
              Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
              Auto-Submit: Iris Zhou <irz...@microsoft.com>
              Reviewed-by: Piet Schouten <Piet.S...@microsoft.com>
              Commit-Queue: Piet Schouten <Piet.S...@microsoft.com>
              Commit-Queue: Iris Zhou <irz...@microsoft.com>
              Reviewed-by: Dale Curtis <dalec...@chromium.org>
              Cr-Commit-Position: refs/heads/main@{#1628839}
              Files:
              • M third_party/blink/renderer/core/html/media/html_media_element.cc
              • M third_party/blink/renderer/core/html/media/lazy_load_media_observer.cc
              • M third_party/blink/renderer/core/html/media/lazy_load_media_observer.h
              • M third_party/blink/renderer/core/html/media/lazy_load_media_observer_test.cc
              Change size: M
              Delta: 4 files changed, 64 insertions(+), 0 deletions(-)
              Branch: refs/heads/main
              Submit Requirements:
              • requirement satisfiedCode-Review: +1 by Dale Curtis, +1 by Piet Schouten
              Open in Gerrit
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: merged
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: Idfe623d59e90351d21fc6515b869cf4c91445862
              Gerrit-Change-Number: 7819221
              Gerrit-PatchSet: 4
              Gerrit-Owner: Iris Zhou <irz...@microsoft.com>
              Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
              Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
              Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
              Gerrit-Reviewer: Iris Zhou <irz...@microsoft.com>
              Gerrit-Reviewer: Piet Schouten <Piet.S...@microsoft.com>
              open
              diffy
              satisfied_requirement
              Reply all
              Reply to author
              Forward
              0 new messages