[Release] wrt_0.8.166 for tizen_2.1 branch
[platform/framework/web/wrt.git] / src / view / webkit / view_logic.cpp
old mode 100755 (executable)
new mode 100644 (file)
index f9a48bf..4c5042e
@@ -621,27 +621,29 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView)
     //    EWK_ENFORCE_POLICY);
     //LogInfo("Default policy set");
 
-    DPL::OptionalString policy = m_model->CspPolicy.Get();
+    DPL::OptionalString policy = m_model->CspReportOnlyPolicy.Get();
 
     if (!(policy.IsNull()))
     {
-        LogDebug("CSP policy present in manifest: " << *policy);
+        LogDebug("CSP report only policy present in manifest: " << *policy);
         ewk_view_content_security_policy_set(
-            wkView, DPL::ToUTF8String(*policy).c_str(), EWK_ENFORCE_POLICY);
+            wkView, DPL::ToUTF8String(*policy).c_str(), EWK_REPORT_ONLY);
     } else {
-        LogDebug("Config CSP policy is not present");
+        LogDebug("Config CSP report only policy is not present");
     }
 
-    policy = m_model->CspReportOnlyPolicy.Get();
+    policy = m_model->CspPolicy.Get();
+
     if (!(policy.IsNull()))
     {
-        LogDebug("CSP report only policy present in manifest: " << *policy);
+        LogDebug("CSP policy present in manifest: " << *policy);
         ewk_view_content_security_policy_set(
-            wkView, DPL::ToUTF8String(*policy).c_str(), EWK_REPORT_ONLY);
+            wkView, DPL::ToUTF8String(*policy).c_str(), EWK_ENFORCE_POLICY);
     } else {
-        LogDebug("Config CSP report only policy is not present");
+        LogDebug("Config CSP policy is not present");
     }
 
+
     LogInfo("CSP set.");
 #endif
 
@@ -834,23 +836,6 @@ void ViewLogic::loadFinishedCallback(
         return;
     }
 
-    // check if this loading is for blocked url
-    if (This->m_blockedUri == url) {
-        if (ewk_view_back_possible(This->m_currentEwkView)) {
-            // go back to previous page
-            LogDebug("go to previous page");
-            ewk_view_back(This->m_currentEwkView);
-        } else {
-            // stop current page
-            LogDebug("remove current page");
-            ewk_view_stop(This->m_currentEwkView);
-            This->m_closedEwkView = This->m_currentEwkView;
-            ecore_idler_add(windowCloseIdlerCallback, This);
-        }
-        This->m_blockedUri = std::string();
-        return;
-    }
-
     DPL::OptionalString jsOptionalString =
         ViewModule::PasswordSupport::jsForAutoFillData(url);
     if (jsOptionalString.IsNull()) {
@@ -1036,6 +1021,17 @@ void ViewLogic::policyNavigationDecideCallback(
     Ewk_Policy_Decision* policyDecision =
         static_cast<Ewk_Policy_Decision*>(eventInfo);
 
+    // handle blocked url
+    const char* url = ewk_policy_decision_url_get(policyDecision);
+    if (url && strlen(url) != 0) {
+        if (This->m_blockedUri == url) {
+            LogDebug("Blocked url = " << url);
+            This->m_blockedUri = std::string();
+            ewk_policy_decision_ignore(policyDecision);
+            return;
+        }
+    }
+
     if (This->m_schemeSupport->filterURIByScheme(policyDecision,
                                                  false,
                                                  This->m_model,