Add APIs for console message & loading error in web view. 41/254041/7
authorhuayong.xu <huayong.xu@samsung.com>
Mon, 22 Feb 2021 11:55:47 +0000 (19:55 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Fri, 2 Apr 2021 12:06:55 +0000 (20:06 +0800)
This patch is to add some APIs into web view for console message
and loading error.

Change-Id: I122871ca03ca164c8778f0d4af07100dd945c284

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp
automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp
dali-toolkit/devel-api/controls/web-view/web-view.cpp
dali-toolkit/devel-api/controls/web-view/web-view.h
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.h

index db94ec0..f400f75 100755 (executable)
 #include <dali/devel-api/adaptor-framework/web-engine.h>
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
 #include <dali/devel-api/adaptor-framework/web-engine.h>
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
+#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/images/pixel-data.h>
 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/public-api/images/pixel-data.h>
@@ -265,6 +267,66 @@ public:
   }
 };
 
   }
 };
 
+class MockWebEngineConsoleMessage : public Dali::WebEngineConsoleMessage
+{
+public:
+  MockWebEngineConsoleMessage()
+  {
+  }
+
+  std::string GetSource() const override
+  {
+    return "source";
+  }
+
+  uint32_t GetLine() const override
+  {
+    return 10;
+  }
+
+  SeverityLevel GetSeverityLevel() const override
+  {
+    return SeverityLevel::EMPTY;
+  }
+
+  std::string GetText() const override
+  {
+    return "This is a text.";
+  }
+};
+
+class MockWebEngineLoadError : public Dali::WebEngineLoadError
+{
+public:
+  MockWebEngineLoadError(const std::string& url)
+    : mockUrl(url)
+  {
+  }
+
+  std::string GetUrl() const override
+  {
+    return mockUrl;
+  }
+
+  ErrorCode GetCode() const override
+  {
+    return ErrorCode::UNKNOWN;
+  }
+
+  std::string GetDescription() const override
+  {
+    return "This is an error.";
+  }
+
+  ErrorType GetType() const override
+  {
+    return ErrorType::NONE;
+  }
+
+private:
+  std::string mockUrl;
+};
+
 class MockWebEngineSettings : public WebEngineSettings
 {
 public:
 class MockWebEngineSettings : public WebEngineSettings
 {
 public:
@@ -835,6 +897,11 @@ public:
     return mRequestInterceptorSignal;
   }
 
     return mRequestInterceptorSignal;
   }
 
+  Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal()
+  {
+    return mConsoleMessageSignal;
+  }
+
   std::string              mUrl;
   std::vector<std::string> mHistory;
   size_t                   mCurrentPlusOnePos;
   std::string              mUrl;
   std::vector<std::string> mHistory;
   size_t                   mCurrentPlusOnePos;
@@ -849,6 +916,7 @@ public:
   Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
   Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType      mFrameRenderedSignal;
   Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
   Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
   Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType      mFrameRenderedSignal;
   Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
+  Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType     mConsoleMessageSignal;
 
   bool  mEvaluating;
   float mPageZoomFactor;
 
   bool  mEvaluating;
   float mPageZoomFactor;
@@ -863,13 +931,13 @@ public:
   WebEngineCookieManager*   mockWebEngineCookieManager;
   WebEngineSettings*        mockWebEngineSettings;
 
   WebEngineCookieManager*   mockWebEngineCookieManager;
   WebEngineSettings*        mockWebEngineSettings;
 
-  std::vector<JavaScriptEvaluatedResultCallback>              mResultCallbacks;
-  Dali::WebEnginePlugin::JavaScriptAlertCallback              mJavaScriptAlertCallback;
-  Dali::WebEnginePlugin::JavaScriptConfirmCallback            mJavaScriptConfirmCallback;
-  Dali::WebEnginePlugin::JavaScriptPromptCallback             mJavaScriptPromptCallback;
-  Dali::WebEnginePlugin::ScreenshotCapturedCallback           mScreenshotCapturedCallback;
-  Dali::WebEnginePlugin::VideoPlayingCallback                 mVideoPlayingCallback;
-  Dali::WebEnginePlugin::GeolocationPermissionCallback        mGeolocationPermissionCallback;
+  std::vector<JavaScriptEvaluatedResultCallback>       mResultCallbacks;
+  Dali::WebEnginePlugin::JavaScriptAlertCallback       mJavaScriptAlertCallback;
+  Dali::WebEnginePlugin::JavaScriptConfirmCallback     mJavaScriptConfirmCallback;
+  Dali::WebEnginePlugin::JavaScriptPromptCallback      mJavaScriptPromptCallback;
+  Dali::WebEnginePlugin::ScreenshotCapturedCallback    mScreenshotCapturedCallback;
+  Dali::WebEnginePlugin::VideoPlayingCallback          mVideoPlayingCallback;
+  Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
 };
 
 
 };
 
 
@@ -920,6 +988,11 @@ bool OnLoadUrl()
     gInstance->mFrameRenderedSignal.Emit();
     std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
     gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
     gInstance->mFrameRenderedSignal.Emit();
     std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
     gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
+
+    std::shared_ptr<Dali::WebEngineLoadError> error(new MockWebEngineLoadError(gInstance->mUrl));
+    gInstance->mPageLoadErrorSignal.Emit(std::move(error));
+    std::shared_ptr<Dali::WebEngineConsoleMessage> message(new MockWebEngineConsoleMessage());
+    gInstance->mConsoleMessageSignal.Emit(std::move(message));
   }
   return false;
 }
   }
   return false;
 }
@@ -1492,5 +1565,10 @@ Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& WebEngine::Request
   return Internal::Adaptor::GetImplementation(*this).RequestInterceptorSignal();
 }
 
   return Internal::Adaptor::GetImplementation(*this).RequestInterceptorSignal();
 }
 
+Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& WebEngine::ConsoleMessageSignal()
+{
+  return Internal::Adaptor::GetImplementation(*this).ConsoleMessageSignal();
+}
+
 } // namespace Dali;
 
 } // namespace Dali;
 
index a97eb79..912bc62 100755 (executable)
@@ -23,6 +23,8 @@
 
 #include <dali.h>
 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
 
 #include <dali.h>
 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
@@ -50,6 +52,8 @@ const char* const TEST_URL2( "http://www.somewhere.valid2.com" );
 static int gPageLoadStartedCallbackCalled = 0;
 static int gPageLoadInProgressCallbackCalled = 0;
 static int gPageLoadFinishedCallbackCalled = 0;
 static int gPageLoadStartedCallbackCalled = 0;
 static int gPageLoadInProgressCallbackCalled = 0;
 static int gPageLoadFinishedCallbackCalled = 0;
+static int gPageLoadErrorCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
 static int gScrollEdgeReachedCallbackCalled = 0;
 static int gUrlChangedCallbackCalled = 0;
 static int gEvaluateJavaScriptCallbackCalled = 0;
 static int gScrollEdgeReachedCallbackCalled = 0;
 static int gUrlChangedCallbackCalled = 0;
 static int gEvaluateJavaScriptCallbackCalled = 0;
@@ -67,6 +71,8 @@ static std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> gFormRepostDecision
 static int gFrameRenderedCallbackCalled = 0;
 static int gRequestInterceptorCallbackCalled = 0;
 static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
 static int gFrameRenderedCallbackCalled = 0;
 static int gRequestInterceptorCallbackCalled = 0;
 static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
+static int gConsoleMessageCallbackCalled = 0;
+static std::shared_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
 
 struct CallbackFunctor
 {
 
 struct CallbackFunctor
 {
@@ -107,8 +113,10 @@ static void OnUrlChanged( WebView view, const std::string& url )
   gUrlChangedCallbackCalled++;
 }
 
   gUrlChangedCallbackCalled++;
 }
 
-static void OnPageLoadError( WebView view, const std::string& url, WebView::LoadErrorCode errorCode )
+static void OnPageLoadError(WebView view, std::shared_ptr<Dali::WebEngineLoadError> error)
 {
 {
+  gPageLoadErrorCallbackCalled++;
+  gPageLoadErrorInstance = std::move(error);
 }
 
 static void OnEvaluateJavaScript( const std::string& result )
 }
 
 static void OnEvaluateJavaScript( const std::string& result )
@@ -185,6 +193,12 @@ static void OnRequestInterceptor(WebView view, std::shared_ptr<Dali::WebEngineRe
   gRequestInterceptorInstance = std::move(interceptor);
 }
 
   gRequestInterceptorInstance = std::move(interceptor);
 }
 
+static void OnConsoleMessage(WebView view, std::shared_ptr<Dali::WebEngineConsoleMessage> message)
+{
+  gConsoleMessageCallbackCalled++;
+  gConsoleMessageInstance = std::move(message);
+}
+
 } // namespace
 
 void web_view_startup(void)
 } // namespace
 
 void web_view_startup(void)
@@ -261,7 +275,6 @@ int UtcDaliWebViewPageNavigation(void)
   view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
   view.PageLoadInProgressSignal().Connect( &OnPageLoadInProgress );
   view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
   view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
   view.PageLoadInProgressSignal().Connect( &OnPageLoadInProgress );
   view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
-  view.PageLoadErrorSignal().Connect( &OnPageLoadError );
   view.UrlChangedSignal().Connect( &OnUrlChanged );
   bool signal1 = false;
   bool signal2 = false;
   view.UrlChangedSignal().Connect( &OnUrlChanged );
   bool signal1 = false;
   bool signal2 = false;
@@ -323,6 +336,60 @@ int UtcDaliWebViewPageNavigation(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
+int UtcDaliWebViewPageLoadErrorConsoleMessage(void)
+{
+  ToolkitTestApplication application;
+
+  WebView view = WebView::New();
+  view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+  view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+  view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+  view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
+  application.GetScene().Add( view );
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_CHECK( view );
+
+  ConnectionTracker* testTracker = new ConnectionTracker();
+  view.PageLoadErrorSignal().Connect( &OnPageLoadError );
+  view.ConsoleMessageSignal().Connect( &OnConsoleMessage );
+  bool signal1 = false;
+  bool signal2 = false;
+  view.ConnectSignal( testTracker, "pageLoadError", CallbackFunctor(&signal1) );
+  view.ConnectSignal( testTracker, "consoleMessage", CallbackFunctor(&signal2) );
+  DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 0, TEST_LOCATION );
+
+  view.LoadUrl( TEST_URL1 );
+  Test::EmitGlobalTimerSignal();
+  DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 1, TEST_LOCATION );
+  DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 1, TEST_LOCATION );
+  DALI_TEST_CHECK( signal1 & signal2);
+
+  // error code.
+  DALI_TEST_CHECK(gPageLoadErrorInstance);
+  DALI_TEST_EQUALS(gPageLoadErrorInstance->GetUrl(), TEST_URL1, TEST_LOCATION);
+  DALI_TEST_EQUALS(gPageLoadErrorInstance->GetCode(), Dali::WebEngineLoadError::ErrorCode::UNKNOWN, TEST_LOCATION);
+  std::string testErrorDescription("This is an error.");
+  DALI_TEST_EQUALS(gPageLoadErrorInstance->GetDescription(), testErrorDescription, TEST_LOCATION);
+  DALI_TEST_EQUALS(gPageLoadErrorInstance->GetType(), Dali::WebEngineLoadError::ErrorType::NONE, TEST_LOCATION);
+
+  // console message.
+  DALI_TEST_CHECK(gConsoleMessageInstance);
+  std::string testConsoleSource("source");
+  DALI_TEST_EQUALS(gConsoleMessageInstance->GetSource(), testConsoleSource, TEST_LOCATION);
+  DALI_TEST_EQUALS(gConsoleMessageInstance->GetLine(), 10, TEST_LOCATION);
+  DALI_TEST_EQUALS(gConsoleMessageInstance->GetSeverityLevel(), Dali::WebEngineConsoleMessage::SeverityLevel::EMPTY, TEST_LOCATION);
+  std::string testConsoleText("This is a text.");
+  DALI_TEST_EQUALS(gConsoleMessageInstance->GetText(), testConsoleText, TEST_LOCATION);
+
+  // reset
+  gPageLoadErrorInstance = nullptr;
+  gConsoleMessageInstance = nullptr;
+
+  END_TEST;
+}
+
 int UtcDaliWebViewTouchAndKeys(void)
 {
   ToolkitTestApplication application;
 int UtcDaliWebViewTouchAndKeys(void)
 {
   ToolkitTestApplication application;
index 504cabb..886e6d1 100755 (executable)
@@ -344,6 +344,11 @@ WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal(
   return Dali::Toolkit::GetImpl(*this).RequestInterceptorSignal();
 }
 
   return Dali::Toolkit::GetImpl(*this).RequestInterceptorSignal();
 }
 
+WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
+{
+  return Dali::Toolkit::GetImpl(*this).ConsoleMessageSignal();
+}
+
 WebView::WebView(Internal::WebView& implementation)
 : Control(implementation)
 {
 WebView::WebView(Internal::WebView& implementation)
 : Control(implementation)
 {
index a64e1ca..bc48d61 100755 (executable)
@@ -187,28 +187,6 @@ public:
   };
 
   /**
   };
 
   /**
-   * @brief Enumeration for indicating error code of page loading.
-   */
-  enum class LoadErrorCode
-  {
-    UNKNOWN = 0,           ///< Unknown.
-    CANCELED,              ///< User canceled.
-    CANT_SUPPORT_MIMETYPE, ///< Can't show the page for this MIME type.
-    FAILED_FILE_IO,        ///< File IO error.
-    CANT_CONNECT,          ///< Cannot connect to the network.
-    CANT_LOOKUP_HOST,      ///< Fail to look up host from the DNS.
-    FAILED_TLS_HANDSHAKE,  ///< Fail to SSL/TLS handshake.
-    INVALID_CERTIFICATE,   ///< Received certificate is invalid.
-    REQUEST_TIMEOUT,       ///< Connection timeout.
-    TOO_MANY_REDIRECTS,    ///< Too many redirects.
-    TOO_MANY_REQUESTS,     ///< Too many requests during this load.
-    BAD_URL,               ///< Malformed URL.
-    UNSUPPORTED_SCHEME,    ///< Unsupported scheme.
-    AUTHENTICATION,        ///< User authentication failed on the server.
-    INTERNAL_SERVER        ///< Web server has an internal server error.
-  };
-
-  /**
    * @brief WebView callback related with screen-shot captured.
    */
   using WebViewScreenshotCapturedCallback = std::function<void(Dali::Toolkit::ImageView)>;
    * @brief WebView callback related with screen-shot captured.
    */
   using WebViewScreenshotCapturedCallback = std::function<void(Dali::Toolkit::ImageView)>;
@@ -221,7 +199,7 @@ public:
   /**
    * @brief WebView signal type related with page loading error.
    */
   /**
    * @brief WebView signal type related with page loading error.
    */
-  using WebViewPageLoadErrorSignalType = Signal<void(WebView, const std::string&, LoadErrorCode)>;
+  using WebViewPageLoadErrorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineLoadError>)>;
 
   /**
    * @brief WebView signal type related with scroll edge reached.
 
   /**
    * @brief WebView signal type related with scroll edge reached.
@@ -248,6 +226,11 @@ public:
    */
   using WebViewRequestInterceptorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineRequestInterceptor>)>;
 
    */
   using WebViewRequestInterceptorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineRequestInterceptor>)>;
 
+  /**
+   * @brief WebView signal type related with console message.
+   */
+  using WebViewConsoleMessageSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineConsoleMessage>)>;
+
 public:
   /**
    * @brief Creates an initialized WebView.
 public:
   /**
    * @brief Creates an initialized WebView.
@@ -712,6 +695,13 @@ public:
    */
   WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
 
    */
   WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
 
+  /**
+   * @brief Connects to this signal to be notified when console message will be logged.
+   *
+   * @return A signal object to connect with.
+   */
+  WebViewConsoleMessageSignalType& ConsoleMessageSignal();
+
 public: // Not intended for application developers
   /// @cond internal
   /**
 public: // Not intended for application developers
   /// @cond internal
   /**
index 74e498b..eb25d3b 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
+#include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
+#include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
 #include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/scripting/enum-helper.h>
 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
 #include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/scripting/enum-helper.h>
@@ -89,6 +91,7 @@ DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged",         URL_CHANGED_SIG
 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered",      FRAME_RENDERED_SIGNAL       )
 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL  )
 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered",      FRAME_RENDERED_SIGNAL       )
 DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL  )
+DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "consoleMessage",     CONSOLE_MESSAGE_SIGNAL      )
 
 DALI_TYPE_REGISTRATION_END()
 // clang-format on
 
 DALI_TYPE_REGISTRATION_END()
 // clang-format on
@@ -219,6 +222,7 @@ void WebView::OnInitialize()
     mWebEngine.FormRepostDecisionSignal().Connect(this, &WebView::OnFormRepostDecision);
     mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
     mWebEngine.RequestInterceptorSignal().Connect(this, &WebView::OnInterceptRequest);
     mWebEngine.FormRepostDecisionSignal().Connect(this, &WebView::OnFormRepostDecision);
     mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
     mWebEngine.RequestInterceptorSignal().Connect(this, &WebView::OnInterceptRequest);
+    mWebEngine.ConsoleMessageSignal().Connect(this, &WebView::OnConsoleMessage);
 
     mWebContext         = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
     mWebCookieManager   = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
 
     mWebContext         = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
     mWebCookieManager   = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
@@ -717,6 +721,11 @@ Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& WebView::RequestInt
   return mRequestInterceptorSignal;
 }
 
   return mRequestInterceptorSignal;
 }
 
+Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
+{
+  return mConsoleMessageSignal;
+}
+
 void WebView::OnPageLoadStarted(const std::string& url)
 {
   if(!mPageLoadStartedSignal.Empty())
 void WebView::OnPageLoadStarted(const std::string& url)
 {
   if(!mPageLoadStartedSignal.Empty())
@@ -744,12 +753,12 @@ void WebView::OnPageLoadFinished(const std::string& url)
   }
 }
 
   }
 }
 
-void WebView::OnPageLoadError(const std::string& url, int errorCode)
+void WebView::OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error)
 {
   if(!mPageLoadErrorSignal.Empty())
   {
     Dali::Toolkit::WebView handle(GetOwner());
 {
   if(!mPageLoadErrorSignal.Empty())
   {
     Dali::Toolkit::WebView handle(GetOwner());
-    mPageLoadErrorSignal.Emit(handle, url, static_cast<Toolkit::WebView::LoadErrorCode>(errorCode));
+    mPageLoadErrorSignal.Emit(handle, std::move(error));
   }
 }
 
   }
 }
 
@@ -816,6 +825,15 @@ void WebView::OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestIntercept
   }
 }
 
   }
 }
 
+void WebView::OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message)
+{
+  if(!mConsoleMessageSignal.Empty())
+  {
+    Dali::Toolkit::WebView handle(GetOwner());
+    mConsoleMessageSignal.Emit(handle, std::move(message));
+  }
+}
+
 bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
 {
   Dali::BaseHandle handle(object);
 bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
 {
   Dali::BaseHandle handle(object);
@@ -868,6 +886,11 @@ bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tr
     webView.RequestInterceptorSignal().Connect(tracker, functor);
     connected = true;
   }
     webView.RequestInterceptorSignal().Connect(tracker, functor);
     connected = true;
   }
+  else if(0 == strcmp(signalName.c_str(), CONSOLE_MESSAGE_SIGNAL))
+  {
+    webView.ConsoleMessageSignal().Connect(tracker, functor);
+    connected = true;
+  }
 
   return connected;
 }
 
   return connected;
 }
index 2630e47..cf5319f 100755 (executable)
@@ -344,6 +344,11 @@ public:
    */
   Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
 
    */
   Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
 
+  /**
+   * @copydoc Dali::Toolkit::WebView::ConsoleMessageSignal()
+   */
+  Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& ConsoleMessageSignal();
+
 public: // Properties
   /**
    * @brief Called when a property of an object of this type is set.
 public: // Properties
   /**
    * @brief Called when a property of an object of this type is set.
@@ -412,7 +417,7 @@ private:
   WebView& operator=(const WebView& webView);
 
   /**
   WebView& operator=(const WebView& webView);
 
   /**
-   * @brief Sets an absolute scroll of the given view.
+   * @brief Set an absolute scroll of the given view.
    * @param[in] x The coordinate x of scroll
    * @param[in] y The coordinate y of scroll
    */
    * @param[in] x The coordinate x of scroll
    * @param[in] y The coordinate y of scroll
    */
@@ -426,54 +431,54 @@ private:
   Dali::Vector2 GetScrollPosition() const;
 
   /**
   Dali::Vector2 GetScrollPosition() const;
 
   /**
-   * @brief Gets the possible scroll size of the given view.
+   * @brief Get the possible scroll size of the given view.
    * @param[out] width The width of scroll size
    * @param[out] height The height of scroll size
    */
   Dali::Vector2 GetScrollSize() const;
 
   /**
    * @param[out] width The width of scroll size
    * @param[out] height The height of scroll size
    */
   Dali::Vector2 GetScrollSize() const;
 
   /**
-   * @brief Gets the last known content's size.
+   * @brief Get the last known content's size.
    * @param[out] width The width of content's size
    * @param[out] height The height of content's size
    */
   Dali::Vector2 GetContentSize() const;
 
   /**
    * @param[out] width The width of content's size
    * @param[out] height The height of content's size
    */
   Dali::Vector2 GetContentSize() const;
 
   /**
-   * @brief Returns the title of the Web.
+   * @brief Return the title of the Web.
    *
    * @return The title of web page
    */
   std::string GetTitle() const;
 
   /**
    *
    * @return The title of web page
    */
   std::string GetTitle() const;
 
   /**
-   * @brief Sets the background color of web page.
+   * @brief Set the background color of web page.
    * @param[in] color The value of background color.
    */
   void SetDocumentBackgroundColor(Dali::Vector4 color);
 
   /**
    * @param[in] color The value of background color.
    */
   void SetDocumentBackgroundColor(Dali::Vector4 color);
 
   /**
-   * @brief Clears tiles when hidden.
+   * @brief Clear tiles when hidden.
    *
    * @param[in] cleared Whether tiles are cleared or not
    */
   void ClearTilesWhenHidden(bool cleared);
 
   /**
    *
    * @param[in] cleared Whether tiles are cleared or not
    */
   void ClearTilesWhenHidden(bool cleared);
 
   /**
-   * @brief Sets multiplier of cover area of tile.
+   * @brief Set multiplier of cover area of tile.
    *
    * @param[in] multiplier The multiplier of cover area
    */
   void SetTileCoverAreaMultiplier(float multiplier);
 
   /**
    *
    * @param[in] multiplier The multiplier of cover area
    */
   void SetTileCoverAreaMultiplier(float multiplier);
 
   /**
-   * @brief Enables cursor by client.
+   * @brief Enable cursor by client.
    * @param[in] enabled Whether cursor is enabled or not.
    */
   void EnableCursorByClient(bool enabled);
 
   /**
    * @param[in] enabled Whether cursor is enabled or not.
    */
   void EnableCursorByClient(bool enabled);
 
   /**
-   * @brief Gets the selected text.
+   * @brief Get the selected text.
    * @return The selected text
    */
   std::string GetSelectedText() const;
    * @return The selected text
    */
   std::string GetSelectedText() const;
@@ -491,31 +496,31 @@ private:
   void SetUserAgent(const std::string& userAgent);
 
   /**
   void SetUserAgent(const std::string& userAgent);
 
   /**
-   * @brief Sets zoom factor of the current page.
+   * @brief Set zoom factor of the current page.
    * @param[in] zoomFactor a new factor to be set.
    */
   void SetPageZoomFactor(float zoomFactor);
 
   /**
    * @param[in] zoomFactor a new factor to be set.
    */
   void SetPageZoomFactor(float zoomFactor);
 
   /**
-   * @brief Queries the current zoom factor of the page。
+   * @brief Query the current zoom factor of the page。
    * @return The current page zoom factor.
    */
   float GetPageZoomFactor() const;
 
   /**
    * @return The current page zoom factor.
    */
   float GetPageZoomFactor() const;
 
   /**
-   * @brief Sets the current text zoom level。.
+   * @brief Set the current text zoom level。.
    * @param[in] zoomFactor a new factor to be set.
    */
   void SetTextZoomFactor(float zoomFactor);
 
   /**
    * @param[in] zoomFactor a new factor to be set.
    */
   void SetTextZoomFactor(float zoomFactor);
 
   /**
-   * @brief Gets the current text zoom level.
+   * @brief Get the current text zoom level.
    * @return The current text zoom factor.
    */
   float GetTextZoomFactor() const;
 
   /**
    * @return The current text zoom factor.
    */
   float GetTextZoomFactor() const;
 
   /**
-   * @brief Gets the current load progress of the page.
+   * @brief Get the current load progress of the page.
    * @return The load progress of the page.
    */
   float GetLoadProgressPercentage() const;
    * @return The load progress of the page.
    */
   float GetLoadProgressPercentage() const;
@@ -529,7 +534,7 @@ private:
   bool SetVisibility(bool visible);
 
   /**
   bool SetVisibility(bool visible);
 
   /**
-   * @brief Updates display area of web view.
+   * @brief Update display area of web view.
    * @param[in] source The soource triggers Notification.
    */
   void UpdateDisplayArea(Dali::PropertyNotification& source);
    * @param[in] source The soource triggers Notification.
    */
   void UpdateDisplayArea(Dali::PropertyNotification& source);
@@ -547,14 +552,14 @@ private:
   void EnableBlendMode(bool blendEnabled);
 
   /**
   void EnableBlendMode(bool blendEnabled);
 
   /**
-   * @brief Enables/disables mouse events. The default is enabled.
+   * @brief Enable/disable mouse events. The default is enabled.
    *
    * @param[in] enabled True if mouse events are enabled, false otherwise
    */
   void EnableMouseEvents(bool enabled);
 
   /**
    *
    * @param[in] enabled True if mouse events are enabled, false otherwise
    */
   void EnableMouseEvents(bool enabled);
 
   /**
-   * @brief Enables/disables key events. The default is enabled.
+   * @brief Enable/disable key events. The default is enabled.
    *
    * @param[in] enabled True if key events enabled, false otherwise
    */
    *
    * @param[in] enabled True if key events enabled, false otherwise
    */
@@ -590,7 +595,7 @@ private:
    * @param[in] url The url currently being loaded
    * @param[in] errorCode The error code
    */
    * @param[in] url The url currently being loaded
    * @param[in] errorCode The error code
    */
-  void OnPageLoadError(const std::string& url, int errorCode);
+  void OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error);
 
   /**
    * @brief Callback function to be called when scroll edge is reached.
 
   /**
    * @brief Callback function to be called when scroll edge is reached.
@@ -659,6 +664,12 @@ private:
    */
   void OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor);
 
    */
   void OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor);
 
+  /**
+   * @brief Callback function to be called when console message will be logged.
+   * @param[in] message The message logged.
+   */
+  void OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message);
+
 private:
   std::string                 mUrl;
   Dali::Toolkit::Visual::Base mVisual;
 private:
   std::string                 mUrl;
   Dali::Toolkit::Visual::Base mVisual;
@@ -674,6 +685,7 @@ private:
   Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
   Dali::Toolkit::WebView::WebViewFrameRenderedSignalType      mFrameRenderedSignal;
   Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
   Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
   Dali::Toolkit::WebView::WebViewFrameRenderedSignalType      mFrameRenderedSignal;
   Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
+  Dali::Toolkit::WebView::WebViewConsoleMessageSignalType     mConsoleMessageSignal;
 
   std::unique_ptr<Dali::Toolkit::WebContext>         mWebContext;
   std::unique_ptr<Dali::Toolkit::WebCookieManager>   mWebCookieManager;
 
   std::unique_ptr<Dali::Toolkit::WebContext>         mWebContext;
   std::unique_ptr<Dali::Toolkit::WebCookieManager>   mWebCookieManager;