Changeset 102829 in webkit


Ignore:
Timestamp:
Dec 14, 2011 2:52:08 PM (12 years ago)
Author:
beidson@apple.com
Message:

<rdar://problem/10576732> and https://bugs.webkit.org/show_bug.cgi?id=74533
REGRESSION(r102619): Reproducible crash closing window with video + poster image inside an object element

Reviewed by Darin Adler.

Source/WebCore:

Test: media/crash-closing-page-with-media-as-plugin-fallback.html

Switch HTMLPlugInImageElement from using document activation callbacks to using the ActiveDOMObject
mechanism which will prevent the unnecessary (and crashy) work at Document teardown:

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
(WebCore::HTMLPlugInImageElement::canSuspend):
(WebCore::HTMLPlugInImageElement::suspend):
(WebCore::HTMLPlugInImageElement::resume):

  • html/HTMLPlugInImageElement.h:

LayoutTests:

  • media/crash-closing-page-with-media-as-plugin-fallback-expected.txt: Added.
  • media/crash-closing-page-with-media-as-plugin-fallback.html: Added.
  • media/resources/video-with-poster-as-object-fallback.html: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102820 r102829  
     12011-12-14  Brady Eidson  <beidson@apple.com>
     2
     3        <rdar://problem/10576732> and https://bugs.webkit.org/show_bug.cgi?id=74533
     4        REGRESSION(r102619): Reproducible crash closing window with video + poster image inside an object element
     5
     6        Reviewed by Darin Adler.
     7
     8        * media/crash-closing-page-with-media-as-plugin-fallback-expected.txt: Added.
     9        * media/crash-closing-page-with-media-as-plugin-fallback.html: Added.
     10        * media/resources/video-with-poster-as-object-fallback.html: Added.
     11
    1122011-12-14  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r102828 r102829  
     12011-12-14  Brady Eidson  <beidson@apple.com>
     2
     3        <rdar://problem/10576732> and https://bugs.webkit.org/show_bug.cgi?id=74533
     4        REGRESSION(r102619): Reproducible crash closing window with video + poster image inside an object element
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: media/crash-closing-page-with-media-as-plugin-fallback.html
     9
     10        Switch HTMLPlugInImageElement from using document activation callbacks to using the ActiveDOMObject
     11        mechanism which will prevent the unnecessary (and crashy) work at Document teardown:
     12        * html/HTMLPlugInImageElement.cpp:
     13        (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
     14        (WebCore::HTMLPlugInImageElement::canSuspend):
     15        (WebCore::HTMLPlugInImageElement::suspend):
     16        (WebCore::HTMLPlugInImageElement::resume):
     17        * html/HTMLPlugInImageElement.h:
     18
    1192011-12-14  Adrienne Walker  <enne@google.com>
    220
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r102619 r102829  
    3838HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Document* document, bool createdByParser, PreferPlugInsForImagesOption preferPlugInsForImagesOption)
    3939    : HTMLPlugInElement(tagName, document)
     40    , ActiveDOMObject(document, this)
    4041    // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay
    4142    // widget updates until after all children are parsed.  For HTMLEmbedElement
     
    203204}
    204205
    205 void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
    206 {
    207     if (m_needsDocumentActivationCallbacks)
    208         document()->unregisterForDocumentActivationCallbacks(this);
    209 
    210     if (m_imageLoader)
    211         m_imageLoader->elementWillMoveToNewOwnerDocument();
    212 
    213     HTMLPlugInElement::willMoveToNewOwnerDocument();
    214 }
    215 
    216 void HTMLPlugInImageElement::didMoveToNewOwnerDocument()
    217 {
    218     if (m_needsDocumentActivationCallbacks)
    219         document()->registerForDocumentActivationCallbacks(this);   
    220    
    221     HTMLPlugInElement::didMoveToNewOwnerDocument();
    222 }
    223 
    224 void HTMLPlugInImageElement::documentWillBecomeInactive()
    225 {
     206bool HTMLPlugInImageElement::canSuspend() const
     207{
     208    return true;
     209}
     210
     211void HTMLPlugInImageElement::suspend(ReasonForSuspension reason)
     212{
     213    if (reason != DocumentWillBecomeInactive)
     214        return;
     215
    226216    if (RenderStyle* rs = renderStyle()) {
    227217        m_customStyleForPageCache = RenderStyle::clone(rs);
     
    233223    if (m_customStyleForPageCache)
    234224        recalcStyle(Force);
    235        
    236     HTMLPlugInElement::documentWillBecomeInactive();
    237 }
    238 
    239 void HTMLPlugInImageElement::documentDidBecomeActive()
     225}
     226
     227void HTMLPlugInImageElement::resume()
    240228{
    241229    clearHasCustomStyleForRenderer();
     
    245233        recalcStyle(Force);
    246234    }
    247    
    248     HTMLPlugInElement::documentDidBecomeActive();
    249235}
    250236
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.h

    r102628 r102829  
    2222#define HTMLPlugInImageElement_h
    2323
     24#include "ActiveDOMObject.h"
    2425#include "HTMLPlugInElement.h"
    25 
    2626#include "RenderStyle.h"
    2727#include <wtf/OwnPtr.h>
     
    4343
    4444// Base class for HTMLObjectElement and HTMLEmbedElement
    45 class HTMLPlugInImageElement : public HTMLPlugInElement {
     45class HTMLPlugInImageElement : public HTMLPlugInElement, public ActiveDOMObject {
    4646public:
    4747    virtual ~HTMLPlugInImageElement();
     
    5454    const String& url() const { return m_url; }
    5555    bool shouldPreferPlugInsForImages() const { return m_shouldPreferPlugInsForImages; }
    56 
     56   
    5757protected:
    5858    HTMLPlugInImageElement(const QualifiedName& tagName, Document*, bool createdByParser, PreferPlugInsForImagesOption);
     
    7474    bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
    7575
    76     virtual void willMoveToNewOwnerDocument() OVERRIDE;
    77     virtual void didMoveToNewOwnerDocument() OVERRIDE;
    78    
    79     virtual void documentWillBecomeInactive() OVERRIDE;
    80     virtual void documentDidBecomeActive() OVERRIDE;
     76    virtual bool canSuspend() const OVERRIDE;
     77    virtual void suspend(ReasonForSuspension) OVERRIDE;
     78    virtual void resume() OVERRIDE;
    8179
    8280    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
Note: See TracChangeset for help on using the changeset viewer.