Changeset 19405

Show
Ignore:
Timestamp:
02/05/07 09:07:47 (2 years ago)
Author:
brmorris
Message:

bujtas <zbujtas@gmail.com>, reviewed by Yongjun.

DESC: browser is crashing if it is closed while a page is loading and closing and opening a new window crashes the browser as well TMCN-6XRQP2
fix:

  1. change the order of destroying webkit objects.
  2. cancel parsing when the document is being closed
  3. flush static image decoder queue. remove images associated with the the view being destroyed
  4. remove formfill dependency on webkitcontrol. formfill is static object while webkitcontrol is per window.
  5. do not create formfill manager unless browser capabilities say so


http://bugs.webkit.org/show_bug.cgi?id=12542

Location:
S60/branches/3.1m
Files:
19 modified

Legend:

Unmodified
Added
Removed
  • S60/branches/3.1m/WebCore/ChangeLog

    r19372 r19405  
     1bujtas, Reviewed by yongjun. 
     2        DESC: browser is crashing if it is closed while a page is loading and closing and opening a new window crashes the browser as well TMCN-6XRQP2  
     3        fix:  
     4        1. cancel parsing when the document is being closed 
     5        2. flush static image decoder queue. remove images associated with the the view being destroyed 
     6         
     7        http://bugs.webkit.org/show_bug.cgi?id=12542 
     8 
     9        * bridge/WebCoreBridge.cpp: 
     10        (CWebCoreBridge::RemoveFromFrame): 
     11        * bridge/WebCoreImageRendererFactory.h: 
     12        * khtml/khtml_part.cpp: 
     13        (KHTMLPart::clear): 
     14        * khtml/xml/dom_docimpl.cpp: 
     15        (DocumentImpl::cancelParsing): 
     16        * khtml/xml/dom_docimpl.h: 
     17 
    118yongjzha, Reviewed by zalan. 
    219        DESC: backport google.com/ig refreshing memory leak fix in <http://bugs.webkit.org/show_bug.cgi?id=10773> PPEN-6QYG7L 
  • S60/branches/3.1m/WebCore/bridge/WebCoreBridge.cpp

    r19309 r19405  
    8383 
    8484#include "WebCoreImageRenderer.h" 
     85#include "WebCoreImageRendererFactory.h" 
    8586//#include "WebCoreTextRendererFactory.h" 
    8687//#include "WebCoreViewFactory.h" 
     
    863864        iPart->view()->setView(0); 
    864865    iPart->setView(0); 
    865  
    866866    // tell image renderers this frame does not exist any more 
    867     MWebCoreScrollView* view = &Client().DocumentView(); 
    868     QDictIterator<khtml::CachedObject> it( *khtml::Cache::cache ); 
    869     khtml::CachedObject* o = 0; 
    870     while( ( o = it.current() ) != NULL ) { 
    871         if( o->type() == khtml::CachedObject::Image ) { 
    872             const QPixmap& pm = static_cast<khtml::CachedImage *>(o)->pixmap(); 
    873             if (pm.image()) 
    874                 pm.image()->RemoveFromScrollView(view); 
    875         } 
    876         ++it; 
    877     } 
     867    TWebCoreImageRendererFactory::Factory()->RemoveImagesInView( Client().DocumentView() ); 
    878868} 
    879869 
  • S60/branches/3.1m/WebCore/bridge/WebCoreImageRendererFactory.h

    r14549 r19405  
    4343 
    4444class MWebCoreImageRenderer; 
     45class MWebCoreScrollView; 
    4546 
    4647// CLASS DECLARATION 
     
    6162        virtual MWebCoreImageRenderer* ImageRendererWithName(const TDesC& aName) = 0; 
    6263        virtual CArrayFix<TPtrC>* SupportedMIMETypes() = 0; 
     64        virtual void RemoveImagesInView(MWebCoreScrollView& aView) = 0; 
    6365        //  virtual int CGCompositeOperationInContext((CGContextRef)context); 
    6466        //    virtual void setCGCompositeOperation((int)op, (CGContextRef)context ) = 0; 
  • S60/branches/3.1m/WebCore/khtml/khtml_part.cpp

    r19372 r19405  
    10951095 
    10961096 
    1097   if ( d->m_doc ) 
    1098     d->m_doc->detach(); 
    1099  
     1097  if ( d->m_doc ) {     
     1098    d->m_doc->cancelParsing(); 
     1099    d->m_doc->detach();     
     1100    } 
    11001101  // Moving past doc so that onUnload works. 
    11011102  if ( d->m_jscript ) 
  • S60/branches/3.1m/WebCore/khtml/xml/dom_docimpl.cpp

    r16142 r19405  
    15091509} 
    15101510 
     1511void DocumentImpl::cancelParsing() 
     1512{ 
     1513    if (m_tokenizer) { 
     1514        // We have to clear the tokenizer to avoid possibly triggering 
     1515        // the onload handler when closing as a side effect of a cancel-style 
     1516        // change, such as opening a new document or closing the window while 
     1517        // still parsing 
     1518        delete m_tokenizer; 
     1519        m_tokenizer = 0; 
     1520        close(); 
     1521    } 
     1522} 
     1523 
    15111524void DocumentImpl::implicitOpen() 
    15121525{ 
  • S60/branches/3.1m/WebCore/khtml/xml/dom_docimpl.h

    r16142 r19405  
    314314 
    315315    void open(); 
     316    void cancelParsing(); 
    316317    void implicitOpen(); 
    317318    void close(); 
  • S60/branches/3.1m/WebKit/BrowserControl/src/BrCtl.cpp

    r17964 r19405  
    396396EXPORT_C CBrCtl::~CBrCtl() 
    397397    { 
     398    // Delete our internal support 
     399    if(iWmlEngineInterface) 
     400        { 
     401        delete iWmlEngineInterface; 
     402        iLibrary.Close(); 
     403        } 
     404 
     405    delete iWKWmlInterface; 
     406 
     407    //Delete the WebkitControl 
     408    delete iWebKitControl; 
     409     
    398410    delete iSelfContentTypes; 
    399411    iLoadEventObserversArray.Reset(); 
     
    455467    ResetSubscribeToItems(); 
    456468 
    457     // Delete our internal support 
    458     if(iWmlEngineInterface) 
    459         { 
    460         delete iWmlEngineInterface; 
    461         iLibrary.Close(); 
    462         } 
    463  
    464     delete iWKWmlInterface; 
    465  
    466     //Delete the WebkitControl 
    467     delete iWebKitControl; 
    468      
    469469    // close the arrays, avoid memory leaks 
    470470    iLoadEventObserversArray.Close(); 
     
    822822        case TBrCtlDefs::ECommandClearAutoFormFillData: 
    823823            { 
    824             iWebKitControl->FormDataManagerL().ClearFormData(); 
     824            if (iWebKitControl->FormDataManagerL()) 
     825                { 
     826                iWebKitControl->FormDataManagerL()->ClearFormData(); 
     827                } 
    825828            break; 
    826829            } 
    827830        case TBrCtlDefs::ECommandClearAutoFormFillPasswordData: 
    828831            { 
    829             iWebKitControl->FormDataManagerL().ClearLoginData(); 
     832            if (iWebKitControl->FormDataManagerL()) 
     833                { 
     834                iWebKitControl->FormDataManagerL()->ClearLoginData(); 
     835                } 
    830836            break; 
    831837            } 
  • S60/branches/3.1m/WebKit/BrowserCore/Formcontrols/src/FControlInputSkin.cpp

    r18159 r19405  
    524524    // repaint the rect 
    525525    InvalidateRect(); 
    526   if( iName && iData && iParent && !TWebCoreLoaderContainer::LoaderContainer()->BrowserEmbedded()) 
    527     { 
    528     CWebKitFrame* webkitFrame = static_cast<CWebKitFrame*>(iParent); 
    529     TRAP_IGNORE(webkitFrame->WebKitView().WebKitControl().FormDataManagerL().ResetPasswordL(webkitFrame->WebKitBridge(), 
    530                                   webkitFrame->WebKitBridge().RequestedURLString(), 
    531                                   iName->Des(), 
    532                                   iData->Des())); 
    533     } 
     526    if( iName && iData && iParent && !TWebCoreLoaderContainer::LoaderContainer()->BrowserEmbedded()) 
     527        { 
     528        CWebKitFrame* webkitFrame = static_cast<CWebKitFrame*>(iParent); 
     529        TRAP_IGNORE(  
     530            CFormDataManager* formManager = webkitFrame->WebKitView().WebKitControl().FormDataManagerL(); 
     531            if (formManager) 
     532                { 
     533                formManager->ResetPasswordL( webkitFrame->WebKitBridge(),webkitFrame->WebKitBridge().RequestedURLString(), 
     534                    iName->Des(),iData->Des()); 
     535                } 
     536            );     
     537        } 
    534538    } 
    535539 
     
    726730        if(!TWebCoreLoaderContainer::LoaderContainer()->BrowserEmbedded()) 
    727731            { 
    728             TRAP_IGNORE(iFormDataManager = &webkitFrame->WebKitView().WebKitControl().FormDataManagerL()); 
     732            TRAP_IGNORE(iFormDataManager = webkitFrame->WebKitView().WebKitControl().FormDataManagerL()); 
    729733            } 
    730734 
     
    951955        iOptions = new (ELeave)CArrayPtrFlat<COptionData>(10); 
    952956        TBool isLogin = EFalse; 
    953         if (iName) 
     957        if (iName && iFormDataManager) 
    954958            { 
    955959            iFormDataManager->GetDataL(*iOptions, 
  • S60/branches/3.1m/WebKit/BrowserCore/Renderers/inc/ImageRenderer.h

    r14725 r19405  
    188188        * @return TBool 
    189189        */ 
    190     TBool IsAnimation(); 
    191  
    192         /** 
    193         * 
    194         * @since 3.1 
    195         * @param 
    196         * @return 
    197     */ 
    198     void resetLoopCount(); 
     190        TBool IsAnimation(); 
     191 
     192        /** 
     193        * 
     194        * @since 3.1 
     195        * @param 
     196        * @return 
     197        */ 
     198        void resetLoopCount(); 
    199199 
    200200        /** 
     
    203203        * @param 
    204204        * @return callback wrapper 
    205     */ 
     205        */ 
    206206        CWebCoreImageCallbackWrapper* InitCallbackWrapper(); 
    207207 
     
    211211        * @param 
    212212        * @return image raw data 
    213     */ 
     213        */ 
    214214        TPtrC8 GetRawData(); 
    215215 
     
    224224#endif 
    225225 
    226     private: // MBitmapScalingQueueObserver 
    227  
    228         void ScalingCompletedL(CMaskedBitmap*& aResultBitmap, const TRect& aTargetRect); 
    229  
    230     private: // MAnimationDecoderObserver 
     226    public: // MAnimationDecoderObserver 
    231227 
    232228        void DecoderError( TInt aError ); 
     
    236232        void StartAnimationDecoder(); 
    237233 
     234    private: // MBitmapScalingQueueObserver 
     235 
     236        void ScalingCompletedL(CMaskedBitmap*& aResultBitmap, const TRect& aTargetRect); 
     237 
    238238    public: 
    239239        void NextFrame(); 
    240240 
    241241        void LoadCannedImageL(TInt aImageId); 
     242         
     243        MWebCoreScrollView* View() const { return iView; } 
    242244 
    243245    private: 
  • S60/branches/3.1m/WebKit/BrowserCore/Renderers/inc/ImageRendererFactory.h

    r14725 r19405  
    161161        void SetSaveImageData( TBool aSave )        { iSaveImageData = aSave; }  
    162162        TBool NeedSaveImageData()                   { return iSaveImageData; } 
     163        void RemoveImagesInView(MWebCoreScrollView& aView); 
    163164    public: 
    164165 
  • S60/branches/3.1m/WebKit/BrowserCore/Renderers/inc/StaticImageDecoder.h

    r17370 r19405  
    2929class TFrameInfo; 
    3030class CBufferedImageDecoder; 
     31class CImageRenderer; 
     32class MWebCoreScrollView; 
    3133 
    3234struct CRawData : public CBase 
    3335    { 
    3436    static CRawData* NewL( const TDesC8& aData, TDesC* aMime,  
    35            CMaskedBitmap* aTarget, MAnimationDecoderObserver* aObserv ); 
     37           CMaskedBitmap* aTarget, CImageRenderer* aObserv ); 
    3638    virtual ~CRawData(); 
    3739 
    3840    CRawData() : iData(0), iDataPtr(0,0), iMime(0), iTarget(0), iObserver(0) {} 
    3941    void ConstructL(const TDesC8& aData, TDesC* aMime,  
    40         CMaskedBitmap* aTarget, MAnimationDecoderObserver* aObserv ); 
     42        CMaskedBitmap* aTarget, CImageRenderer* aObserv ); 
    4143     
    4244    TAny*           iData; 
     
    4446    HBufC8*         iMime; 
    4547    CMaskedBitmap*  iTarget; 
    46     MAnimationDecoderObserver* iObserver; 
     48    CImageRenderer* iObserver; 
    4749    }; 
    4850 
     
    6567        // decode the image asynchorously 
    6668        TBool DecodeL( CRawData* aData  ); 
    67         void StopObserving( MAnimationDecoderObserver* aObserv ); 
     69        void StopObserving( CImageRenderer* aObserv ); 
    6870         
    6971        // from CActive 
     
    7375        // for image memory collector 
    7476        void StopAllDecoding(); 
     77        // flush decoder queue 
     78        void RemoveImagesInView(MWebCoreScrollView& aView); 
    7579         
    7680    private: 
  • S60/branches/3.1m/WebKit/BrowserCore/Renderers/src/ImageRendererFactory.cpp

    r17370 r19405  
    340340    } 
    341341 
     342// ----------------------------------------------------------------------------- 
     343// flush image decoder's queue when a view is destroyed 
     344// ----------------------------------------------------------------------------- 
     345// 
     346void CImageRendererFactory::RemoveImagesInView(MWebCoreScrollView& aView) 
     347    { 
     348    CStaticObjectContainer::Instance().StaticImageDecoder().RemoveImagesInView(aView); 
     349    } 
     350 
    342351#ifdef __OOM__ 
    343352// ----------------------------------------------------------------------------- 
  • S60/branches/3.1m/WebKit/BrowserCore/Renderers/src/StaticImageDecoder.cpp

    r17370 r19405  
    1919 
    2020#include "StaticImageDecoder.h" 
     21#include "ImageRenderer.h" 
    2122#include "MaskedBitmap.h" 
    2223#include <imageconversion.h> 
     
    4041// CRawData 
    4142//============================================================================= 
    42 CRawData* CRawData::NewL( const TDesC8& aData, TDesC* aMime, CMaskedBitmap* aTarget, MAnimationDecoderObserver* aObserv ) 
     43CRawData* CRawData::NewL( const TDesC8& aData, TDesC* aMime, CMaskedBitmap* aTarget, CImageRenderer* aObserv ) 
    4344    { 
    4445    CRawData* self = new (ELeave) CRawData(); 
     
    4950    } 
    5051 
    51 void CRawData::ConstructL( const TDesC8& aData, TDesC* aMIMEType, CMaskedBitmap* aTarget, MAnimationDecoderObserver* aObserv ) 
     52void CRawData::ConstructL( const TDesC8& aData, TDesC* aMIMEType, CMaskedBitmap* aTarget, CImageRenderer* aObserv ) 
    5253    { 
    5354    // mime type 
     
    9899CStaticImageDecoder::~CStaticImageDecoder() 
    99100    { 
     101    Cancel(); 
    100102     
    101103    iQueue.Reset(); 
    102104    delete iDecoder; 
    103105    iContext = 0; 
    104      
    105     if (IsActive()) 
    106         {         
    107         Cancel(); 
    108         } 
    109106    } 
    110107 
     
    212209        { 
    213210        // initalize decoding 
    214       TRequestStatus* status = &iStatus; 
     211        TRequestStatus* status = &iStatus; 
    215212        User::RequestComplete( status, 0 ); 
    216213        SetActive(); 
     
    268265    } 
    269266     
    270 void CStaticImageDecoder::StopObserving( MAnimationDecoderObserver* aObserv ) 
     267void CStaticImageDecoder::StopObserving( CImageRenderer* aObserv ) 
    271268    { 
    272269    // fast check 
     
    343340    } 
    344341 
     342void CStaticImageDecoder::RemoveImagesInView(MWebCoreScrollView& aView) 
     343    { 
     344    // aView is about to be destroyed. remove all the images from the decoding queue  
     345    // that are in that view 
     346    for (TInt i=iQueue.Count()-1; i>=0; --i) 
     347        { 
     348        if (iQueue[i]->iObserver && iQueue[i]->iObserver->View() == &aView ) 
     349            { 
     350            if (i==0) 
     351                { 
     352                // cancel decoding 
     353                Cancel(); 
     354                // start on the next 
     355                StartLoading(); 
     356                } 
     357            iQueue[i]->iObserver->DecoderError(KErrCancel); 
     358            iQueue.Remove(i); 
     359            } 
     360        } 
     361    } 
     362 
    345363// END OF FILE 
  • S60/branches/3.1m/WebKit/BrowserView/inc/FormDataManager.h

    r14549 r19405  
    1010*    All rights reserved. 
    1111 
    12      Redistribution and use in source and binary forms, with or without 
    13      modification, are permitted provided that the following conditions 
    14      are met: 
     12 Redistribution and use in source and binary forms, with or without 
     13 modification, are permitted provided that the following conditions 
     14 are met: 
    1515 
    1616*      * Redistributions of source code must retain the above copyright 
     
    2424*        from this software without specific prior written permission. 
    2525 
    26      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    27      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    28      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    29      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    30      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    31      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    32      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
    33      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
    34      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    35      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
    36      USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    37      DAMAGE. 
     26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
     36 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
     37 DAMAGE. 
    3838 
    3939*    Please see file patentlicense.txt for further grants. 
     
    8888        * @return CFormDataManager * 
    8989        */ 
    90         static CFormDataManager* NewL(CWebKitControl* aSettingsControler, MBrCtlDialogsProvider* aDialogProvider); 
     90        static CFormDataManager* NewL(MBrCtlDialogsProvider* aDialogProvider); 
    9191 
    9292        /** 
     
    105105 
    106106 
    107                 /** 
    108                 * Hold key event if input widget was activated by pressing a char 
    109                 */ 
    110                 void CFormDataManager::SetKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aEventCode); 
    111                 void CFormDataManager::ClearKeyEvent(); 
    112                 TKeyEvent CFormDataManager::LastKeyEvent( ) { return iLastKeyEvent; } 
    113                 TEventCode CFormDataManager::LastEventCode( ) { return iLastEventCode; } 
     107        /** 
     108        * Hold key event if input widget was activated by pressing a char 
     109        */ 
     110        void CFormDataManager::SetKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aEventCode); 
     111        void CFormDataManager::ClearKeyEvent(); 
     112        TKeyEvent CFormDataManager::LastKeyEvent( ) { return iLastKeyEvent; } 
     113        TEventCode CFormDataManager::LastEventCode( ) { return iLastEventCode; } 
    114114 
    115115 
    116                 /** 
    117                 * Clear the saved login data 
    118                 */ 
    119                 void ClearLoginData (); 
     116        /** 
     117        * Clear the saved login data 
     118        */ 
     119        void ClearLoginData (); 
    120120 
    121                 /** 
    122                 * Clear the saved form data 
    123                 */ 
    124                 void ClearFormData (); 
     121        /** 
     122        * Clear the saved form data 
     123        */ 
     124        void ClearFormData (); 
    125125 
    126                 /** 
    127                 * Update password field when login has been entered 
    128                 */ 
    129                 void ResetPasswordL(CWebKitBridge& aWebKitBridge,  
    130                                                 const TDesC& aUrl, const TDesC& aName, const TDesC& aValue); 
     126        void SetAutoFormFillEnabled( TUint aAutoFormFillSetting ) { iAutoFormFillSetting = aAutoFormFillSetting; } 
     127        TUint AutoFormFillEnabled() const { return iAutoFormFillSetting; } 
     128 
     129        /** 
     130        * Update password field when login has been entered 
     131        */ 
     132        void ResetPasswordL(CWebKitBridge& aWebKitBridge,  
     133                        const TDesC& aUrl, const TDesC& aName, const TDesC& aValue); 
    131134 
    132135        /** 
    133136        * Destructor 
    134137        */ 
    135         ~CFormDataManager(); 
     138        virtual ~CFormDataManager(); 
    136139         
    137140 
     
    141144        * By default Symbian 2nd phase constructor is private. 
    142145        */ 
    143         void ConstructL(CWebKitControl* aSettingsControler, MBrCtlDialogsProvider* aDialogProvider); 
     146        void ConstructL(MBrCtlDialogsProvider* aDialogProvider); 
    144147 
    145148 
    146                 /** 
    147                 *  Default constructor 
    148                 */ 
    149                 CFormDataManager(); 
    150                  
    151                 /** 
    152                 * return true if any field is a password field 
    153                 */ 
    154                 TBool HasPassword(const CArrayPtrFlat<CWebCoreFormDataElement>& aFormData); 
     149        /** 
     150        *  Default constructor 
     151        */ 
     152        CFormDataManager(); 
     153         
     154        /** 
     155        * return true if any field is a password field 
     156        */ 
     157        TBool HasPassword(const CArrayPtrFlat<CWebCoreFormDataElement>& aFormData); 
    155158 
    156                 /** 
    157                 * Return Browser setting 
    158 &n