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

Changeset 277379 in webkit


Ignore:
Timestamp:
May 12, 2021, 11:00:23 AM (5 years ago)
Author:
jer.noble@apple.com
Message:

HTMLMediaElement::mediaLoadingFailedFatally() does direct dispatch of events; should enqueue
https://bugs.webkit.org/show_bug.cgi?id=225700
<rdar://75576322>

Reviewed by Eric Carlson.

In r274559, an update was made to mediaLoadingFailedFatally to adopt recent spec changes, and as
part of that change, an "error" event was changed from being enqueued to being directly dispatched.
However, directly dispatching events exposes the element to JS and has the potential to cause the
element to be garbage collected, deleting the object and potentially other objects in the backtrace.
Events should always be enqueued, rather than directy dispatched, for this reason.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::mediaLoadingFailedFatally):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r277378 r277379  
     12021-05-12  Jer Noble  <jer.noble@apple.com>
     2
     3        HTMLMediaElement::mediaLoadingFailedFatally() does direct dispatch of events; should enqueue
     4        https://bugs.webkit.org/show_bug.cgi?id=225700
     5        <rdar://75576322>
     6
     7        Reviewed by Eric Carlson.
     8
     9        In r274559, an update was made to mediaLoadingFailedFatally to adopt recent spec changes, and as
     10        part of that change, an "error" event was changed from being enqueued to being directly dispatched.
     11        However, directly dispatching events exposes the element to JS and has the potential to cause the
     12        element to be garbage collected, deleting the object and potentially other objects in the backtrace.
     13        Events should always be enqueued, rather than directy dispatched, for this reason.
     14
     15        * html/HTMLMediaElement.cpp:
     16        (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
     17
    1182021-05-12  Sergio Villar Senin  <svillar@igalia.com>
    219
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r276978 r277379  
    21442144
    21452145    // 5 - Fire an event named error at the media element.
    2146     dispatchEvent(Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::No));
     2146    scheduleEvent(eventNames().errorEvent);
    21472147
    21482148    // 6 - Abort the overall resource selection algorithm.
Note: See TracChangeset for help on using the changeset viewer.