⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 287604 in webkit


Ignore:
Timestamp:
Jan 4, 2022, 11:52:54 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Protect frame from destruction in HTMLMediaElement::setupAndCallJS
https://bugs.webkit.org/show_bug.cgi?id=234259

Patch by Frédéric Wang <fwang@igalia.com> on 2022-01-04
Reviewed by Darin Adler.

Source/WebCore:

Test: http/tests/media/media-element-frame-destroyed-crash.html

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::setupAndCallJS): Protect the frame before executing the JS code,
so that it is not destroyed before its associated ScriptController.

LayoutTests:

Add non-regression test, embedded in multiple iframes to make regression easily reproducible.

  • http/conf/mime.types: Ensure that ts files are served with MIME type video/mp2t as that's required

to make the non-regression test work properly.

  • http/tests/media/media-element-frame-destroyed-crash-expected.txt: Added.
  • http/tests/media/media-element-frame-destroyed-crash.html: Added.
  • http/tests/media/resources/empty.ts: Added.
  • http/tests/media/resources/media-element-frame-destroyed-crash-subframe.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287602 r287604  
     12022-01-04  Frédéric Wang  <fwang@igalia.com>
     2
     3        Protect frame from destruction in HTMLMediaElement::setupAndCallJS
     4        https://bugs.webkit.org/show_bug.cgi?id=234259
     5
     6        Reviewed by Darin Adler.
     7
     8        Add non-regression test, embedded in multiple iframes to make regression easily reproducible.
     9
     10        * http/conf/mime.types: Ensure that ts files are served with MIME type video/mp2t as that's required
     11        to make the non-regression test work properly.
     12        * http/tests/media/media-element-frame-destroyed-crash-expected.txt: Added.
     13        * http/tests/media/media-element-frame-destroyed-crash.html: Added.
     14        * http/tests/media/resources/empty.ts: Added.
     15        * http/tests/media/resources/media-element-frame-destroyed-crash-subframe.html: Added.
     16
    1172022-01-04  Antoine Quint  <graouts@webkit.org>
    218
  • trunk/LayoutTests/http/conf/mime.types

    r285936 r287604  
    580580video/mp1s
    581581video/mp2p
    582 video/mp2t
     582video/mp2t                      ts
    583583video/mp4                       mp4
    584584video/mp4v-es
  • trunk/Source/WebCore/ChangeLog

    r287603 r287604  
     12022-01-04  Frédéric Wang  <fwang@igalia.com>
     2
     3        Protect frame from destruction in HTMLMediaElement::setupAndCallJS
     4        https://bugs.webkit.org/show_bug.cgi?id=234259
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: http/tests/media/media-element-frame-destroyed-crash.html
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::setupAndCallJS): Protect the frame before executing the JS code,
     12        so that it is not destroyed before its associated ScriptController.
     13
    1142022-01-04  Antoine Quint  <graouts@webkit.org>
    215
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r287239 r287604  
    45854585    auto pendingActivity = makePendingActivity(*this);
    45864586    auto& world = ensureIsolatedWorld();
    4587     auto& scriptController = document().frame()->script();
     4587    Ref protectedFrame = *document().frame();
     4588    auto& scriptController = protectedFrame->script();
    45884589    auto* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world));
    45894590    auto& vm = globalObject->vm();
Note: See TracChangeset for help on using the changeset viewer.