Changeset 234177 in webkit


Ignore:
Timestamp:
Jul 24, 2018 4:13:21 PM (6 years ago)
Author:
Chris Dumez
Message:

Unreviewed, rolling out r233496 and r233571.

Likely cause of <rdar://problem/42160890> and
<rdar://problem/42329658> as ActiveDOMObjects can now be
constructed / destroyed while we are iterating over them.

Reverted changesets:

"Nullptr crash accessing Document in
GenericEventQueue::dispatchOneEvent()"
https://bugs.webkit.org/show_bug.cgi?id=187284
https://trac.webkit.org/changeset/233496

"REGRESSION(r233496): macOS Sierra hits debug assertions in
TrackListBase::suspend"
https://bugs.webkit.org/show_bug.cgi?id=187378
https://trac.webkit.org/changeset/233571

Location:
trunk
Files:
2 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r234173 r234177  
     12018-07-24  Chris Dumez  <cdumez@apple.com>
     2
     3        Unreviewed, rolling out r233496 and r233571.
     4
     5        Likely cause of <rdar://problem/42160890> and
     6        <rdar://problem/42329658> as ActiveDOMObjects can now be
     7        constructed / destroyed while we are iterating over them.
     8
     9        Reverted changesets:
     10
     11        "Nullptr crash accessing Document in
     12        GenericEventQueue::dispatchOneEvent()"
     13        https://bugs.webkit.org/show_bug.cgi?id=187284
     14        https://trac.webkit.org/changeset/233496
     15
     16        "REGRESSION(r233496): macOS Sierra hits debug assertions in
     17        TrackListBase::suspend"
     18        https://bugs.webkit.org/show_bug.cgi?id=187378
     19        https://trac.webkit.org/changeset/233571
     20
    1212018-07-24  Thibault Saunier  <tsaunier@igalia.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r234172 r234177  
     12018-07-24  Chris Dumez  <cdumez@apple.com>
     2
     3        Unreviewed, rolling out r233496 and r233571.
     4
     5        Likely cause of <rdar://problem/42160890> and
     6        <rdar://problem/42329658> as ActiveDOMObjects can now be
     7        constructed / destroyed while we are iterating over them.
     8
     9        Reverted changesets:
     10
     11        "Nullptr crash accessing Document in
     12        GenericEventQueue::dispatchOneEvent()"
     13        https://bugs.webkit.org/show_bug.cgi?id=187284
     14        https://trac.webkit.org/changeset/233496
     15
     16        "REGRESSION(r233496): macOS Sierra hits debug assertions in
     17        TrackListBase::suspend"
     18        https://bugs.webkit.org/show_bug.cgi?id=187378
     19        https://trac.webkit.org/changeset/233571
     20
    1212018-07-24  Aditya Keerthi  <akeerthi@apple.com>
    222
  • trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp

    r233496 r234177  
    240240}
    241241
    242 void WebKitMediaKeySession::suspend(ReasonForSuspension)
    243 {
    244     ASSERT_NOT_REACHED();
    245 }
    246 
    247 void WebKitMediaKeySession::resume()
    248 {
    249     ASSERT_NOT_REACHED();
    250 }
    251 
    252242void WebKitMediaKeySession::stop()
    253243{
    254     m_asyncEventQueue.close();
    255244    close();
    256245}
  • trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h

    r233496 r234177  
    7777    void derefEventTarget() final { deref(); }
    7878
    79     void suspend(ReasonForSuspension) final;
    80     void resume() final;
    8179    void stop() final;
    8280    bool canSuspendForDocumentSuspension() const final;
  • trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp

    r233571 r234177  
    693693    buffer.abortIfUpdating();
    694694
    695     ASSERT(scriptExecutionContext());
    696     if (!scriptExecutionContext()->activeDOMObjectsAreStopped()) {
    697         // 4. Let SourceBuffer audioTracks list equal the AudioTrackList object returned by sourceBuffer.audioTracks.
    698         auto& audioTracks = buffer.audioTracks();
    699 
    700         // 5. If the SourceBuffer audioTracks list is not empty, then run the following steps:
    701         if (audioTracks.length()) {
    702             // 5.1 Let HTMLMediaElement audioTracks list equal the AudioTrackList object returned by the audioTracks
    703             // attribute on the HTMLMediaElement.
    704             // 5.2 Let the removed enabled audio track flag equal false.
    705             bool removedEnabledAudioTrack = false;
    706 
    707             // 5.3 For each AudioTrack object in the SourceBuffer audioTracks list, run the following steps:
    708             while (audioTracks.length()) {
    709                 auto& track = *audioTracks.lastItem();
    710 
    711                 // 5.3.1 Set the sourceBuffer attribute on the AudioTrack object to null.
    712                 track.setSourceBuffer(nullptr);
    713 
    714                 // 5.3.2 If the enabled attribute on the AudioTrack object is true, then set the removed enabled
    715                 // audio track flag to true.
    716                 if (track.enabled())
    717                     removedEnabledAudioTrack = true;
    718 
    719                 // 5.3.3 Remove the AudioTrack object from the HTMLMediaElement audioTracks list.
    720                 // 5.3.4 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
    721                 // cancelable, and that uses the TrackEvent interface, at the HTMLMediaElement audioTracks list.
    722                 if (mediaElement())
    723                     mediaElement()->removeAudioTrack(track);
    724 
    725                 // 5.3.5 Remove the AudioTrack object from the SourceBuffer audioTracks list.
    726                 // 5.3.6 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
    727                 // cancelable, and that uses the TrackEvent interface, at the SourceBuffer audioTracks list.
    728                 audioTracks.remove(track);
    729             }
    730 
    731             // 5.4 If the removed enabled audio track flag equals true, then queue a task to fire a simple event
    732             // named change at the HTMLMediaElement audioTracks list.
    733             if (removedEnabledAudioTrack)
    734                 mediaElement()->audioTracks().scheduleChangeEvent();
     695    // 4. Let SourceBuffer audioTracks list equal the AudioTrackList object returned by sourceBuffer.audioTracks.
     696    auto& audioTracks = buffer.audioTracks();
     697
     698    // 5. If the SourceBuffer audioTracks list is not empty, then run the following steps:
     699    if (audioTracks.length()) {
     700        // 5.1 Let HTMLMediaElement audioTracks list equal the AudioTrackList object returned by the audioTracks
     701        // attribute on the HTMLMediaElement.
     702        // 5.2 Let the removed enabled audio track flag equal false.
     703        bool removedEnabledAudioTrack = false;
     704
     705        // 5.3 For each AudioTrack object in the SourceBuffer audioTracks list, run the following steps:
     706        while (audioTracks.length()) {
     707            auto& track = *audioTracks.lastItem();
     708
     709            // 5.3.1 Set the sourceBuffer attribute on the AudioTrack object to null.
     710            track.setSourceBuffer(nullptr);
     711
     712            // 5.3.2 If the enabled attribute on the AudioTrack object is true, then set the removed enabled
     713            // audio track flag to true.
     714            if (track.enabled())
     715                removedEnabledAudioTrack = true;
     716
     717            // 5.3.3 Remove the AudioTrack object from the HTMLMediaElement audioTracks list.
     718            // 5.3.4 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
     719            // cancelable, and that uses the TrackEvent interface, at the HTMLMediaElement audioTracks list.
     720            if (mediaElement())
     721                mediaElement()->removeAudioTrack(track);
     722
     723            // 5.3.5 Remove the AudioTrack object from the SourceBuffer audioTracks list.
     724            // 5.3.6 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
     725            // cancelable, and that uses the TrackEvent interface, at the SourceBuffer audioTracks list.
     726            audioTracks.remove(track);
    735727        }
    736728
    737         // 6. Let SourceBuffer videoTracks list equal the VideoTrackList object returned by sourceBuffer.videoTracks.
    738         auto& videoTracks = buffer.videoTracks();
    739 
    740         // 7. If the SourceBuffer videoTracks list is not empty, then run the following steps:
    741         if (videoTracks.length()) {
    742             // 7.1 Let HTMLMediaElement videoTracks list equal the VideoTrackList object returned by the videoTracks
    743             // attribute on the HTMLMediaElement.
    744             // 7.2 Let the removed selected video track flag equal false.
    745             bool removedSelectedVideoTrack = false;
    746 
    747             // 7.3 For each VideoTrack object in the SourceBuffer videoTracks list, run the following steps:
    748             while (videoTracks.length()) {
    749                 auto& track = *videoTracks.lastItem();
    750 
    751                 // 7.3.1 Set the sourceBuffer attribute on the VideoTrack object to null.
    752                 track.setSourceBuffer(nullptr);
    753 
    754                 // 7.3.2 If the selected attribute on the VideoTrack object is true, then set the removed selected
    755                 // video track flag to true.
    756                 if (track.selected())
    757                     removedSelectedVideoTrack = true;
    758 
    759                 // 7.3.3 Remove the VideoTrack object from the HTMLMediaElement videoTracks list.
    760                 // 7.3.4 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
    761                 // cancelable, and that uses the TrackEvent interface, at the HTMLMediaElement videoTracks list.
    762                 if (mediaElement())
    763                     mediaElement()->removeVideoTrack(track);
    764 
    765                 // 7.3.5 Remove the VideoTrack object from the SourceBuffer videoTracks list.
    766                 // 7.3.6 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
    767                 // cancelable, and that uses the TrackEvent interface, at the SourceBuffer videoTracks list.
    768                 videoTracks.remove(track);
    769             }
    770 
    771             // 7.4 If the removed selected video track flag equals true, then queue a task to fire a simple event
    772             // named change at the HTMLMediaElement videoTracks list.
    773             if (removedSelectedVideoTrack)
    774                 mediaElement()->videoTracks().scheduleChangeEvent();
     729        // 5.4 If the removed enabled audio track flag equals true, then queue a task to fire a simple event
     730        // named change at the HTMLMediaElement audioTracks list.
     731        if (removedEnabledAudioTrack)
     732            mediaElement()->audioTracks().scheduleChangeEvent();
     733    }
     734
     735    // 6. Let SourceBuffer videoTracks list equal the VideoTrackList object returned by sourceBuffer.videoTracks.
     736    auto& videoTracks = buffer.videoTracks();
     737
     738    // 7. If the SourceBuffer videoTracks list is not empty, then run the following steps:
     739    if (videoTracks.length()) {
     740        // 7.1 Let HTMLMediaElement videoTracks list equal the VideoTrackList object returned by the videoTracks
     741        // attribute on the HTMLMediaElement.
     742        // 7.2 Let the removed selected video track flag equal false.
     743        bool removedSelectedVideoTrack = false;
     744
     745        // 7.3 For each VideoTrack object in the SourceBuffer videoTracks list, run the following steps:
     746        while (videoTracks.length()) {
     747            auto& track = *videoTracks.lastItem();
     748
     749            // 7.3.1 Set the sourceBuffer attribute on the VideoTrack object to null.
     750            track.setSourceBuffer(nullptr);
     751
     752            // 7.3.2 If the selected attribute on the VideoTrack object is true, then set the removed selected
     753            // video track flag to true.
     754            if (track.selected())
     755                removedSelectedVideoTrack = true;
     756
     757            // 7.3.3 Remove the VideoTrack object from the HTMLMediaElement videoTracks list.
     758            // 7.3.4 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
     759            // cancelable, and that uses the TrackEvent interface, at the HTMLMediaElement videoTracks list.
     760            if (mediaElement())
     761                mediaElement()->removeVideoTrack(track);
     762
     763            // 7.3.5 Remove the VideoTrack object from the SourceBuffer videoTracks list.
     764            // 7.3.6 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
     765            // cancelable, and that uses the TrackEvent interface, at the SourceBuffer videoTracks list.
     766            videoTracks.remove(track);
    775767        }
    776768
    777         // 8. Let SourceBuffer textTracks list equal the TextTrackList object returned by sourceBuffer.textTracks.
    778         auto& textTracks = buffer.textTracks();
    779 
    780         // 9. If the SourceBuffer textTracks list is not empty, then run the following steps:
    781         if (textTracks.length()) {
    782             // 9.1 Let HTMLMediaElement textTracks list equal the TextTrackList object returned by the textTracks
    783             // attribute on the HTMLMediaElement.
    784             // 9.2 Let the removed enabled text track flag equal false.
    785             bool removedEnabledTextTrack = false;
    786 
    787             // 9.3 For each TextTrack object in the SourceBuffer textTracks list, run the following steps:
    788             while (textTracks.length()) {
    789                 auto& track = *textTracks.lastItem();
    790 
    791                 // 9.3.1 Set the sourceBuffer attribute on the TextTrack object to null.
    792                 track.setSourceBuffer(nullptr);
    793 
    794                 // 9.3.2 If the mode attribute on the TextTrack object is set to "showing" or "hidden", then
    795                 // set the removed enabled text track flag to true.
    796                 if (track.mode() == TextTrack::Mode::Showing || track.mode() == TextTrack::Mode::Hidden)
    797                     removedEnabledTextTrack = true;
    798 
    799                 // 9.3.3 Remove the TextTrack object from the HTMLMediaElement textTracks list.
    800                 // 9.3.4 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
    801                 // cancelable, and that uses the TrackEvent interface, at the HTMLMediaElement textTracks list.
    802                 if (mediaElement())
    803                     mediaElement()->removeTextTrack(track);
    804 
    805                 // 9.3.5 Remove the TextTrack object from the SourceBuffer textTracks list.
    806                 // 9.3.6 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
    807                 // cancelable, and that uses the TrackEvent interface, at the SourceBuffer textTracks list.
    808                 textTracks.remove(track);
    809             }
    810 
    811             // 9.4 If the removed enabled text track flag equals true, then queue a task to fire a simple event
    812             // named change at the HTMLMediaElement textTracks list.
    813             if (removedEnabledTextTrack)
    814                 mediaElement()->textTracks().scheduleChangeEvent();
     769        // 7.4 If the removed selected video track flag equals true, then queue a task to fire a simple event
     770        // named change at the HTMLMediaElement videoTracks list.
     771        if (removedSelectedVideoTrack)
     772            mediaElement()->videoTracks().scheduleChangeEvent();
     773    }
     774
     775    // 8. Let SourceBuffer textTracks list equal the TextTrackList object returned by sourceBuffer.textTracks.
     776    auto& textTracks = buffer.textTracks();
     777
     778    // 9. If the SourceBuffer textTracks list is not empty, then run the following steps:
     779    if (textTracks.length()) {
     780        // 9.1 Let HTMLMediaElement textTracks list equal the TextTrackList object returned by the textTracks
     781        // attribute on the HTMLMediaElement.
     782        // 9.2 Let the removed enabled text track flag equal false.
     783        bool removedEnabledTextTrack = false;
     784
     785        // 9.3 For each TextTrack object in the SourceBuffer textTracks list, run the following steps:
     786        while (textTracks.length()) {
     787            auto& track = *textTracks.lastItem();
     788
     789            // 9.3.1 Set the sourceBuffer attribute on the TextTrack object to null.
     790            track.setSourceBuffer(nullptr);
     791
     792            // 9.3.2 If the mode attribute on the TextTrack object is set to "showing" or "hidden", then
     793            // set the removed enabled text track flag to true.
     794            if (track.mode() == TextTrack::Mode::Showing || track.mode() == TextTrack::Mode::Hidden)
     795                removedEnabledTextTrack = true;
     796
     797            // 9.3.3 Remove the TextTrack object from the HTMLMediaElement textTracks list.
     798            // 9.3.4 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
     799            // cancelable, and that uses the TrackEvent interface, at the HTMLMediaElement textTracks list.
     800            if (mediaElement())
     801                mediaElement()->removeTextTrack(track);
     802
     803            // 9.3.5 Remove the TextTrack object from the SourceBuffer textTracks list.
     804            // 9.3.6 Queue a task to fire a trusted event named removetrack, that does not bubble and is not
     805            // cancelable, and that uses the TrackEvent interface, at the SourceBuffer textTracks list.
     806            textTracks.remove(track);
    815807        }
     808
     809        // 9.4 If the removed enabled text track flag equals true, then queue a task to fire a simple event
     810        // named change at the HTMLMediaElement textTracks list.
     811        if (removedEnabledTextTrack)
     812            mediaElement()->textTracks().scheduleChangeEvent();
    816813    }
    817814
     
    934931    return m_private || m_asyncEventQueue.hasPendingEvents()
    935932        || ActiveDOMObject::hasPendingActivity();
    936 }
    937 
    938 void MediaSource::suspend(ReasonForSuspension reason)
    939 {
    940     switch (reason) {
    941     case ReasonForSuspension::PageCache:
    942     case ReasonForSuspension::PageWillBeSuspended:
    943         m_asyncEventQueue.suspend();
    944         break;
    945     case ReasonForSuspension::JavaScriptDebuggerPaused:
    946     case ReasonForSuspension::WillDeferLoading:
    947         // Do nothing, we don't pause media playback in these cases.
    948         break;
    949     }
    950 }
    951 
    952 void MediaSource::resume()
    953 {
    954     m_asyncEventQueue.resume();
    955933}
    956934
  • trunk/Source/WebCore/Modules/mediasource/MediaSource.h

    r233496 r234177  
    108108    explicit MediaSource(ScriptExecutionContext&);
    109109
    110     void suspend(ReasonForSuspension) final;
    111     void resume() final;
    112110    void stop() final;
    113111    bool canSuspendForDocumentSuspension() const final;
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp

    r233571 r234177  
    459459}
    460460
    461 void SourceBuffer::suspend(ReasonForSuspension reason)
    462 {
    463     switch (reason) {
    464     case ReasonForSuspension::PageCache:
    465     case ReasonForSuspension::PageWillBeSuspended:
    466         m_asyncEventQueue.suspend();
    467         break;
    468     case ReasonForSuspension::JavaScriptDebuggerPaused:
    469     case ReasonForSuspension::WillDeferLoading:
    470         // Do nothing, we don't pause media playback in these cases.
    471         break;
    472     }
    473 }
    474 
    475 void SourceBuffer::resume()
    476 {
    477     m_asyncEventQueue.resume();
    478 }
    479 
    480461void SourceBuffer::stop()
    481462{
    482     m_asyncEventQueue.close();
    483463    m_appendBufferTimer.stop();
    484464    m_removeTimer.stop();
  • trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h

    r233496 r234177  
    124124    void derefEventTarget() final { deref(); }
    125125
    126     void suspend(ReasonForSuspension) final;
    127     void resume() final;
    128126    void stop() final;
    129127    const char* activeDOMObjectName() const final;
  • trunk/Source/WebCore/Modules/mediasource/SourceBufferList.cpp

    r233571 r234177  
    4141
    4242SourceBufferList::SourceBufferList(ScriptExecutionContext* context)
    43     : ActiveDOMObject(context)
     43    : ContextDestructionObserver(context)
    4444    , m_asyncEventQueue(*this)
    4545{
    46     suspendIfNeeded();
    4746}
    4847
     
    9998}
    10099
    101 bool SourceBufferList::canSuspendForDocumentSuspension() const
    102 {
    103     return !m_asyncEventQueue.hasPendingEvents();
    104 }
    105 
    106 void SourceBufferList::suspend(ReasonForSuspension reason)
    107 {
    108     switch (reason) {
    109     case ReasonForSuspension::PageCache:
    110     case ReasonForSuspension::PageWillBeSuspended:
    111         m_asyncEventQueue.suspend();
    112         break;
    113     case ReasonForSuspension::JavaScriptDebuggerPaused:
    114     case ReasonForSuspension::WillDeferLoading:
    115         // Do nothing, we don't pause media playback in these cases.
    116         break;
    117     }
    118 }
    119 
    120 void SourceBufferList::resume()
    121 {
    122     m_asyncEventQueue.resume();
    123 }
    124 
    125 void SourceBufferList::stop()
    126 {
    127     m_asyncEventQueue.close();
    128 }
    129 
    130 const char* SourceBufferList::activeDOMObjectName() const
    131 {
    132     return "SourceBufferList";
    133 }
    134100
    135101} // namespace WebCore
  • trunk/Source/WebCore/Modules/mediasource/SourceBufferList.h

    r233496 r234177  
    3333#if ENABLE(MEDIA_SOURCE)
    3434
    35 #include "ActiveDOMObject.h"
     35#include "ContextDestructionObserver.h"
    3636#include "EventTarget.h"
    3737#include "GenericEventQueue.h"
     
    4343class SourceBuffer;
    4444
    45 class SourceBufferList final : public RefCounted<SourceBufferList>, public EventTargetWithInlineData, public ActiveDOMObject {
     45class SourceBufferList final : public RefCounted<SourceBufferList>, public EventTargetWithInlineData, public ContextDestructionObserver {
    4646public:
    4747    static Ref<SourceBufferList> create(ScriptExecutionContext* context)
     
    7878    void derefEventTarget() override { deref(); }
    7979
    80     bool canSuspendForDocumentSuspension() const final;
    81     void suspend(ReasonForSuspension) final;
    82     void resume() final;
    83     void stop() final;
    84     const char* activeDOMObjectName() const final;
    85 
    8680    GenericEventQueue m_asyncEventQueue;
    8781
  • trunk/Source/WebCore/Modules/mediasource/SourceBufferList.idl

    r233496 r234177  
    3030 
    3131[
    32     ActiveDOMObject,
    3332    Conditional=MEDIA_SOURCE,
    3433    GenerateIsReachable=Impl,
  • trunk/Source/WebCore/dom/Document.h

    r234148 r234177  
    814814    WEBCORE_EXPORT WindowProxy* windowProxy() const;
    815815
    816     bool hasBrowsingContext() const { return !!frame(); }
    817 
    818816    Document& contextDocument() const;
    819817    void setContextDocument(Document& document) { m_contextDocument = makeWeakPtr(document); }
  • trunk/Source/WebCore/dom/GenericEventQueue.cpp

    r233496 r234177  
    2727#include "GenericEventQueue.h"
    2828
    29 #include "Document.h"
    3029#include "Event.h"
    3130#include "EventTarget.h"
    32 #include "Node.h"
    3331#include "ScriptExecutionContext.h"
    3432#include "Timer.h"
     
    6866    RefPtr<Event> event = m_pendingEvents.takeFirst();
    6967    EventTarget& target = event->target() ? *event->target() : m_owner;
    70     ASSERT_WITH_MESSAGE(!target.scriptExecutionContext()->activeDOMObjectsAreStopped(),
    71         "An attempt to dispatch an event on a stopped target by EventTargetInterface=%d (nodeName=%s target=%p owner=%p)",
    72         m_owner.eventTargetInterface(), m_owner.isNode() ? static_cast<Node&>(m_owner).nodeName().ascii().data() : "", &target, &m_owner);
    7368    target.dispatchEvent(*event);
    7469}
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r234002 r234177  
    13001300    m_currentSourceNode = nullptr;
    13011301
    1302     if (!document().hasBrowsingContext())
    1303         return;
    1304 
    13051302    createMediaPlayer();
    13061303
     
    14191416    // put into the background.
    14201417    m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequirePageConsentToLoadMedia);
     1418
    14211419
    14221420    m_resourceSelectionTaskQueue.enqueueTask([this]  {
     
    28962894{
    28972895    INFO_LOG(LOGIDENTIFIER);
    2898     if (m_havePreparedToPlay || !document().hasBrowsingContext())
     2896    if (m_havePreparedToPlay)
    28992897        return;
    29002898    m_havePreparedToPlay = true;
     
    34883486    if (isSuspended()) {
    34893487        ALWAYS_LOG(LOGIDENTIFIER, "  returning because context is suspended");
    3490         return;
    3491     }
    3492 
    3493     if (!document().hasBrowsingContext()) {
    3494         INFO_LOG(LOGIDENTIFIER, "  returning because there is no browsing context");
    34953488        return;
    34963489    }
     
    35843577    if (isSuspended()) {
    35853578        ALWAYS_LOG(LOGIDENTIFIER, "  returning because context is suspended");
    3586         return;
    3587     }
    3588 
    3589     if (!document().hasBrowsingContext()) {
    3590         INFO_LOG(LOGIDENTIFIER, "  returning because there is no browsing context");
    35913579        return;
    35923580    }
     
    46524640        URL url = source.getNonEmptyURLAttribute(srcAttr);
    46534641        INFO_LOG(LOGIDENTIFIER, "'src' is ", url);
    4654     }
    4655 
    4656     if (!document().hasBrowsingContext()) {
    4657         INFO_LOG(LOGIDENTIFIER, "<source> inserted inside a document without a browsing context is not loaded");
    4658         return;
    46594642    }
    46604643
  • trunk/Source/WebCore/html/track/AudioTrackList.cpp

    r233496 r234177  
    8282}
    8383
    84 const char* AudioTrackList::activeDOMObjectName() const
    85 {
    86     return "AudioTrackList";
    87 }
    88 
    8984#endif
  • trunk/Source/WebCore/html/track/AudioTrackList.h

    r233496 r234177  
    5353private:
    5454    AudioTrackList(HTMLMediaElement*, ScriptExecutionContext*);
    55     const char* activeDOMObjectName() const final;
    5655};
    5756
  • trunk/Source/WebCore/html/track/AudioTrackList.idl

    r233496 r234177  
    2525
    2626[
    27     ActiveDOMObject,
    2827    Conditional=VIDEO_TRACK,
    2928    GenerateIsReachable=ImplElementRoot,
  • trunk/Source/WebCore/html/track/TextTrackList.cpp

    r233496 r234177  
    266266}
    267267
    268 const char* TextTrackList::activeDOMObjectName() const
    269 {
    270     return "TextTrackList";
    271 }
    272 
    273268#endif
  • trunk/Source/WebCore/html/track/TextTrackList.h

    r233496 r234177  
    6363
    6464    void invalidateTrackIndexesAfterTrack(TextTrack&);
    65     const char* activeDOMObjectName() const final;
    6665
    6766    Vector<RefPtr<TrackBase>> m_addTrackTracks;
  • trunk/Source/WebCore/html/track/TextTrackList.idl

    r233496 r234177  
    2525
    2626[
    27     ActiveDOMObject,
    2827    Conditional=VIDEO_TRACK,
    2928    GenerateIsReachable=ImplElementRoot,
  • trunk/Source/WebCore/html/track/TrackListBase.cpp

    r233571 r234177  
    3535#include "TrackEvent.h"
    3636
    37 namespace WebCore {
     37using namespace WebCore;
    3838
    3939TrackListBase::TrackListBase(HTMLMediaElement* element, ScriptExecutionContext* context)
    40     : ActiveDOMObject(context)
     40    : ContextDestructionObserver(context)
    4141    , m_element(element)
    4242    , m_asyncEventQueue(*this)
    4343{
    44     ASSERT(!context || is<Document>(context));
    45     suspendIfNeeded();
     44    ASSERT(is<Document>(context));
    4645}
    4746
     
    176175}
    177176
    178 bool TrackListBase::canSuspendForDocumentSuspension() const
    179 {
    180     return !m_asyncEventQueue.hasPendingEvents();
    181 }
    182 
    183 void TrackListBase::suspend(ReasonForSuspension reason)
    184 {
    185     switch (reason) {
    186     case ReasonForSuspension::PageCache:
    187     case ReasonForSuspension::PageWillBeSuspended:
    188         m_asyncEventQueue.suspend();
    189         break;
    190     case ReasonForSuspension::JavaScriptDebuggerPaused:
    191     case ReasonForSuspension::WillDeferLoading:
    192         // Do nothing, we don't pause media playback in these cases.
    193         break;
    194     }
    195 }
    196 
    197 void TrackListBase::resume()
    198 {
    199     m_asyncEventQueue.resume();
    200 }
    201 
    202 void TrackListBase::stop()
    203 {
    204     m_asyncEventQueue.close();
    205 }
    206 
    207 } // namespace WebCore
    208 
    209177#endif
  • trunk/Source/WebCore/html/track/TrackListBase.h

    r233496 r234177  
    2828#if ENABLE(VIDEO_TRACK)
    2929
    30 #include "ActiveDOMObject.h"
     30#include "ContextDestructionObserver.h"
    3131#include "EventTarget.h"
    3232#include "GenericEventQueue.h"
     
    4040class TrackBase;
    4141
    42 class TrackListBase : public RefCounted<TrackListBase>, public EventTargetWithInlineData, public ActiveDOMObject {
     42class TrackListBase : public RefCounted<TrackListBase>, public EventTargetWithInlineData, public ContextDestructionObserver {
    4343public:
    4444    virtual ~TrackListBase();
     
    7575    void scheduleTrackEvent(const AtomicString& eventName, Ref<TrackBase>&&);
    7676
    77     bool canSuspendForDocumentSuspension() const final;
    78     void suspend(ReasonForSuspension) final;
    79     void resume() final;
    80     void stop() final;
    81 
    8277    // EventTarget
    8378    void refEventTarget() final { ref(); }
  • trunk/Source/WebCore/html/track/VideoTrackList.cpp

    r233496 r234177  
    9595}
    9696
    97 const char* VideoTrackList::activeDOMObjectName() const
    98 {
    99     return "VideoTrackList";
    100 }
    101 
    10297#endif
  • trunk/Source/WebCore/html/track/VideoTrackList.h

    r233496 r234177  
    5454private:
    5555    VideoTrackList(HTMLMediaElement*, ScriptExecutionContext*);
    56     const char* activeDOMObjectName() const final;
    5756};
    5857
  • trunk/Source/WebCore/html/track/VideoTrackList.idl

    r233496 r234177  
    2525
    2626[
    27     ActiveDOMObject,
    2827    Conditional=VIDEO_TRACK,
    2928    GenerateIsReachable=ImplElementRoot,
Note: See TracChangeset for help on using the changeset viewer.