Only clean plugin frames if !InStyleRecalc() [chromium/src : master]

2 views
Skip to first unread message

Ehsan Karamad (Gerrit)

unread,
May 25, 2018, 5:23:14 PM5/25/18
to blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

Hello Daniel. I wasn't expecting a bug on plugin so fast :). This fixes the bugs (or at least the clusterfuzz examples won't crash anymore).

View Change

    To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
    Gerrit-Change-Number: 1073204
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
    Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
    Gerrit-Comment-Date: Fri, 25 May 2018 21:23:10 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Ehsan Karamad (Gerrit)

    unread,
    May 25, 2018, 5:23:16 PM5/25/18
    to Daniel Cheng, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

    Ehsan Karamad would like Daniel Cheng to review this change.

    View Change

    Only clean plugin frames if !InStyleRecalc()

    CL 996314 introduced a new change in behavior of plugin elements and
    that is unless in fallback() mode (questionably buggy condition), the
    content frame is always cleaned up during DetachLayoutTree. This is fine
    and desired given that plugins are design around layout and not removing
    the content frame led to various bugs (as explained in more detail in CL
    996314).

    The new behavior has a small caveat and that is we might end up calling
    DetachLayoutTree unexpectedly, i.e., during style recalc. This CL avoid
    such problems by trying to detach the content frame both in the call to
    DetachLayoutTree and in UpdatePlugin calls. Any remote frame will be
    detached in the former call but LocalFrames might not, but will be in
    the latter call which is post style recalc.

    Bug: 846703, 846708
    Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
    ---
    A third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-embed-element/embed-style-change-no-crash.html
    M third_party/blink/renderer/core/html/html_plugin_element.cc
    M third_party/blink/renderer/core/html/html_plugin_element.h
    3 files changed, 81 insertions(+), 14 deletions(-)


    To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: master
    Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
    Gerrit-Change-Number: 1073204
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
    Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
    Gerrit-MessageType: newchange

    Blink WPT Bot (Gerrit)

    unread,
    May 25, 2018, 5:26:24 PM5/25/18
    to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

    Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/w3c/web-platform-tests/pull/11172.

    If this CL lands and Travis CI upstream is green, we will auto-merge the PR.

    Note: Please check the Travis CI status (at the bottom of the PR) before landing this CL and only land this CL if the status is green. Otherwise a human needs to step in and resolve it manually. (This may be automated in the future, see https://crbug.com/711447)

    WPT Export docs:
    https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md#Automatic-export-process

    View Change

      To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: master
      Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
      Gerrit-Change-Number: 1073204
      Gerrit-PatchSet: 1
      Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
      Gerrit-CC: Commit Bot <commi...@chromium.org>
      Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
      Gerrit-Comment-Date: Fri, 25 May 2018 21:26:22 +0000

      Daniel Cheng (Gerrit)

      unread,
      May 25, 2018, 6:09:51 PM5/25/18
      to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

      I think it might be nice to use DisposePluginSoon() for this. That means it'd be misnamed... but that's probably OK.

      The basic idea is this:
      1. We just use SetEmbeddedContentView() as we did before.
      2. In html_frame_owner_element.cc, we add a helper called DisposeContentView().
      3. In there, if the content view is a FrameView, we dispose it by calling Detach().
      4. Otherwise, we DCHECK IsPluginView and call Dispose.
      5. If in a suspend scope, we push it into the set.
      6. Otherwise, call DisposeContentView(view).

      The set processing will change to using DisposeContentView() instead of Dispose().

      View Change

      1 comment:

      To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: master
      Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
      Gerrit-Change-Number: 1073204
      Gerrit-PatchSet: 1
      Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
      Gerrit-CC: Commit Bot <commi...@chromium.org>
      Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
      Gerrit-Comment-Date: Fri, 25 May 2018 22:09:49 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Gerrit-MessageType: comment

      Ehsan Karamad (Gerrit)

      unread,
      May 28, 2018, 4:46:19 AM5/28/18
      to blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Daniel Cheng, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

      Patch Set 1:

      (1 comment)

      I think it might be nice to use DisposePluginSoon() for this. That means it'd be misnamed... but that's probably OK.

      The basic idea is this:
      1. We just use SetEmbeddedContentView() as we did before.
      2. In html_frame_owner_element.cc, we add a helper called DisposeContentView().
      3. In there, if the content view is a FrameView, we dispose it by calling Detach().
      4. Otherwise, we DCHECK IsPluginView and call Dispose.
      5. If in a suspend scope, we push it into the set.
      6. Otherwise, call DisposeContentView(view).

      The set processing will change to using DisposeContentView() instead of Dispose().

      So I did experiment with this but so far no success. Essentially, a pathological case is:
      <body> <embed src="foo-not-exists"></embed> </body>
      which crashes when I load as file:///. The reason for crash is FrameLoader::CommitProvisionalLoad() on a detached frame (page_ = nullptr).

      What seems to happen is that chrome-error://chromedata commits but frame is detached.

      So far my understanding (which might be wrong) is that during navigation of a frame we end up calling HTMLFrameOwnerElement::SetEmbeddedContentView. Maybe this should not detach LocalFrame every time.

      I'll keep investigating.

      View Change

      1 comment:

        • Patch Set #1, Line 303: TryDetachingContentFrame();

          Was it also a bug to avoid calling SetEmbeddedContentView()? I see that does a lot of work.

        • I think so. Unfortunately went unnoticed and I believe it is fallback related again. I will see if I can repro something for it so that we can add test coverage.

      To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: master
      Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
      Gerrit-Change-Number: 1073204
      Gerrit-PatchSet: 1
      Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
      Gerrit-CC: Commit Bot <commi...@chromium.org>
      Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
      Gerrit-Comment-Date: Mon, 28 May 2018 08:46:13 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
      Gerrit-MessageType: comment

      Rune Lillesveen (Gerrit)

      unread,
      May 28, 2018, 8:50:18 AM5/28/18
      to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

      FYI: I'm in the process of getting rid of the synchronous re-attach for fallback content in:

      https://chromium-review.googlesource.com/c/chromium/src/+/1073421
      https://chromium-review.googlesource.com/c/chromium/src/+/1072650

      I don't know to what extent that will affect the changes done here, but FYI.

      View Change

        To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/src
        Gerrit-Branch: master
        Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
        Gerrit-Change-Number: 1073204
        Gerrit-PatchSet: 1
        Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
        Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
        Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
        Gerrit-CC: Commit Bot <commi...@chromium.org>
        Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
        Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
        Gerrit-Comment-Date: Mon, 28 May 2018 12:50:12 +0000

        Blink WPT Bot (Gerrit)

        unread,
        May 29, 2018, 2:46:28 PM5/29/18
        to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

        Successfully updated WPT GitHub pull request with new revision "Reworking based on DisposePluginSoon code": https://github.com/web-platform-tests/wpt/pull/11172

        View Change

          To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: chromium/src
          Gerrit-Branch: master
          Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
          Gerrit-Change-Number: 1073204
          Gerrit-PatchSet: 2
          Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
          Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
          Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
          Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
          Gerrit-CC: Commit Bot <commi...@chromium.org>
          Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
          Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
          Gerrit-Comment-Date: Tue, 29 May 2018 18:46:27 +0000

          Ehsan Karamad (Gerrit)

          unread,
          May 29, 2018, 2:59:10 PM5/29/18
          to Daniel Cheng, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Blink WPT Bot, Rune Lillesveen, chromium...@chromium.org, John Abd-El-Malek, Commit Bot

          Ehsan Karamad uploaded patch set #4 to this change.

          View Change

          Delay detaching plugin frames to when plugin can be disposed


          CL 996314 introduced a new change in behavior of plugin elements and
          that is unless in fallback() mode (questionably buggy condition), the
          content frame is always cleaned up during DetachLayoutTree. This is fine
          and desired given that plugins are design around layout and not removing
          the content frame led to various bugs (as explained in more detail in CL
          996314).

          The new behavior has a small caveat and that is we might end up calling
          DetachLayoutTree unexpectedly, i.e., during style recalc. This CL avoid
          such problems by trying to detach the content frame both in the call to
          DetachLayoutTree and in UpdatePlugin calls. Any remote frame will be
          detached in the former call but LocalFrames might not, but will be in
          the latter call which is post style recalc.

          Bug: 846703, 846708
          Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
          ---
          A third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-embed-element/embed-style-change-no-crash.html
          M third_party/blink/renderer/core/html/html_frame_owner_element.cc
          M third_party/blink/renderer/core/html/html_frame_owner_element.h
          M third_party/blink/renderer/core/html/html_plugin_element.cc
          4 files changed, 81 insertions(+), 24 deletions(-)

          To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: chromium/src
          Gerrit-Branch: master
          Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
          Gerrit-Change-Number: 1073204
          Gerrit-PatchSet: 4
          Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
          Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
          Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
          Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
          Gerrit-CC: Commit Bot <commi...@chromium.org>
          Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
          Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
          Gerrit-MessageType: newpatchset

          Blink WPT Bot (Gerrit)

          unread,
          May 29, 2018, 3:02:42 PM5/29/18
          to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

          Successfully updated WPT GitHub pull request with new revision "Edit commit message": https://github.com/web-platform-tests/wpt/pull/11172

          View Change

            To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

            Gerrit-Project: chromium/src
            Gerrit-Branch: master
            Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
            Gerrit-Change-Number: 1073204
            Gerrit-PatchSet: 4
            Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
            Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
            Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
            Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
            Gerrit-CC: Commit Bot <commi...@chromium.org>
            Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
            Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
            Gerrit-Comment-Date: Tue, 29 May 2018 19:02:38 +0000

            Ehsan Karamad (Gerrit)

            unread,
            May 29, 2018, 3:28:50 PM5/29/18
            to blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

            Patch Set 1:

            FYI: I'm in the process of getting rid of the synchronous re-attach for fallback content in:

            https://chromium-review.googlesource.com/c/chromium/src/+/1073421
            https://chromium-review.googlesource.com/c/chromium/src/+/1072650

            I don't know to what extent that will affect the changes done here, but FYI.

            Thanks. I guess both are landed now. I also don't see any immediate issues now but perhaps 1073421 helps with the original approach of this CL.

            View Change

              To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

              Gerrit-Project: chromium/src
              Gerrit-Branch: master
              Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
              Gerrit-Change-Number: 1073204
              Gerrit-PatchSet: 4
              Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
              Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
              Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
              Gerrit-CC: Commit Bot <commi...@chromium.org>
              Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
              Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
              Gerrit-Comment-Date: Tue, 29 May 2018 19:28:46 +0000

              Blink WPT Bot (Gerrit)

              unread,
              May 29, 2018, 3:34:16 PM5/29/18
              to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

              Successfully updated WPT GitHub pull request with new revision "Formatting": https://github.com/web-platform-tests/wpt/pull/11172

              View Change

                To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                Gerrit-Project: chromium/src
                Gerrit-Branch: master
                Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                Gerrit-Change-Number: 1073204
                Gerrit-PatchSet: 5
                Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                Gerrit-CC: Commit Bot <commi...@chromium.org>
                Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                Gerrit-Comment-Date: Tue, 29 May 2018 19:34:13 +0000

                Rune Lillesveen (Gerrit)

                unread,
                May 29, 2018, 4:31:58 PM5/29/18
                to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                Patch Set 4:

                Patch Set 1:

                FYI: I'm in the process of getting rid of the synchronous re-attach for fallback content in:

                https://chromium-review.googlesource.com/c/chromium/src/+/1073421
                https://chromium-review.googlesource.com/c/chromium/src/+/1072650

                I don't know to what extent that will affect the changes done here, but FYI.

                Thanks. I guess both are landed now. I also don't see any immediate issues now but perhaps 1073421 helps with the original approach of this CL.

                Yes. It was just a heads up.

                View Change

                  To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                  Gerrit-Project: chromium/src
                  Gerrit-Branch: master
                  Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                  Gerrit-Change-Number: 1073204
                  Gerrit-PatchSet: 5
                  Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                  Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                  Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                  Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                  Gerrit-CC: Commit Bot <commi...@chromium.org>
                  Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                  Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                  Gerrit-Comment-Date: Tue, 29 May 2018 20:31:56 +0000

                  Blink WPT Bot (Gerrit)

                  unread,
                  May 29, 2018, 7:12:49 PM5/29/18
                  to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                  Successfully updated WPT GitHub pull request with new revision "Do not detach frame in fallback mode": https://github.com/web-platform-tests/wpt/pull/11172

                  View Change

                    To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                    Gerrit-Project: chromium/src
                    Gerrit-Branch: master
                    Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                    Gerrit-Change-Number: 1073204
                    Gerrit-PatchSet: 6
                    Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                    Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                    Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                    Gerrit-CC: Commit Bot <commi...@chromium.org>
                    Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                    Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                    Gerrit-Comment-Date: Tue, 29 May 2018 23:12:48 +0000

                    Ehsan Karamad (Gerrit)

                    unread,
                    May 29, 2018, 7:16:10 PM5/29/18
                    to blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                    Patch Set 1:

                    (1 comment)

                    Patch Set 1:

                    (1 comment)

                    I think it might be nice to use DisposePluginSoon() for this. That means it'd be misnamed... but that's probably OK.

                    The basic idea is this:
                    1. We just use SetEmbeddedContentView() as we did before.
                    2. In html_frame_owner_element.cc, we add a helper called DisposeContentView().
                    3. In there, if the content view is a FrameView, we dispose it by calling Detach().
                    4. Otherwise, we DCHECK IsPluginView and call Dispose.
                    5. If in a suspend scope, we push it into the set.
                    6. Otherwise, call DisposeContentView(view).

                    The set processing will change to using DisposeContentView() instead of Dispose().

                    So I did experiment with this but so far no success. Essentially, a pathological case is:
                    <body> <embed src="foo-not-exists"></embed> </body>
                    which crashes when I load as file:///. The reason for crash is FrameLoader::CommitProvisionalLoad() on a detached frame (page_ = nullptr).

                    What seems to happen is that chrome-error://chromedata commits but frame is detached.

                    So far my understanding (which might be wrong) is that during navigation of a frame we end up calling HTMLFrameOwnerElement::SetEmbeddedContentView. Maybe this should not detach LocalFrame every time.

                    I'll keep investigating.

                    Actually, I don't think we can do this inside HTMLFrameOwnerElement. Reason: FrameLoader::CommitProvisionalLoad() detaches document. So <object data="foo"></foo> will first LoadOrRedirectSubframe("foo") which creates a ContentFrame at "about:blank". Then when the actual request is committed we would end up removing the current FrameView which would essentially detach the frame unnecessarily (It actually crashes down the road).

                    I think the call site to remove a plugin's frame should be inside HTMLPlugInElement. PTAL.

                    View Change

                      To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                      Gerrit-Project: chromium/src
                      Gerrit-Branch: master
                      Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                      Gerrit-Change-Number: 1073204
                      Gerrit-PatchSet: 6
                      Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                      Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                      Gerrit-CC: Commit Bot <commi...@chromium.org>
                      Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                      Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                      Gerrit-Comment-Date: Tue, 29 May 2018 23:16:08 +0000

                      Ehsan Karamad (Gerrit)

                      unread,
                      May 29, 2018, 7:16:41 PM5/29/18
                      to Daniel Cheng, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Blink WPT Bot, Rune Lillesveen, chromium...@chromium.org, John Abd-El-Malek, Commit Bot

                      Ehsan Karamad uploaded patch set #8 to this change.

                      View Change

                      Delay detaching plugin frames to when plugin can be disposed

                      CL 996314 introduced a new change in behavior of plugin elements and
                      that is unless in fallback() mode (questionably buggy condition), the
                      content frame is always cleaned up during DetachLayoutTree. This is fine
                      and desired given that plugins are design around layout and not removing
                      the content frame led to various bugs (as explained in more detail in CL
                      996314).

                      The new behavior has a small caveat and that is we might end up calling
                      DetachLayoutTree unexpectedly, i.e., during style recalc. This CL avoid
                      such problems by trying to detach the content frame both in the call to
                      DetachLayoutTree and in UpdatePlugin calls. Any remote frame will be
                      detached in the former call but LocalFrames might not, but will be in
                      the latter call which is post style recalc.

                      Bug: 846703
                      Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                      ---
                      A third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-embed-element/embed-style-change-no-crash.html
                      M third_party/blink/renderer/core/html/html_frame_owner_element.cc
                      M third_party/blink/renderer/core/html/html_frame_owner_element.h
                      M third_party/blink/renderer/core/html/html_plugin_element.cc
                      4 files changed, 79 insertions(+), 22 deletions(-)

                      To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                      Gerrit-Project: chromium/src
                      Gerrit-Branch: master
                      Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                      Gerrit-Change-Number: 1073204
                      Gerrit-PatchSet: 8
                      Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                      Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                      Gerrit-CC: Commit Bot <commi...@chromium.org>
                      Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                      Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                      Gerrit-MessageType: newpatchset

                      Ehsan Karamad (Gerrit)

                      unread,
                      May 29, 2018, 7:17:08 PM5/29/18
                      to Daniel Cheng, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Blink WPT Bot, Rune Lillesveen, chromium...@chromium.org, John Abd-El-Malek, Commit Bot

                      Ehsan Karamad uploaded patch set #9 to this change.

                      View Change

                      Delay detaching plugin frames to when plugin can be disposed

                      CL 996314 introduced a new change in behavior of plugin elements and
                      that is unless in fallback() mode (questionably buggy condition), the
                      content frame is always cleaned up during DetachLayoutTree. This is fine
                      and desired given that plugins are design around layout and not removing
                      the content frame led to various bugs (as explained in more detail in CL
                      996314).

                      The new behavior has a small caveat and that is we might end up calling
                      DetachLayoutTree unexpectedly, i.e., during style recalc. This CL avoid
                      such problems by trying to detach the content frame both in the call to
                      DetachLayoutTree and in UpdatePlugin calls. Any remote frame will be
                      detached in the former call but LocalFrames might not, but will be in
                      the latter call which is post style recalc.

                      Bug: 846708

                      Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                      ---
                      A third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/the-embed-element/embed-style-change-no-crash.html
                      M third_party/blink/renderer/core/html/html_frame_owner_element.cc
                      M third_party/blink/renderer/core/html/html_frame_owner_element.h
                      M third_party/blink/renderer/core/html/html_plugin_element.cc
                      4 files changed, 79 insertions(+), 22 deletions(-)

                      To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                      Gerrit-Project: chromium/src
                      Gerrit-Branch: master
                      Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                      Gerrit-Change-Number: 1073204
                      Gerrit-PatchSet: 9
                      Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                      Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                      Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                      Gerrit-CC: Commit Bot <commi...@chromium.org>
                      Gerrit-CC: John Abd-El-Malek <j...@chromium.org>

                      Blink WPT Bot (Gerrit)

                      unread,
                      May 29, 2018, 7:22:51 PM5/29/18
                      to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Daniel Cheng, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                      Successfully updated WPT GitHub pull request with new revision "Edit commit message": https://github.com/web-platform-tests/wpt/pull/11172

                      View Change

                        To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                        Gerrit-Project: chromium/src
                        Gerrit-Branch: master
                        Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                        Gerrit-Change-Number: 1073204
                        Gerrit-PatchSet: 9
                        Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                        Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                        Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                        Gerrit-CC: Commit Bot <commi...@chromium.org>
                        Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                        Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                        Gerrit-Comment-Date: Tue, 29 May 2018 23:22:48 +0000

                        Daniel Cheng (Gerrit)

                        unread,
                        May 30, 2018, 6:15:40 PM5/30/18
                        to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Rune Lillesveen, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                        View Change

                        2 comments:

                        To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                        Gerrit-Project: chromium/src
                        Gerrit-Branch: master
                        Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                        Gerrit-Change-Number: 1073204
                        Gerrit-PatchSet: 9
                        Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                        Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                        Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                        Gerrit-CC: Commit Bot <commi...@chromium.org>
                        Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                        Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                        Gerrit-Comment-Date: Wed, 30 May 2018 22:15:38 +0000
                        Gerrit-HasComments: Yes
                        Gerrit-Has-Labels: No
                        Gerrit-MessageType: comment

                        Blink WPT Bot (Gerrit)

                        unread,
                        May 31, 2018, 9:36:52 AM5/31/18
                        to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Daniel Cheng, Rune Lillesveen, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                        Successfully updated WPT GitHub pull request with new revision "Rebased": https://github.com/web-platform-tests/wpt/pull/11172

                        View Change

                          To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                          Gerrit-Project: chromium/src
                          Gerrit-Branch: master
                          Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                          Gerrit-Change-Number: 1073204
                          Gerrit-PatchSet: 10
                          Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                          Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                          Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                          Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                          Gerrit-CC: Commit Bot <commi...@chromium.org>
                          Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                          Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                          Gerrit-Comment-Date: Thu, 31 May 2018 13:36:48 +0000

                          Blink WPT Bot (Gerrit)

                          unread,
                          May 31, 2018, 3:09:22 PM5/31/18
                          to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, Nate Chapin, Daniel Cheng, Rune Lillesveen, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                          Successfully updated WPT GitHub pull request with new revision "Detach Frame at UpdatePlugin": https://github.com/web-platform-tests/wpt/pull/11172

                          View Change

                            To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                            Gerrit-Project: chromium/src
                            Gerrit-Branch: master
                            Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                            Gerrit-Change-Number: 1073204
                            Gerrit-PatchSet: 11
                            Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                            Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                            Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                            Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                            Gerrit-CC: Commit Bot <commi...@chromium.org>
                            Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                            Gerrit-CC: Nate Chapin <jap...@chromium.org>
                            Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                            Gerrit-Comment-Date: Thu, 31 May 2018 19:09:20 +0000

                            Blink WPT Bot (Gerrit)

                            unread,
                            May 31, 2018, 8:03:11 PM5/31/18
                            to Ehsan Karamad, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, Nate Chapin, Daniel Cheng, Rune Lillesveen, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                            Successfully updated WPT GitHub pull request with new revision "Detach Frame When Needed At UpdatePlugin": https://github.com/web-platform-tests/wpt/pull/11172

                            View Change

                              To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                              Gerrit-Project: chromium/src
                              Gerrit-Branch: master
                              Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                              Gerrit-Change-Number: 1073204
                              Gerrit-PatchSet: 12
                              Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                              Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                              Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                              Gerrit-CC: Commit Bot <commi...@chromium.org>
                              Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                              Gerrit-CC: Nate Chapin <jap...@chromium.org>
                              Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                              Gerrit-Comment-Date: Fri, 01 Jun 2018 00:03:07 +0000

                              Ehsan Karamad (Gerrit)

                              unread,
                              May 31, 2018, 8:07:42 PM5/31/18
                              to blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, Nate Chapin, Daniel Cheng, Rune Lillesveen, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                              Not necessarily proposing this as a fix, but this would stop the issues we currently have, probably not worse than what we had before 996314.

                              This seems to also fix 848283 (that is not the goal of CL though).

                              View Change

                              2 comments:

                              To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                              Gerrit-Project: chromium/src
                              Gerrit-Branch: master
                              Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                              Gerrit-Change-Number: 1073204
                              Gerrit-PatchSet: 12
                              Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                              Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                              Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                              Gerrit-CC: Commit Bot <commi...@chromium.org>
                              Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                              Gerrit-CC: Nate Chapin <jap...@chromium.org>
                              Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                              Gerrit-Comment-Date: Fri, 01 Jun 2018 00:07:39 +0000

                              Ehsan Karamad (Gerrit)

                              unread,
                              Aug 8, 2018, 10:44:10 AM8/8/18
                              to blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, gavinp...@chromium.org, loading...@chromium.org, Nate Chapin, Daniel Cheng, Rune Lillesveen, Blink WPT Bot, Commit Bot, chromium...@chromium.org, John Abd-El-Malek

                              Ehsan Karamad abandoned this change.

                              View Change

                              Abandoned Restarting the work in a different CL.

                              To view, visit change 1073204. To unsubscribe, or for help writing mail filters, visit settings.

                              Gerrit-Project: chromium/src
                              Gerrit-Branch: master
                              Gerrit-Change-Id: If651a78365f136d36702ebba56e5482154c8cdd1
                              Gerrit-Change-Number: 1073204
                              Gerrit-PatchSet: 12
                              Gerrit-Owner: Ehsan Karamad <ekar...@chromium.org>
                              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
                              Gerrit-Reviewer: Ehsan Karamad <ekar...@chromium.org>
                              Gerrit-CC: Blink WPT Bot <blink-w3c-te...@chromium.org>
                              Gerrit-CC: Commit Bot <commi...@chromium.org>
                              Gerrit-CC: John Abd-El-Malek <j...@chromium.org>
                              Gerrit-CC: Nate Chapin <jap...@chromium.org>
                              Gerrit-CC: Rune Lillesveen <fut...@chromium.org>
                              Gerrit-MessageType: abandon
                              Reply all
                              Reply to author
                              Forward
                              0 new messages