Retire EwkViewMsg_DidFailLoadWithError
authorAntonio Gomes <a1.gomes@samsung.com>
Wed, 27 Jan 2016 05:16:12 +0000 (01:16 -0400)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
Chromium has two messages renderer used to notify browser of a load fail:
FrameHostMsg_DidFailLoadWithError and
FrameHostMsg_DidCommitProvisionalLoad.

Although they are both sent to browser, their hooks are not actually
used by chromium-efl. Instead chromium-efl has a custom message for
its own use: EwkViewMsg_DidFailLoadWithError.

Patch removes EwkViewMsg_DidFailLoadWithError and its plumbing logic,
and use the hooks provided by the former two messages.

Previous stack:
- RenderFrameImpl::didFailLoad
- RenderViewObserverEfl::DidFailLoad
-  (IPC - EwkViewMsg_DidFailLoadWithError)
- WebViewBrowserMessageFilterPrivate::OnReceivedDidFailLoadWithError
- EWebView::InvokeLoadError

The stack is:
- RenderFrameImpl::didFailLoad
- (IPC - FrameHostMsg_DidFailLoadWithError)
- RenderFrameHostImpl::OnMessageReceived
- RenderFrameHostImpl::OnDidFailLoadWithError
- (..)
- WebContentsImpl::DidFailLoadWithError
- WebContentsDelegateEfl::DidFailLoad
- EWebView::InvokeLoadError

Original beta/m47 patch: http://165.213.202.130/gerrit/#/c/105526/

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=15697

Reviewed by: g.czajkowski

Change-Id: I680fe89af89bf98181cf02a47e585743f185a994
Signed-off-by: Antonio Gomes <a1.gomes@samsung.com>
tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc
tizen_src/ewk/efl_integration/common/error_params.h [deleted file]
tizen_src/ewk/efl_integration/common/render_messages_ewk.h
tizen_src/ewk/efl_integration/efl_integration.gypi
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/renderer/render_view_observer_efl.cc
tizen_src/ewk/efl_integration/renderer/render_view_observer_efl.h
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h

index d8ebf89..a751b91 100644 (file)
@@ -7,7 +7,6 @@
 #include "browser/sound_effect.h"
 #include "common/web_contents_utils.h"
 #include "common/render_messages_ewk.h"
-#include "common/error_params.h"
 #include "common/hit_test_params.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_thread.h"
@@ -55,11 +54,6 @@ class WebViewBrowserMessageFilterPrivate
       web_view_->UpdateHitTestData(params);
   }
 
-  void OnReceivedDidFailLoadWithError(ErrorParams error) {
-    if (web_view_)
-      web_view_->InvokeLoadError(error);
-  }
-
   void OnReceivedHitTestAsyncData(int render_view,
                                   const Hit_Test_Params& params,
                                   int64_t request_id) {
@@ -191,7 +185,6 @@ WebViewBrowserMessageFilter::~WebViewBrowserMessageFilter() {
 void WebViewBrowserMessageFilter::OverrideThreadForMessage(
     const IPC::Message& message, BrowserThread::ID* thread) {
   switch (message.type()) {
-    case EwkViewMsg_DidFailLoadWithError::ID:
     case EwkViewHostMsg_HitTestAsyncReply::ID:
     case EwkHostMsg_PlainTextGetContents::ID:
     case EwkHostMsg_HandleTapGestureWithContext::ID:
@@ -212,8 +205,6 @@ bool WebViewBrowserMessageFilter::OnMessageReceived(
         WebViewBrowserMessageFilterPrivate::OnReceivedHitTestData)
     IPC_MESSAGE_FORWARD(EwkViewHostMsg_HitTestAsyncReply, private_,
         WebViewBrowserMessageFilterPrivate::OnReceivedHitTestAsyncData)
-    IPC_MESSAGE_FORWARD(EwkViewMsg_DidFailLoadWithError, private_,
-        WebViewBrowserMessageFilterPrivate::OnReceivedDidFailLoadWithError)
     IPC_MESSAGE_FORWARD(EwkHostMsg_PlainTextGetContents, private_,
         WebViewBrowserMessageFilterPrivate::OnPlainTextGetContents)
     IPC_MESSAGE_FORWARD(EwkHostMsg_HandleTapGestureWithContext, private_,
diff --git a/tizen_src/ewk/efl_integration/common/error_params.h b/tizen_src/ewk/efl_integration/common/error_params.h
deleted file mode 100644 (file)
index 1f85dbf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ERROR_PARAMS_H_
-#define ERROR_PARAMS_H_
-
-#include <string>
-#include "url/gurl.h"
-
-struct ErrorParams {
-  GURL url;
-  bool is_main_frame;
-  int code;
-  std::string description;
-  std::string domain;
-};
-
-#endif // ERROR_PARAMS_H_
index becdcc0..7efca22 100644 (file)
@@ -7,7 +7,6 @@
 #include "base/values.h"
 #include "common/print_pages_params.h"
 #include "common/hit_test_params.h"
-#include "common/error_params.h"
 #include "common/cache_params_efl.h"
 #include "common/navigation_policy_params.h"
 #include "common/web_preferences_efl.h"
@@ -39,14 +38,6 @@ IPC_STRUCT_TRAITS_BEGIN(WebPreferencesEfl)
   IPC_STRUCT_TRAITS_MEMBER(javascript_can_open_windows_automatically_ewk)
 IPC_STRUCT_TRAITS_END()
 
-IPC_STRUCT_TRAITS_BEGIN(ErrorParams)
-  IPC_STRUCT_TRAITS_MEMBER(url)
-  IPC_STRUCT_TRAITS_MEMBER(is_main_frame)
-  IPC_STRUCT_TRAITS_MEMBER(code)
-  IPC_STRUCT_TRAITS_MEMBER(description)
-  IPC_STRUCT_TRAITS_MEMBER(domain)
-IPC_STRUCT_TRAITS_END()
-
 IPC_STRUCT_TRAITS_BEGIN(Hit_Test_Params::Node_Data)
   IPC_STRUCT_TRAITS_MEMBER(tagName)
   IPC_STRUCT_TRAITS_MEMBER(nodeValue)
@@ -157,9 +148,6 @@ IPC_MESSAGE_CONTROL3(EwkViewHostMsg_HitTestAsyncReply,
                     Hit_Test_Params,
                     int64_t /* request id */)
 
-IPC_MESSAGE_ROUTED1(EwkViewMsg_DidFailLoadWithError,
-                    ErrorParams /* error */)
-
 IPC_MESSAGE_ROUTED2(EwkViewMsg_SetCSP,
                     std::string, /* policy */
                     Ewk_CSP_Header_Type /* header type */)
index 6cb4970..c6c7fb3 100644 (file)
       'common/content_switches_efl.cc',
       'common/content_switches_efl.h',
       'common/editing_messages.h',
-      'common/error_params.h',
       'common/hit_test_params.h',
       'common/message_generator_ewk.h',
       'common/message_generator_ewk.cc',
index e5cd5ce..8402657 100644 (file)
@@ -841,13 +841,15 @@ void EWebView::LoadData(const char* data, size_t size, const char* mime_type, co
   web_contents_->GetController().LoadURLWithParams(data_params);
 }
 
-void EWebView::InvokeLoadError(const ErrorParams &error) {
-  if (error.is_main_frame) {
-    scoped_ptr<_Ewk_Error> err(new _Ewk_Error(error.code,
-        error.url.possibly_invalid_spec().c_str(), error.description.c_str()));
+void EWebView::InvokeLoadError(const GURL& url, int error_code,
+      const std::string& error_description, bool is_main_frame) {
+  if (!is_main_frame)
+    return;
 
-    SmartCallback<EWebViewCallbacks::LoadError>().call(err.get());
-  }
+  scoped_ptr<_Ewk_Error> err(new _Ewk_Error(error_code,
+      url.possibly_invalid_spec().c_str(), error_description.c_str()));
+
+  SmartCallback<EWebViewCallbacks::LoadError>().call(err.get());
 }
 
 void EWebView::ShowPopupMenu(const std::vector<content::MenuItem>& items,
index 7a16f52..3545c13 100644 (file)
@@ -238,7 +238,9 @@ class EWebView {
   void LoadHTMLString(const char* html, const char* base_uri, const char* unreachable_uri);
   void LoadPlainTextString(const char* plain_text);
   void LoadData(const char* data, size_t size, const char* mime_type, const char* encoding, const char* base_uri, const char* unreachable_uri = NULL);
-  void InvokeLoadError(const ErrorParams &error);
+
+  void InvokeLoadError(const GURL& url, int error_code,
+      const std::string& error_description, bool is_main_frame);
   void InvokeAuthCallback(LoginDelegateEfl* login_delegate, const GURL& url, const std::string& realm);
   void Find(const char* text, Ewk_Find_Options);
   void InvokeAuthCallbackOnUI(_Ewk_Auth_Challenge* auth_challenge);
index b755e62..0d4a2c9 100644 (file)
@@ -346,40 +346,6 @@ void RenderViewObserverEfl::DidChangePageScaleFactor()
   Send(new EwkHostMsg_DidChangePageScaleFactor(render_view()->GetRoutingID(), view->pageScaleFactor()));
 }
 
-void RenderViewObserverEfl::DidFailLoad(blink::WebLocalFrame* frame,
-                                        const blink::WebURLError& error) {
-  if (error.isCancellation)
-    return;
-
-  base::string16 error_description;
-
-#if !defined(EWK_BRINGUP)
-// [M48_2564] Temporary disabling the codes for switching to new chromium
-//            FIXME: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=15386
-  WebDataSource* ds = frame->dataSource();
-  DCHECK(ds);
-
-  const WebURLRequest& failed_request = ds->request();
-
-  renderer_client_->GetNavigationErrorStrings(
-      render_view(),
-      frame,
-      failed_request,
-      error,
-      NULL,
-      &error_description);
-#endif
-
-  ErrorParams err;
-  err.url = error.unreachableURL;
-  err.is_main_frame = !frame->parent();
-  err.code = error.reason;
-  err.description = base::UTF16ToUTF8(error_description);
-  err.domain = error.domain.utf8();
-
-  Send(new EwkViewMsg_DidFailLoadWithError(routing_id(), err));
-}
-
 void RenderViewObserverEfl::DidUpdateLayout()
 {
   // Check if the timer is already running
index 53c0006..dc229b0 100644 (file)
@@ -50,10 +50,6 @@ class RenderViewObserverEfl: public content::RenderViewObserver {
   bool OnMessageReceived(const IPC::Message& message) override;
   virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) override;
   virtual void DidChangePageScaleFactor() override;
-  void DidFailLoad(blink::WebLocalFrame* frame,
-                   const blink::WebURLError& error) override;
-  void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
-      const blink::WebURLError& error) override { DidFailLoad(frame, error); }
 
   //Changes in PageScaleFactorLimits are applied when layoutUpdated is called
   //So using this notification to update minimum and maximum page scale factor values
index b449330..ff0f109 100644 (file)
@@ -474,6 +474,22 @@ bool WebContentsDelegateEfl::OnMessageReceived(const IPC::Message& message) {
   return handled;
 }
 
+void WebContentsDelegateEfl::DidFailProvisionalLoad(
+    RenderFrameHost* render_frame_host, const GURL& validated_url,
+    int error_code, const base::string16& error_description,
+    bool was_ignored_by_handler) {
+  DidFailLoad(render_frame_host, validated_url, error_code,
+              error_description, was_ignored_by_handler);
+}
+
+void WebContentsDelegateEfl::DidFailLoad(RenderFrameHost* render_frame_host,
+    const GURL& validated_url, int error_code,
+    const base::string16& error_description, bool was_ignored_by_handler) {
+  bool is_main_frame = !render_frame_host->GetParent();
+  std::string description = base::UTF16ToUTF8(error_description);
+  web_view_->InvokeLoadError(validated_url, error_code, description, is_main_frame);
+}
+
 void WebContentsDelegateEfl::OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data) {
   scoped_ptr<Ewk_Wrt_Message_Data> p(new Ewk_Wrt_Message_Data);
   p->type = data.type;
index 6e15916..a6b22a9 100644 (file)
@@ -168,6 +168,22 @@ class WebContentsDelegateEfl
   void TitleWasSet(content::NavigationEntry* entry,
                    bool explicit_set) override;
 
+
+  // WebContentsObserver---------------------------------------------------
+
+  void DidFailProvisionalLoad(
+      RenderFrameHost* render_frame_host,
+      const GURL& validated_url,
+      int error_code,
+      const base::string16& error_description,
+      bool was_ignored_by_handler) override;
+
+  void DidFailLoad(RenderFrameHost* render_frame_host,
+                   const GURL& validated_url,
+                   int error_code,
+                   const base::string16& error_description,
+                   bool was_ignored_by_handler) override;
+
  private:
   void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
   void OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data);