Changeset 202590 in webkit


Ignore:
Timestamp:
Jun 28, 2016 2:35:37 PM (8 years ago)
Author:
ggaren@apple.com
Message:

CrashTracer beneath JSC::MarkedBlock::specializedSweep
https://bugs.webkit.org/show_bug.cgi?id=159223

Reviewed by Saam Barati.

This crash is caused by a media element re-entering JS during the GC
sweep phase.

In theory, other CachedResourceClients in the DOM might also trigger
similar bugs, but our data only implicates the media elements, so this
fix targets them.

  • html/HTMLDocument.h: Document has no reason to inherit from

CachedResourceClient. I found this becuase I had to search for all
CachedResourceClients in researching this patch.

  • platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:

(WebCore::WebCoreAVCFResourceLoader::invalidate): Delay our call to
stopLoading because it might re-enter JS, and we might have been called
by the GC sweep phase destroying a media element.

  • platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:

(WebCore::WebCoreAVFResourceLoader::invalidate): Ditto.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202588 r202590  
     12016-06-28  Geoffrey Garen  <ggaren@apple.com>
     2
     3        CrashTracer beneath JSC::MarkedBlock::specializedSweep
     4        https://bugs.webkit.org/show_bug.cgi?id=159223
     5
     6        Reviewed by Saam Barati.
     7
     8        This crash is caused by a media element re-entering JS during the GC
     9        sweep phase.
     10
     11        In theory, other CachedResourceClients in the DOM might also trigger
     12        similar bugs, but our data only implicates the media elements, so this
     13        fix targets them.
     14
     15        * html/HTMLDocument.h: Document has no reason to inherit from
     16        CachedResourceClient. I found this becuase I had to search for all
     17        CachedResourceClients in researching this patch.
     18
     19        * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
     20        (WebCore::WebCoreAVCFResourceLoader::invalidate): Delay our call to
     21        stopLoading because it might re-enter JS, and we might have been called
     22        by the GC sweep phase destroying a media element.
     23
     24        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
     25        (WebCore::WebCoreAVFResourceLoader::invalidate): Ditto.
     26
    1272016-06-28  Saam Barati  <sbarati@apple.com>
    228
  • trunk/Source/WebCore/html/HTMLDocument.h

    r197566 r202590  
    2424#define HTMLDocument_h
    2525
    26 #include "CachedResourceClient.h"
    2726#include "Document.h"
    2827#include <wtf/HashCountedSet.h>
     
    3029namespace WebCore {
    3130
    32 class HTMLDocument : public Document, public CachedResourceClient {
     31class HTMLDocument : public Document {
    3332public:
    3433    static Ref<HTMLDocument> create(Frame* frame, const URL& url)
  • trunk/Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp

    r196089 r202590  
    100100void WebCoreAVCFResourceLoader::invalidate()
    101101{
     102    if (!m_parent)
     103        return;
     104
    102105    m_parent = nullptr;
    103     stopLoading();
     106
     107    callOnMainThread([protectedThis = Ref<WebCoreAVCFResourceLoader>(*this)] () mutable {
     108        protectedThis->stopLoading();
     109    });
    104110}
    105111
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm

    r201615 r202590  
    9797void WebCoreAVFResourceLoader::invalidate()
    9898{
     99    if (!m_parent)
     100        return;
     101
    99102    m_parent = nullptr;
    100     stopLoading();
     103
     104    callOnMainThread([protectedThis = Ref<WebCoreAVFResourceLoader>(*this)] () mutable {
     105        protectedThis->stopLoading();
     106    });
    101107}
    102108
Note: See TracChangeset for help on using the changeset viewer.