fix cerfificate popup crash and TC fail
authorSeongjun Yim <se201.yim@samsung.com>
Wed, 31 Jul 2013 07:39:54 +0000 (16:39 +0900)
committerSeongjun Yim <se201.yim@samsung.com>
Wed, 31 Jul 2013 08:06:49 +0000 (17:06 +0900)
Change-Id: I1204e77175b9c14521b038532de684787e45cc0f
Signed-off-by: Seongjun Yim <se201.yim@samsung.com>
src/FWeb_WebBookmarkImpl.cpp
src/controls/FWebCtrl_CertificateConfirmPopup.cpp
src/controls/FWebCtrl_WebImpl.cpp
src/controls/inc/FWebCtrl_CertificateConfirmPopup.h

index 7af48da..f456449 100755 (executable)
@@ -72,6 +72,7 @@ _WebBookmarkImpl::_WebBookmarkImpl(void)
 
 _WebBookmarkImpl::~_WebBookmarkImpl(void)
 {
+       __bookmarkList.RemoveAll(true);
 }
 
 
index 8308dd3..d03d6e0 100755 (executable)
@@ -66,7 +66,8 @@ _CertificateConfirmPopup::_CertificateConfirmPopup(void)
                                                : __certPopupMode(CERTIFICATE_POPUP_MODE_USER_CONFIRM)
                                                , __confirm(false)
                                                , __pCertificatePolicyData(null)
-                                               , __pImpl(null)
+                                               , __pParent(null)
+                                               , __pCertificatePopup(null)
 {
 }
 
@@ -81,7 +82,7 @@ _CertificateConfirmPopup::~_CertificateConfirmPopup(void)
 
 
 result
-_CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_WebImpl* pImpl)
+_CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_CertificateConfirmPopup* pParent)
 {
        SysTryReturnResult(NID_WEB_CTRL, pPolicy, E_INVALID_ARG, "Certificate Policy pointer is null.");
        result r = E_SUCCESS;
@@ -98,10 +99,7 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
        int popupMaxHeight = 0;
        Rectangle rect(0, 0, 0, 0);
 
-       if (pImpl == null)
-       {
-               __pImpl = pImpl;
-       }
+       __pParent = pParent;
 
        ArrayList idList;
        r = idList.Construct();
@@ -228,13 +226,14 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
                std::unique_ptr<_CertificateConfirmPopup> pCertificatePopup(new (std::nothrow) _CertificateConfirmPopup());
                SysTryReturnVoidResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
-               r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData, __pImpl);
+               r = pCertificatePopup->Construct(CERTIFICATE_POPUP_MODE_VIEW, __pCertificatePolicyData, this);
                SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               r = pCertificatePopup->ShowPopup();
-               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               __pCertificatePopup = std::move(pCertificatePopup);
 
-               pCertificatePopup.release();
+               r = __pCertificatePopup->ShowPopup();
+               SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               __pCertificatePopup.release();
                return;
        }
 
@@ -257,10 +256,26 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
        }
        if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW)
        {
-               __pImpl->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null);
+               __pParent->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null);
+       }
+}
+
+
+void
+_CertificateConfirmPopup::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
+{
+       switch (requestId)
+       {
+       case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
+               __pCertificatePopup.reset();
+               break;
+       default:
+               break;
        }
+
 }
 
+
 bool
 _CertificateConfirmPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
 {
@@ -284,7 +299,7 @@ _CertificateConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& key
                }
                if (__certPopupMode == CERTIFICATE_POPUP_MODE_VIEW)
                {
-                       __pImpl->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null);
+                       __pParent->SendUserEvent(ID_CERTIFICATE_CONFIRM_POPUP_CLOSE, null);
                }
        }
 
index 2552153..a3221c6 100755 (executable)
@@ -4471,7 +4471,7 @@ _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk
        std::unique_ptr<_CertificateConfirmPopup> pCertConfirmPopup(new (std::nothrow) _CertificateConfirmPopup());
        SysTryReturnResult(NID_WEB_CTRL, pCertConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
-       r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy, this);
+       r = pCertConfirmPopup->Construct(userConfirmMode, pPolicy);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pCertConfirmPopup = std::move(pCertConfirmPopup);
@@ -4786,6 +4786,9 @@ _WebImpl::OnPreAttachedToMainTree(void)
                pWebManager->SetActiveWeb(this);
        }
 
+       r = _ContainerImpl::OnPreAttachedToMainTree();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
        if (!HasValidNativeNode())
        {
                r = __pWebCore->InitializeWebNativeNode();
@@ -4798,9 +4801,6 @@ _WebImpl::OnPreAttachedToMainTree(void)
                r = InitializeSetting();
                SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               r = _ContainerImpl::OnPreAttachedToMainTree();
-               SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
                _WebManager* pWebManager = _WebManager::GetInstance();
                pWebManager->AddWeb(reinterpret_cast< int >(this));
        }
@@ -4812,8 +4812,13 @@ _WebImpl::OnPreAttachedToMainTree(void)
 result
 _WebImpl::OnDetachingFromMainTree(void)
 {
+       result r = E_SUCCESS;
+
        _WebManager* pWebManager = _WebManager::GetInstance();
-       pWebManager->RemoveActiveWeb(this);     
+       pWebManager->RemoveActiveWeb(this);
+
+       r = _ContainerImpl::OnDetachingFromMainTree();
+       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
 }
@@ -4888,8 +4893,6 @@ _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
 void
 _WebImpl::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
 {
-       _ContainerImpl::OnUserEventReceivedN(requestId, pArgs);
-
        switch (requestId)
        {
        case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
index f02de31..4c1260a 100755 (executable)
@@ -25,6 +25,7 @@
 
 #include <EWebKit2.h>
 #include <unique_ptr.h>
+#include <FBaseColIList.h>
 #include <FBaseString.h>
 #include <FUiIPropagatedKeyEventListener.h>
 #include "FWebCtrl_WebPopup.h"
@@ -64,7 +65,7 @@ public:
         */
        virtual ~_CertificateConfirmPopup(void);
 
-       result Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_WebImpl* pImpl);
+       result Construct(_CertificatePopupMode certPopupMode, Ewk_Certificate_Policy_Decision* pPolicy, Tizen::Web::Controls::_CertificateConfirmPopup* pParent = null);
 
        void HandleUserAction(bool allow);
 
@@ -91,12 +92,15 @@ private:
 
        Tizen::Base::String GetStringOfToken(const Tizen::Base::String& parseString, const Tizen::Base::String& parseToken);
 
+       virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
+
 private:
        _CertificatePopupMode __certPopupMode;
        bool __confirm;
 
        Ewk_Certificate_Policy_Decision* __pCertificatePolicyData;
-       Tizen::Web::Controls::_WebImpl* __pImpl;
+       _CertificateConfirmPopup* __pParent;
+       std::unique_ptr<_CertificateConfirmPopup> __pCertificatePopup;
 }; // _CertificateConfirmPopup
 
 }}} // Tizen::Web::Controls