apply defense code for crash issue of AddControl()
authorSeongjun Yim <se201.yim@samsung.com>
Thu, 17 Oct 2013 05:25:29 +0000 (14:25 +0900)
committerSeongjun Yim <se201.yim@samsung.com>
Thu, 17 Oct 2013 05:25:29 +0000 (14:25 +0900)
Change-Id: I5400f16050f04e3a19a90b3012260b04594caeb7
Signed-off-by: Seongjun Yim <se201.yim@samsung.com>
src/controls/FWebCtrl_WebImpl.cpp
src/controls/inc/FWebCtrl_WebImpl.h

index f15b24e..42b4100 100755 (executable)
@@ -75,7 +75,6 @@
 #include <FIo_NormalFile.h>
 #include <FSys_SettingInfoImpl.h>
 #include <FSys_SystemResource.h>
-#include <FSys_VibratorImpl.h>
 #include <FUi_Control.h>
 #include <FUi_CoordinateSystemUtils.h>
 #include <FUi_EcoreEvasMgr.h>
@@ -2459,10 +2458,16 @@ CATCH:
 result
 _WebImpl::LoadUrl(const String& url) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       ewk_view_url_set(__pWebCore->GetWebNativeNode(), pUrl.get());
+       ewk_view_url_set(pWebview, pUrl.get());
 
        return E_SUCCESS;
 }
@@ -2471,12 +2476,18 @@ _WebImpl::LoadUrl(const String& url) const
 result 
 _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
 
-       ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
+       ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
 
        eina_hash_free(pHttpHeader);
 
@@ -2487,12 +2498,18 @@ _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
 result
 _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, const ByteBuffer& body) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
 
-       ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
+       ewk_view_url_request_set(pWebview, pUrl.get(), EWK_HTTP_METHOD_POST, pHttpHeader, reinterpret_cast< const char* >(body.GetPointer()));
 
        eina_hash_free(pHttpHeader);
 
@@ -2503,6 +2520,12 @@ _WebImpl::LoadUrlWithPostRequest(const String& url, const HttpHeader& header, co
 result
 _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const String& mime, const String& encoding) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        SysTryReturnResult(NID_WEB_CTRL, content.GetLimit() > 0, E_INVALID_ARG, "The content buffer is empty.");
 
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(baseUrl));
@@ -2510,7 +2533,7 @@ _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const Strin
        std::unique_ptr<char[]> pEncoding(_StringConverter::CopyToCharArrayN(encoding));
        SysTryReturn(NID_WEB_CTRL, pUrl.get() && pMime.get() && pEncoding.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       ewk_view_contents_set(__pWebCore->GetWebNativeNode(), reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
+       ewk_view_contents_set(pWebview, reinterpret_cast< const char* >(content.GetPointer()), content.GetLimit(), pMime.get(), pEncoding.get(), pUrl.get());
 
        return E_SUCCESS;
 }
@@ -2519,14 +2542,26 @@ _WebImpl::LoadData(const String& baseUrl, const ByteBuffer& content, const Strin
 void
 _WebImpl::Pause(void)
 {
-       ewk_view_suspend(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_suspend(pWebview);
 }
 
 
 void
 _WebImpl::Resume(void)
 {
-       ewk_view_resume(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_resume(pWebview);
 }
 
 
@@ -2610,64 +2645,112 @@ _WebImpl::GetColorpicker(void)
 bool
 _WebImpl::CanGoBack(void) const
 {
-       return static_cast< bool >(ewk_view_back_possible(__pWebCore->GetWebNativeNode()));
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
+       return static_cast< bool >(ewk_view_back_possible(pWebview));
 }
 
 
 bool
 _WebImpl::CanGoForward(void) const
 {
-       return static_cast< bool >(ewk_view_forward_possible(__pWebCore->GetWebNativeNode()));
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
+       return static_cast< bool >(ewk_view_forward_possible(pWebview));
 }
 
 
 void
 _WebImpl::GoBack(void) const
 {
-       ewk_view_back(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_back(pWebview);
 }
 
 
 void
 _WebImpl::GoForward(void) const
 {
-       ewk_view_forward(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_forward(pWebview);
 }
 
 
 Tizen::Base::String
 _WebImpl::GetUrl(void) const
 {
-       return ewk_view_url_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return L"";
+       }
+
+       return ewk_view_url_get(pWebview);
 }
 
 
 Tizen::Base::String
 _WebImpl::GetTitle(void) const
 {
-       return ewk_view_title_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return L"";
+       }
+
+       return ewk_view_title_get(pWebview);
 }
 
 
 void
 _WebImpl::StopLoading(void) const
 {
-       ewk_view_stop(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_stop(pWebview);
 }
 
 
 void
 _WebImpl::Reload(void) const
 {
-       ewk_view_reload(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_reload(pWebview);
 }
 
 
 String*
 _WebImpl::EvaluateJavascriptN(const String& scriptCode)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return null;
        }
@@ -2678,7 +2761,7 @@ _WebImpl::EvaluateJavascriptN(const String& scriptCode)
        std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
        SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       ewk_view_script_execute(pView, pScript.get(), OnScriptExecuted, pPresenter.get());
+       ewk_view_script_execute(pWebview, pScript.get(), OnScriptExecuted, pPresenter.get());
 
        String* pResult = new (std::nothrow) String(L"");
        SysTryReturn(NID_WEB_CTRL, pResult, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
@@ -2692,9 +2775,15 @@ _WebImpl::EvaluateJavascriptN(const String& scriptCode)
 result
 _WebImpl::SetZoomLevel(float level)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        SysTryReturnResult(NID_WEB_CTRL, level >= MIN_ZOOM_LEVEL && level <= MAX_ZOOM_LEVEL, E_OUT_OF_RANGE, "The level(%f) must be between 0.3 and 2.0(%f).", level, level);
 
-       ewk_view_scale_set(__pWebCore->GetWebNativeNode(), static_cast< double >(level), 0, 0);
+       ewk_view_scale_set(pWebview, static_cast< double >(level), 0, 0);
 
        return E_SUCCESS;
 }
@@ -2703,15 +2792,21 @@ _WebImpl::SetZoomLevel(float level)
 float
 _WebImpl::GetZoomLevel(void) const
 {
-       return static_cast< float >(ewk_view_scale_get(__pWebCore->GetWebNativeNode()));
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return -1.0f;
+       }
+
+       return static_cast< float >(ewk_view_scale_get(pWebview));
 }
 
 
 const PageNavigationList*
 _WebImpl::GetBackForwardListN(void) const
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return null;
        }
@@ -2730,7 +2825,7 @@ _WebImpl::GetBackForwardListN(void) const
        String url(L"");
        String title(L"");
 
-       Ewk_History* pEwkHistoryList = ewk_view_history_get(pView);
+       Ewk_History* pEwkHistoryList = ewk_view_history_get(pWebview);
        SysTryReturn(NID_WEB_CTRL, pEwkHistoryList, null, E_SYSTEM, "[%s] A system error has been occurred. Failed to get full history.", GetErrorMessage(E_SYSTEM));
 
        Ewk_History_Item* pEwkItem = ewk_history_nth_item_get(pEwkHistoryList, 0);
@@ -2790,8 +2885,8 @@ CATCH:
 bool
 _WebImpl::SearchText(const String& text, bool searchForward)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return false;
        }
@@ -2808,7 +2903,7 @@ _WebImpl::SearchText(const String& text, bool searchForward)
        std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter(this));
        SysTryReturn(NID_WEB_CTRL, pPresenter.get(), false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       r = SynchronizeSearch(SEARCH_SYNC, pView, condition, text, searchForward, false, pPresenter.get());
+       r = SynchronizeSearch(SEARCH_SYNC, pWebview, condition, text, searchForward, false, pPresenter.get());
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
 
        int result = 0;
@@ -2821,8 +2916,8 @@ _WebImpl::SearchText(const String& text, bool searchForward)
 result
 _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return E_SUCCESS;
        }
@@ -2836,7 +2931,7 @@ _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive
            condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_CASE_INSENSITIVE);
        }
 
-       r = SynchronizeSearch(SEARCH_ALL_ASYNC, pView, condition, text, true, caseSensitive);
+       r = SynchronizeSearch(SEARCH_ALL_ASYNC, pWebview, condition, text, true, caseSensitive);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -2846,8 +2941,8 @@ _WebImpl::SearchTextAllAsync(const Tizen::Base::String& text, bool caseSensitive
 result
 _WebImpl::SearchNextAsync(bool searchForward)
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return E_SUCCESS;
        }
@@ -2870,7 +2965,7 @@ _WebImpl::SearchNextAsync(bool searchForward)
                condition = static_cast <Ewk_Find_Options>(condition | EWK_FIND_OPTIONS_BACKWARDS);
        }
 
-       r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pView, condition, __textSearch.__text, searchForward);
+       r = SynchronizeSearch(SEARCH_NEXT_ASYNC, pWebview, condition, __textSearch.__text, searchForward);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -3087,8 +3182,8 @@ _WebImpl::GetElementByPointN(const Point& point) const
 const HitElementResult*
 _WebImpl::GetElementByPointN(const FloatPoint& point) const
 {
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       if (!pView)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return null;
        }
@@ -3105,7 +3200,7 @@ _WebImpl::GetElementByPointN(const FloatPoint& point) const
 
        Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
 
-       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pView, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
+       Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(pWebview, absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
        SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
 
        Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest);
@@ -3200,7 +3295,13 @@ CATCH:
 bool
 _WebImpl::IsLoading(void) const
 {
-       double percent = ewk_view_load_progress_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
+       double percent = ewk_view_load_progress_get(pWebview);
 
        if (Double::Compare(percent, 0.0) > 0 && Double::Compare(percent, 1.0) < 0)
        {
@@ -3216,19 +3317,26 @@ _WebImpl::IsLoading(void) const
 String
 _WebImpl::GetTextFromBlock(void) const
 {
-       return ewk_view_text_selection_text_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return L"";
+       }
+
+       return ewk_view_text_selection_text_get(pWebview);
 }
 
 
 bool
 _WebImpl::IsPrivateBrowsingEnabled(void) const
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsPrivateBrowsingEnabled();
        }
 
-       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+       Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
        SysAssertf(pSettings, "Failed to get webkit instance.");
 
        return static_cast< bool >(ewk_settings_private_browsing_enabled_get(pSettings));
@@ -3238,13 +3346,15 @@ _WebImpl::IsPrivateBrowsingEnabled(void) const
 void
 _WebImpl::SetPrivateBrowsingEnabled(bool enable)
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetPrivateBrowsingEnabled(enable);
+
                return;
        }
 
-       Ewk_Settings* pSettings = ewk_view_settings_get(__pWebCore->GetWebNativeNode());
+       Ewk_Settings* pSettings = ewk_view_settings_get(pWebview);
        SysAssertf(pSettings, "Failed to get webkit instance.");
 
        ewk_settings_private_browsing_enabled_set(pSettings, static_cast< Eina_Bool >(enable));
@@ -3254,14 +3364,26 @@ _WebImpl::SetPrivateBrowsingEnabled(bool enable)
 void
 _WebImpl::ClearHistory(void)
 {
-       ewk_view_back_forward_list_clear(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_back_forward_list_clear(pWebview);
 }
 
 
 void
 _WebImpl::ClearCache(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
 
        ewk_context_cache_clear(pContext);
 }
@@ -3270,7 +3392,13 @@ _WebImpl::ClearCache(void)
 void
 _WebImpl::ClearCookie(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
        Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
 
        ewk_cookie_manager_cookies_clear(pCookieManager);
@@ -3280,7 +3408,13 @@ _WebImpl::ClearCookie(void)
 void
 _WebImpl::ClearFormData(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
 
        ewk_context_form_candidate_data_clear(pContext);
 }
@@ -3289,7 +3423,13 @@ _WebImpl::ClearFormData(void)
 void
 _WebImpl::ClearLoginFormData(void)
 {
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
 
        ewk_context_form_password_data_clear(pContext);
 }
@@ -3298,12 +3438,13 @@ _WebImpl::ClearLoginFormData(void)
 bool
 _WebImpl::IsCookieEnabled(void) const
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                return _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->IsCookieEnabled();
        }
 
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
        Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
        SysAssertf(pCookieManager, "Failed to get webkit instance.");
 
@@ -3322,14 +3463,15 @@ _WebImpl::IsCookieEnabled(void) const
 void
 _WebImpl::SetCookieEnabled(bool enable)
 {
-       if (__pWebCore->GetWebNativeNode() == null)
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
        {
                _WebSettingImpl::GetInstance(__pWebCore->GetSetting())->SetCookiEnabled(enable);
 
                return;
        }
 
-       Ewk_Context* pContext = ewk_view_context_get(__pWebCore->GetWebNativeNode());
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
        Ewk_Cookie_Manager* pCookieManager =  ewk_context_cookie_manager_get(pContext);
        SysAssertf(pCookieManager, "Failed to get webkit instance.");
 
@@ -3348,6 +3490,12 @@ _WebImpl::SetCookieEnabled(bool enable)
 result 
 _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return E_SUCCESS;
+       }
+
        result r = E_SUCCESS;
 
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
@@ -3372,15 +3520,15 @@ _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
        {
                SysTryReturnResult(NID_WEB_CTRL, pSize->width > 0 && pSize->height > 0, E_INVALID_ARG, "Invalid argument(s) is used. Size of pdf file is invalid.");
 
-               ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), pSize->width, pSize->height, pFilePath.get());
+               ewk_view_contents_pdf_get(pWebview, pSize->width, pSize->height, pFilePath.get());
        }
        else
        {
                Evas_Coord contentsWidth;
                Evas_Coord contentsHeight;
 
-               ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &contentsWidth, &contentsHeight);
-               ewk_view_contents_pdf_get(__pWebCore->GetWebNativeNode(), contentsWidth, contentsHeight, pFilePath.get());
+               ewk_view_contents_size_get(pWebview, &contentsWidth, &contentsHeight);
+               ewk_view_contents_pdf_get(pWebview, contentsWidth, contentsHeight, pFilePath.get());
        }
 
        return E_SUCCESS;
@@ -3390,10 +3538,16 @@ _WebImpl::SavePageAsPdf(const String& filePath, const Dimension* pSize) const
 bool
 _WebImpl::IsMimeSupported(const String& mime) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return false;
+       }
+
        std::unique_ptr<char[]> pMime(_StringConverter::CopyToCharArrayN(mime));
        SysTryReturn(NID_WEB_CTRL, pMime.get(), false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(__pWebCore->GetWebNativeNode()), pMime.get()));
+       return static_cast< bool >(ewk_frame_can_show_mime_type(ewk_view_main_frame_get(pWebview), pMime.get()));
 }
 
 
@@ -3850,7 +4004,13 @@ _WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
 void
 _WebImpl::ReleaseBlock(void)
 {
-       ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_text_selection_range_clear(pWebview);
 }
 
 
@@ -3870,6 +4030,13 @@ _WebImpl::GetBlockRange(Point& startPoint, Point& endPoint) const
 void
 _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               startPoint.x = startPoint.y = endPoint.x = endPoint.y = 0.0f;
+               
+       }
+
        Eina_Rectangle leftHandle;
        Eina_Rectangle rightHandle;
 
@@ -3894,12 +4061,17 @@ _WebImpl::GetBlockRange(FloatPoint& startPoint, FloatPoint& endPoint) const
 Bitmap*
 _WebImpl::GetFaviconN(void) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return null;
+       }
+
        result r = E_SUCCESS;
 
-       Evas_Object* pView = __pWebCore->GetWebNativeNode();
-       Ewk_Context* pContext = ewk_view_context_get(pView);
-       const char* pUrl = ewk_view_url_get(pView);
-       Evas* pEvas = evas_object_evas_get(pView);
+       Ewk_Context* pContext = ewk_view_context_get(pWebview);
+       const char* pUrl = ewk_view_url_get(pWebview);
+       Evas* pEvas = evas_object_evas_get(pWebview);
 
        Evas_Object* pFavicon = ewk_context_icon_database_icon_object_add(pContext, pUrl, pEvas);
        if (!pFavicon)
@@ -3932,23 +4104,41 @@ _WebImpl::GetFaviconN(void) const
 void
 _WebImpl::ScrollBy(const Tizen::Graphics::Point& diff)
 {
-       ewk_view_scroll_by(__pWebCore->GetWebNativeNode(), diff.x, diff.y);
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_scroll_by(pWebview, diff.x, diff.y);
 }
 
 
 void
 _WebImpl::ScrollTo(const Tizen::Graphics::Point& dest)
 {
-       ewk_view_scroll_set(__pWebCore->GetWebNativeNode(), dest.x, dest.y);
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       ewk_view_scroll_set(pWebview, dest.x, dest.y);
 }
 
 
 Point
 _WebImpl::GetScrollPosition(void) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return Point(0, 0);
+       }
+
        Point position;
 
-       ewk_view_scroll_pos_get(__pWebCore->GetWebNativeNode(), &position.x, &position.y);
+       ewk_view_scroll_pos_get(pWebview, &position.x, &position.y);
 
        return position;
 }
@@ -3957,10 +4147,16 @@ _WebImpl::GetScrollPosition(void) const
 Dimension
 _WebImpl::GetPageSize(void) const
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return Dimension(0, 0);
+       }
+
        Evas_Coord width = 0;
        Evas_Coord height = 0;
 
-       ewk_view_contents_size_get(__pWebCore->GetWebNativeNode(), &width, &height);
+       ewk_view_contents_size_get(pWebview, &width, &height);
 
        Dimension size(static_cast< int >(width), static_cast< int >(height));
 
@@ -3968,36 +4164,6 @@ _WebImpl::GetPageSize(void) const
 }
 
 
-result
-_WebImpl::AddHttpHeaderField(const String& name, const String& value)
-{
-       SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
-
-       std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
-       SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-       std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(value));
-
-       ewk_view_custom_header_add(__pWebCore->GetWebNativeNode(), pName.get(), pValue.get());
-
-       return E_SUCCESS;
-}
-
-
-result
-_WebImpl::RemoveHttpHeaderField(const String& name)
-{
-       SysTryReturnResult(NID_WEB_CTRL, name.GetLength() > 0, E_INVALID_ARG, "Invalid argument(s) is used. name key is missing.");
-
-       std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(name));
-       SysTryReturn(NID_WEB_CTRL, pName.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
-       ewk_view_custom_header_remove(__pWebCore->GetWebNativeNode(), pName.get());
-
-       return E_SUCCESS;
-}
-
-
 void
 _WebImpl::SetLoadingErrorOccurred(bool arg)
 {
@@ -4524,7 +4690,7 @@ _WebImpl::VibrationRequested(uint64_t duration)
 
        __pVibrator.reset();
 
-       std::unique_ptr<_VibratorImpl> pVibrator(new (std::nothrow) _VibratorImpl);
+       std::unique_ptr<Vibrator> pVibrator(new (std::nothrow) Vibrator());
        SysTryReturnResult(NID_WEB_CTRL, pVibrator.get(), E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        r = pVibrator->Construct();
@@ -4534,7 +4700,7 @@ _WebImpl::VibrationRequested(uint64_t duration)
 
        IntensityDurationVibrationPattern pattern = {static_cast< int >(duration), -1};
 
-       r = __pVibrator->Start(&pattern, 1, 1);
+       r = __pVibrator->Start(&pattern, 1);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -5005,13 +5171,13 @@ _WebImpl::OnChangeLayout(_ControlRotation rotation)
                        degree =  0;
                        break;
                case _CONTROL_ROTATION_90:
-                       degree =  90;
+                       degree =  -90;
                        break;
                case _CONTROL_ROTATION_180:
                        degree =  180;
                        break;
                case _CONTROL_ROTATION_270:
-                       degree =  -90;
+                       degree =  90;
                        break;
                default:
                        SysAssert(false);
index 64ef767..b8ee325 100755 (executable)
@@ -61,7 +61,7 @@ class HttpHeader;
 
 namespace Tizen { namespace System
 {
-class _VibratorImpl;
+class Vibrator;
 }} // Tizen::Sytem
 
 namespace Tizen { namespace Ui
@@ -298,10 +298,6 @@ public:
 
        Tizen::Graphics::Dimension GetPageSize(void) const;
 
-       result AddHttpHeaderField(const Tizen::Base::String& name, const Tizen::Base::String& value);
-
-       result RemoveHttpHeaderField(const Tizen::Base::String& name);
-
        virtual bool IsLayoutable(void) const;
 
        void SetEventListenerCallback(void) const;
@@ -508,7 +504,7 @@ private:
        std::unique_ptr<_InputPickerPopup> __pColorPicker;
        std::unique_ptr<_FormDataWindow> __pFormDataWindow;
 
-       std::unique_ptr<Tizen::System::_VibratorImpl> __pVibrator;
+       std::unique_ptr<Tizen::System::Vibrator> __pVibrator;
 
        Tizen::Base::Runtime::Mutex __mutex;