Changeset 19405 in webkit


Ignore:
Timestamp:
Feb 5, 2007 9:07:47 AM (17 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 edited

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                 */
    159                 TInt GetSettingL(TInt aSettingID);
    160 
    161                 TBool AutoFormFillEnabledL();
    162                 TBool PasswordManagementEnabledL();
    163                
     159        TBool AutoFormFillEnabledL();
     160        TBool PasswordManagementEnabledL();
     161       
    164162
    165163        /*  Private Members  */
     
    167165    private :
    168166
    169                 CFormDataLoginStore*    iFormDataLoginStore;
    170                 CFormDataAutoFillStore* iFormDataAutoFillStore;
    171                 MBrCtlDialogsProvider*  iDialogProvider;  // not owed
    172                 CWebKitControl*                 iSettingsControler; // not owned
    173                 TKeyEvent iLastKeyEvent;
    174                 TEventCode iLastEventCode;
    175                
    176                 CCoeControl* iParent; // not owned
    177                
    178                 TRect iRect;  // parent's rect - used to position list box
    179                 HBufC* iUrl;  // url of current page
    180                 HBufC* iName; // field name of current input box
    181                                
     167        CFormDataLoginStore*    iFormDataLoginStore;
     168        CFormDataAutoFillStore* iFormDataAutoFillStore;
     169        CWebKitControl*         iSettingsControler; // not owned
     170        TKeyEvent iLastKeyEvent;
     171        TEventCode iLastEventCode;
     172       
     173        CCoeControl* iParent; // not owned
     174       
     175        TUint iAutoFormFillSetting;
     176        TRect iRect;  // parent's rect - used to position list box
     177        HBufC* iUrl;  // url of current page
     178        HBufC* iName; // field name of current input box
     179               
    182180    };
    183181
  • S60/branches/3.1m/WebKit/BrowserView/inc/WebKitControl.h

    r18817 r19405  
    147147        * returns instance of form data manager
    148148        */
    149         CFormDataManager& FormDataManagerHandlerL(CBrCtl& aBrCtl);
     149        CFormDataManager* FormDataManagerHandlerL(CBrCtl& aBrCtl);
    150150
    151151        /**
     
    528528        * @return A reference
    529529        */
    530         CFormDataManager& FormDataManagerL() const {
     530        CFormDataManager* FormDataManagerL() const {
    531531          return (CStaticObjectContainer::Instance().FormDataManagerHandlerL(*iBrCtl)); }
    532532
  • S60/branches/3.1m/WebKit/BrowserView/src/FormDataManager.cpp

    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.
     
    5353
    5454// CONSTANTS
     55const TBool KDefaultESettingsAutoFormFillEnabled = 2;
    5556
    5657// MACROS
     
    7071// Two-phased constructor.
    7172// -----------------------------------------------------------------------------
    72 CFormDataManager * CFormDataManager::NewL (CWebKitControl* aSettingsControler, MBrCtlDialogsProvider* aDialogProvider)
    73         {
    74         CFormDataManager* self = new (ELeave) CFormDataManager();
     73CFormDataManager * CFormDataManager::NewL(MBrCtlDialogsProvider* aDialogProvider)
     74    {
     75    CFormDataManager* self = new (ELeave) CFormDataManager();
    7576    CleanupStack::PushL(self);
    76     self->ConstructL(aSettingsControler, aDialogProvider);
     77    self->ConstructL(aDialogProvider);
    7778    CleanupStack::Pop(self);
    7879    return self;
     
    8384// C++ default constructor can NOT contain any code, that might leave.
    8485// -----------------------------------------------------------------------------
    85 CFormDataManager::CFormDataManager()
    86         {
    87 
    88         }
     86CFormDataManager::CFormDataManager() 
     87    : iAutoFormFillSetting(KDefaultESettingsAutoFormFillEnabled)
     88    {
     89    }
    8990
    9091// -----------------------------------------------------------------------------
     
    9293// Symbian 2nd phase constructor can leave.
    9394// -----------------------------------------------------------------------------
    94 void CFormDataManager::ConstructL(CWebKitControl* aSettingsControler, MBrCtlDialogsProvider* aDialogProvider)
    95     {
    96     iSettingsControler = aSettingsControler;
    97         iDialogProvider = aDialogProvider;
    98 
    99         iFormDataLoginStore = CFormDataLoginStore::NewL(iDialogProvider);
    100         iFormDataAutoFillStore = CFormDataAutoFillStore::NewL();
     95void CFormDataManager::ConstructL(MBrCtlDialogsProvider* aDialogProvider)
     96    {
     97    iFormDataLoginStore = CFormDataLoginStore::NewL(aDialogProvider);
     98    iFormDataAutoFillStore = CFormDataAutoFillStore::NewL();
    10199    }
    102100   
     
    106104CFormDataManager::~CFormDataManager()
    107105    {
    108         delete iFormDataLoginStore;
    109         delete iFormDataAutoFillStore;
    110         delete iUrl;
    111         delete iName;
     106    delete iFormDataLoginStore;
     107    delete iFormDataAutoFillStore;
     108    delete iUrl;
     109    delete iName;
    112110    }
    113111
     
    118116void CFormDataManager::SaveDataL (const TDesC& aUrl, const CArrayPtrFlat<CWebCoreFormDataElement>& aFormData)
    119117    {
    120         if (AutoFormFillEnabledL() && aFormData.Count() > 0)
    121                 {
    122                 if (PasswordManagementEnabledL() && HasPassword(aFormData))
    123                         {
    124                         iFormDataLoginStore->SaveDataL(aUrl, aFormData);
    125                         }                                       
    126                 iFormDataAutoFillStore->SaveData(aFormData);
    127                 }
    128     }
    129        
     118    if (AutoFormFillEnabledL() && aFormData.Count() > 0)
     119        {
     120        if (PasswordManagementEnabledL() && HasPassword(aFormData))
     121            {
     122            iFormDataLoginStore->SaveDataL(aUrl, aFormData);
     123            }                   
     124        iFormDataAutoFillStore->SaveData(aFormData);
     125        }
     126    }
     127   
    130128//-----------------------------------------------------------------------------
    131129// CFormDataManager::GetData
     
    136134   
    137135    if (AutoFormFillEnabledL())
    138                 {               
    139                 // check to see if input is a login field
    140                 if (PasswordManagementEnabledL() && aUrl.Length()>1 && iFormDataLoginStore->Exists(aUrl, aName))
    141                         {
    142                         aIsLogin = ETrue;
    143                         iFormDataLoginStore->GetDataL(aOptions, aUrl, aName);
    144                         }               
    145                 else
    146                         {
    147                         aIsLogin = EFalse;
    148                         iFormDataAutoFillStore->GetDataL(aOptions, aName);
    149                         }
    150                
    151                 }
     136        {       
     137        // check to see if input is a login field
     138        if (PasswordManagementEnabledL() && aUrl.Length()>1 && iFormDataLoginStore->Exists(aUrl, aName))
     139            {
     140            aIsLogin = ETrue;
     141            iFormDataLoginStore->GetDataL(aOptions, aUrl, aName);
     142            }       
     143        else
     144            {
     145            aIsLogin = EFalse;
     146            iFormDataAutoFillStore->GetDataL(aOptions, aName);
     147            }
     148       
     149        }
    152150
    153151    }
     
    158156//-----------------------------------------------------------------------------
    159157void CFormDataManager::SetKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aEventCode)
    160         {
    161         iLastKeyEvent = aKeyEvent;
    162         iLastEventCode = aEventCode;
    163         }
     158    {
     159    iLastKeyEvent = aKeyEvent;
     160    iLastEventCode = aEventCode;
     161    }
    164162void CFormDataManager::ClearKeyEvent()
    165         {
    166         iLastKeyEvent = TKeyEvent();
    167         iLastEventCode = TEventCode();
    168         }
     163    {
     164    iLastKeyEvent = TKeyEvent();
     165    iLastEventCode = TEventCode();
     166    }
    169167//-----------------------------------------------------------------------------
    170168// CFormDataManager::ResetPassword
     
    172170//-----------------------------------------------------------------------------
    173171void CFormDataManager::ResetPasswordL(CWebKitBridge& aWebKitBridge,
    174                                         const TDesC& aUrl, const TDesC& aName, const TDesC& aValue)
    175         {
    176         // set the password if this field is a username/login
    177         if (PasswordManagementEnabledL())
    178                 {
    179                 iFormDataLoginStore->SetPassword(aWebKitBridge, aUrl, aName, aValue);
    180                 }
    181         }
     172                    const TDesC& aUrl, const TDesC& aName, const TDesC& aValue)
     173    {
     174    // set the password if this field is a username/login
     175    if (PasswordManagementEnabledL())
     176        {
     177        iFormDataLoginStore->SetPassword(aWebKitBridge, aUrl, aName, aValue);
     178        }
     179    }
    182180
    183181//-----------------------------------------------------------------------------
     
    185183//-----------------------------------------------------------------------------
    186184void CFormDataManager::ClearLoginData()
    187         {
    188         iFormDataLoginStore->ClearData();
    189         }
     185    {
     186    iFormDataLoginStore->ClearData();
     187    }
    190188
    191189//-----------------------------------------------------------------------------
     
    193191//-----------------------------------------------------------------------------
    194192void CFormDataManager::ClearFormData()
    195         {
    196         iFormDataAutoFillStore->ClearData();
    197         }
     193    {
     194    iFormDataAutoFillStore->ClearData();
     195    }
    198196
    199197// private
     
    203201//-----------------------------------------------------------------------------
    204202TBool CFormDataManager::HasPassword(const CArrayPtrFlat<CWebCoreFormDataElement>& aFormData)
    205         {
    206         return (iFormDataLoginStore->PasswordIndex(aFormData)>-1);
    207         }
     203    {
     204    return (iFormDataLoginStore->PasswordIndex(aFormData)>-1);
     205    }
    208206
    209207//-----------------------------------------------------------------------------
     
    211209//-----------------------------------------------------------------------------
    212210TBool CFormDataManager::AutoFormFillEnabledL()
    213         {
    214         return (GetSettingL(TBrCtlDefs::ESettingsAutoFormFillEnabled) > 0);// 1 or 2
    215         }
    216        
     211    {
     212    return (iAutoFormFillSetting > 0);// 1 or 2
     213    }
     214   
    217215TBool CFormDataManager::PasswordManagementEnabledL()
    218         {
    219         return (GetSettingL(TBrCtlDefs::ESettingsAutoFormFillEnabled) == 2);// 2
    220         }
    221        
    222 TInt CFormDataManager::GetSettingL(TInt aSettingID)
    223         {
    224         TInt setting(0);  // default to 'off'
    225 
    226         // Only check the settings if the AutoFormFill Capability has been enabled
    227         if (iSettingsControler && (iSettingsControler->BrCtl().Capabilities() & TBrCtlDefs::ECapabilityAutoFormFill))
    228                 {
    229                 setting = iSettingsControler->GetBrowserSettingL(aSettingID);
    230                 }
    231         return setting;
    232         }
    233        
    234        
     216    {
     217    return (iAutoFormFillSetting == 2);// 2
     218    }
     219   
     220   
     221   
    235222//  End of File
  • S60/branches/3.1m/WebKit/BrowserView/src/WebKitControl.cpp

    r19081 r19405  
    443443//
    444444//-------------------------------------------------------------------------------
    445 CFormDataManager& CStaticObjectContainer::FormDataManagerHandlerL(CBrCtl& aBrCtl)
    446   {
    447   if (!iFormDataManager)
    448     {
    449       // Create data manager for auto form fill
    450       iFormDataManager = CFormDataManager::NewL(aBrCtl.WebKitControl(),aBrCtl.BrCtlDialogsProvider());
    451     }
    452   return *iFormDataManager;
     445CFormDataManager* CStaticObjectContainer::FormDataManagerHandlerL(CBrCtl& aBrCtl)
     446    {
     447    if (aBrCtl.Capabilities() & TBrCtlDefs::ECapabilityAutoFormFill && !iFormDataManager)
     448        {
     449        // Create data manager for auto form fill
     450        iFormDataManager = CFormDataManager::NewL(aBrCtl.BrCtlDialogsProvider());
     451        }
     452    return iFormDataManager;
    453453    }
    454454
     
    739739        case TBrCtlDefs::ESettingsLaunchViewId:
    740740        case TBrCtlDefs::ESettingsLaunchCustomMessageId:
    741         case TBrCtlDefs::ESettingsAutoFormFillEnabled:
    742741        case TBrCtlDefs::ESettingsApId:
    743742            {
     
    747746            break;
    748747            }
    749 
     748        case TBrCtlDefs::ESettingsAutoFormFillEnabled:
     749            {
     750            if (FormDataManagerL())
     751                {
     752                FormDataManagerL()->SetAutoFormFillEnabled( aValue );
     753                }
     754            break;
     755            }
    750756        // Descriptor setting values
    751757        // case : <-- none yet
     
    817823        case TBrCtlDefs::ESettingsLaunchViewId:
    818824        case TBrCtlDefs::ESettingsLaunchCustomMessageId:
    819         case TBrCtlDefs::ESettingsAutoFormFillEnabled:
    820825        case TBrCtlDefs::ESettingsApId:
    821826            {
     
    829834            //    TBrCtlDefs::TBrCtlSettings( aSetting )).DesValue();
    830835            // break;
     836        case TBrCtlDefs::ESettingsAutoFormFillEnabled:
     837            {
     838            retVal = 0;
     839            if (FormDataManagerL())
     840                {
     841                retVal = FormDataManagerL()->AutoFormFillEnabled();
     842                }
     843            break;
     844            }
    831845        case TBrCtlDefs::ESettingsCurrentZoomLevelIndex:
    832846            {
  • S60/branches/3.1m/WebKit/BrowserView/src/webkitbridge.cpp

    r19177 r19405  
    718718    const CArrayPtrFlat<CWebCoreFormDataElement>& aFormValues )
    719719    {
    720   TRAP_IGNORE(iFrame->WebKitView().WebKitControl().FormDataManagerL().SaveDataL(RequestedURLString(),aFormValues));
     720    TRAP_IGNORE(
     721        CFormDataManager* formManager = iFrame->WebKitView().WebKitControl().FormDataManagerL();
     722        if (formManager)
     723            {
     724            formManager->SaveDataL(RequestedURLString(),aFormValues);
     725            }
     726        );
    721727    }
    722728
  • S60/branches/3.1m/WebKit/ChangeLog

    r19404 r19405  
     1bujtas  <zbujtas@gmail.com>, 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. change the order of destroying webkit objects.
     5        2. cancel parsing when the document is being closed
     6        3. flush static image decoder queue. remove images associated with the the view being destroyed
     7        4. remove formfill dependency on webkitcontrol. formfill is static object while webkitcontrol is per window.
     8        5. do not create formfill manager unless browser capabilities say so
     9       
     10        http://bugs.webkit.org/show_bug.cgi?id=12542
     11
     12        * BrowserControl/src/BrCtl.cpp:
     13        (CBrCtl::~CBrCtl):
     14        (CBrCtl::HandleCommandL):
     15        * BrowserCore/Formcontrols/src/FControlInputSkin.cpp:
     16        (CFormInputSkin::SetText):
     17        (CFormInputSkin::ActivateL):
     18        (CFormInputSkin::UpdatePopupL):
     19        * BrowserCore/Renderers/inc/ImageRenderer.h:
     20        (CImageRenderer::View):
     21        * BrowserCore/Renderers/inc/ImageRendererFactory.h:
     22        * BrowserCore/Renderers/inc/StaticImageDecoder.h:
     23        * BrowserCore/Renderers/src/ImageRendererFactory.cpp:
     24        (CImageRendererFactory::RemoveImagesInView):
     25        * BrowserCore/Renderers/src/StaticImageDecoder.cpp:
     26        (CRawData::NewL):
     27        (CRawData::ConstructL):
     28        (CStaticImageDecoder::~CStaticImageDecoder):
     29        (CStaticImageDecoder::StartLoading):
     30        (CStaticImageDecoder::StopObserving):
     31        (CStaticImageDecoder::StopAllDecoding):
     32        (CStaticImageDecoder::RemoveImagesInView):
     33        * BrowserView/inc/FormDataManager.h:
     34        (CFormDataManager::CFormDataManager::LastKeyEvent):
     35        (CFormDataManager::CFormDataManager::LastEventCode):
     36        (CFormDataManager::SetAutoFormFillEnabled):
     37        (CFormDataManager::AutoFormFillEnabled):
     38        * BrowserView/inc/WebKitControl.h:
     39        (CWebKitControl::FormDataManagerL):
     40        * BrowserView/src/FormDataManager.cpp:
     41        (CFormDataManager::NewL):
     42        (CFormDataManager::CFormDataManager):
     43        (CFormDataManager::ConstructL):
     44        (CFormDataManager::~CFormDataManager):
     45        (CFormDataManager::SaveDataL):
     46        (CFormDataManager::GetDataL):
     47        (CFormDataManager::SetKeyEvent):
     48        (CFormDataManager::ClearKeyEvent):
     49        (CFormDataManager::ResetPasswordL):
     50        (CFormDataManager::ClearLoginData):
     51        (CFormDataManager::ClearFormData):
     52        (CFormDataManager::HasPassword):
     53        (CFormDataManager::AutoFormFillEnabledL):
     54        (CFormDataManager::PasswordManagementEnabledL):
     55        * BrowserView/src/WebKitControl.cpp:
     56        (CStaticObjectContainer::FormDataManagerHandlerL):
     57        (CWebKitControl::SetBrowserSettingL):
     58        (CWebKitControl::GetBrowserSettingL):
     59        * BrowserView/src/webkitbridge.cpp:
     60        (CWebKitBridge::SaveFormData):
     61
    162raalexan, Reviewed by Yongjun Zhang.
    263        DESC: Enhanced Input feature not working in 3.1 [TSW TMCN-6XYSLY]
Note: See TracChangeset for help on using the changeset viewer.