Diff
Modified: trunk/Source/WebKit2/ChangeLog (144663 => 144664)
--- trunk/Source/WebKit2/ChangeLog 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/ChangeLog 2013-03-04 21:38:38 UTC (rev 144664)
@@ -1,3 +1,42 @@
+2013-03-04 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
+
+ [WK2][EFL] Add callbacks to the WKViewClient to handle Web Process crash and relaunch
+ https://bugs.webkit.org/show_bug.cgi?id=109828
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Providing WKViewClient with Web Process crash and Web Process relaunch
+ callbacks brings better design as WebView should not be aware of
+ EFL-specific code handling the corresponding events.
+
+ The implementation of the mentioned Web Process callbacks was also added.
+
+ * UIProcess/API/C/efl/WKView.cpp:
+ (WKViewSetThemePath):
+ * UIProcess/API/C/efl/WKView.h:
+ * UIProcess/efl/ViewClientEfl.cpp:
+ (WebKit::ViewClientEfl::webProcessCrashed):
+ (WebKit):
+ (WebKit::ViewClientEfl::webProcessDidRelaunch):
+ (WebKit::ViewClientEfl::ViewClientEfl):
+ * UIProcess/efl/ViewClientEfl.h:
+ (ViewClientEfl):
+ * UIProcess/efl/WebView.cpp:
+ (WebKit::WebView::setThemePath):
+
+ Accepts WTF::String instead of WKStringRef as it is
+ more appropriate for C++ API implementation class.
+
+ (WebKit::WebView::processDidCrash):
+ (WebKit::WebView::didRelaunchProcess):
+ * UIProcess/efl/WebView.h:
+ (WebView):
+ * UIProcess/efl/WebViewClient.cpp:
+ (WebKit::WebViewClient::webProcessCrashed):
+ (WebKit):
+ (WebKit::WebViewClient::webProcessDidRelaunch):
+ * UIProcess/efl/WebViewClient.h:
+
2013-03-04 Anders Carlsson <ander...@apple.com>
Complete the plug-in URL string before sending it to the UI process
Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp 2013-03-04 21:38:38 UTC (rev 144664)
@@ -106,7 +106,7 @@
void WKViewSetThemePath(WKViewRef viewRef, WKStringRef theme)
{
- toImpl(viewRef)->setThemePath(theme);
+ toImpl(viewRef)->setThemePath(toImpl(theme)->string());
}
void WKViewSuspendActiveDOMObjectsAndAnimations(WKViewRef viewRef)
Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h 2013-03-04 21:38:38 UTC (rev 144664)
@@ -38,8 +38,10 @@
extern "C" {
#endif
+typedef void (*WKViewCallback)(WKViewRef view, const void* clientInfo);
typedef void (*WKViewViewNeedsDisplayCallback)(WKViewRef view, WKRect area, const void* clientInfo);
typedef void (*WKViewPageDidChangeContentsSizeCallback)(WKViewRef view, WKSize size, const void* clientInfo);
+typedef void (*WKViewWebProcessCrashedCallback)(WKViewRef view, WKURLRef url, const void* clientInfo);
struct WKViewClient {
int version;
@@ -48,6 +50,8 @@
// Version 0
WKViewViewNeedsDisplayCallback viewNeedsDisplay;
WKViewPageDidChangeContentsSizeCallback didChangeContentsSize;
+ WKViewWebProcessCrashedCallback webProcessCrashed;
+ WKViewCallback webProcessDidRelaunch;
};
typedef struct WKViewClient WKViewClient;
Modified: trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp 2013-03-04 21:38:38 UTC (rev 144664)
@@ -27,7 +27,8 @@
#include "ViewClientEfl.h"
#include "EwkView.h"
-#include "WKView.h"
+#include <WebKit2/WKString.h>
+#include <WebKit2/WKView.h>
using namespace EwkViewCallbacks;
@@ -50,6 +51,37 @@
ewkView->smartCallback<ContentsSizeChanged>().call(size);
}
+void ViewClientEfl::webProcessCrashed(WKViewRef, WKURLRef url, const void* clientInfo)
+{
+ EwkView* ewkView = toEwkView(clientInfo);
+
+ // Check if loading was ongoing, when web process crashed.
+ double loadProgress = WKPageGetEstimatedProgress(ewkView->wkPage());
+ if (loadProgress >= 0 && loadProgress < 1) {
+ loadProgress = 1;
+ ewkView->smartCallback<LoadProgress>().call(&loadProgress);
+ }
+
+ ewkView->smartCallback<TooltipTextUnset>().call();
+
+ bool handled = false;
+ ewkView->smartCallback<WebProcessCrashed>().call(&handled);
+
+ if (!handled) {
+ WKEinaSharedString urlString(url);
+ WARN("WARNING: The web process experienced a crash on '%s'.\n", static_cast<const char*>(urlString));
+
+ // Display an error page
+ ewk_view_html_string_load(ewkView->evasObject(), "The web process has crashed.", 0, urlString);
+ }
+}
+
+void ViewClientEfl::webProcessDidRelaunch(WKViewRef viewRef, const void* clientInfo)
+{
+ if (const char* themePath = toEwkView(clientInfo)->themePath())
+ WKViewSetThemePath(viewRef, adoptWK(WKStringCreateWithUTF8CString(themePath)).get());
+}
+
ViewClientEfl::ViewClientEfl(EwkView* view)
: m_view(view)
{
@@ -61,6 +93,8 @@
viewClient.clientInfo = this;
viewClient.didChangeContentsSize = didChangeContentsSize;
viewClient.viewNeedsDisplay = viewNeedsDisplay;
+ viewClient.webProcessCrashed = webProcessCrashed;
+ viewClient.webProcessDidRelaunch = webProcessDidRelaunch;
WKViewSetViewClient(m_view->wkView(), &viewClient);
}
Modified: trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h 2013-03-04 21:38:38 UTC (rev 144664)
@@ -49,6 +49,8 @@
static EwkView* toEwkView(const void* clientInfo);
static void viewNeedsDisplay(WKViewRef, WKRect area, const void* clientInfo);
static void didChangeContentsSize(WKViewRef, WKSize, const void* clientInfo);
+ static void webProcessCrashed(WKViewRef, WKURLRef, const void* clientInfo);
+ static void webProcessDidRelaunch(WKViewRef, const void* clientInfo);
EwkView* m_view;
};
Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.cpp (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/efl/WebView.cpp 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.cpp 2013-03-04 21:38:38 UTC (rev 144664)
@@ -128,9 +128,9 @@
return m_ewkView->evasObject();
}
-void WebView::setThemePath(WKStringRef theme)
+void WebView::setThemePath(const String& theme)
{
- m_page->setThemePath(toWTFString(theme).utf8().data());
+ m_page->setThemePath(theme);
}
void WebView::setDrawsBackground(bool drawsBackground)
@@ -297,32 +297,12 @@
void WebView::processDidCrash()
{
- // Check if loading was ongoing, when web process crashed.
- double loadProgress = ewk_view_load_progress_get(m_ewkView->evasObject());
- if (loadProgress >= 0 && loadProgress < 1) {
- loadProgress = 1;
- m_ewkView->smartCallback<LoadProgress>().call(&loadProgress);
- }
-
- m_ewkView->smartCallback<TooltipTextUnset>().call();
-
- bool handled = false;
- m_ewkView->smartCallback<WebProcessCrashed>().call(&handled);
-
- if (!handled) {
- CString url = ""
- WARN("WARNING: The web process experienced a crash on '%s'.\n", url.data());
-
- // Display an error page
- ewk_view_html_string_load(m_ewkView->evasObject(), "The web process has crashed.", 0, url.data());
- }
+ m_client.webProcessCrashed(this, m_page->urlAtProcessExit());
}
void WebView::didRelaunchProcess()
{
- const char* themePath = m_ewkView->themePath();
- if (themePath)
- m_page->setThemePath(themePath);
+ m_client.webProcessDidRelaunch(this);
}
void WebView::pageClosed()
Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.h (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/efl/WebView.h 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.h 2013-03-04 21:38:38 UTC (rev 144664)
@@ -68,7 +68,7 @@
void setDrawsTransparentBackground(bool);
bool drawsTransparentBackground() const;
- void setThemePath(WKStringRef);
+ void setThemePath(const String&);
void suspendActiveDOMObjectsAndAnimations();
void resumeActiveDOMObjectsAndAnimations();
Modified: trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp 2013-03-04 21:38:38 UTC (rev 144664)
@@ -27,6 +27,7 @@
#include "WebViewClient.h"
#include "WKAPICast.h"
+#include "WKRetainPtr.h"
using namespace WebCore;
@@ -48,4 +49,20 @@
m_client.didChangeContentsSize(toAPI(view), toAPI(size), m_client.clientInfo);
}
+void WebViewClient::webProcessCrashed(WebView* view, const String& url)
+{
+ if (!m_client.webProcessCrashed)
+ return;
+
+ m_client.webProcessCrashed(toAPI(view), adoptWK(toCopiedURLAPI(url)).get(), m_client.clientInfo);
+}
+
+void WebViewClient::webProcessDidRelaunch(WebView* view)
+{
+ if (!m_client.webProcessDidRelaunch)
+ return;
+
+ m_client.webProcessDidRelaunch(toAPI(view), m_client.clientInfo);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h (144663 => 144664)
--- trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h 2013-03-04 21:38:38 UTC (rev 144664)
@@ -28,6 +28,7 @@
#include "APIClient.h"
#include "WKView.h"
+#include <wtf/text/WTFString.h>
namespace WebCore {
class IntRect;
@@ -42,6 +43,8 @@
public:
void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
void didChangeContentsSize(WebView*, const WebCore::IntSize&);
+ void webProcessCrashed(WebView*, const String& url);
+ void webProcessDidRelaunch(WebView*);
};
} // namespace WebKit
Modified: trunk/Tools/ChangeLog (144663 => 144664)
--- trunk/Tools/ChangeLog 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Tools/ChangeLog 2013-03-04 21:38:38 UTC (rev 144664)
@@ -1,3 +1,28 @@
+2013-03-04 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
+
+ [WK2][EFL] Add callbacks to the WKViewClient to handle Web Process crash and relaunch
+ https://bugs.webkit.org/show_bug.cgi?id=109828
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Added API test for newly added Web Process crash and Web Process relaunch WKViewClient
+ callbacks.
+
+ * TestWebKitAPI/CMakeLists.txt:
+
+ Tests located in 'TestWebKitAPI/Tests/WebKit2' subdirectories are also
+ considered.
+
+ * TestWebKitAPI/PlatformEfl.cmake:
+ * TestWebKitAPI/Tests/WebKit2/efl/WKViewClientWebProcessCallbacks.cpp: Added.
+ (TestWebKitAPI):
+ (TestWebKitAPI::didFinishLoadForFrame):
+ (TestWebKitAPI::setPageLoaderClient):
+ (TestWebKitAPI::webProcessCrashed):
+ (TestWebKitAPI::webProcessDidRelaunch):
+ (TestWebKitAPI::setViewClient):
+ (TestWebKitAPI::TEST):
+
2013-03-04 Chris Fleizach <cfleiz...@apple.com>
AX: Upstream iOS Accessibility DumpRenderTree changes
Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (144663 => 144664)
--- trunk/Tools/TestWebKitAPI/CMakeLists.txt 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt 2013-03-04 21:38:38 UTC (rev 144664)
@@ -128,10 +128,11 @@
)
foreach (testName ${test_webkit2_api_BINARIES})
- add_executable(test_webkit2_api_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
- add_test(test_webkit2_api_${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webkit2_api_${testName})
- set_tests_properties(test_webkit2_api_${testName} PROPERTIES TIMEOUT 60)
- target_link_libraries(test_webkit2_api_${testName} ${test_webkit2_api_LIBRARIES})
+ get_filename_component(testBaseName ${testName} NAME)
+ add_executable(test_webkit2_api_${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
+ add_test(test_webkit2_api_${testBaseName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webkit2_api_${testBaseName})
+ set_tests_properties(test_webkit2_api_${testBaseName} PROPERTIES TIMEOUT 60)
+ target_link_libraries(test_webkit2_api_${testBaseName} ${test_webkit2_api_LIBRARIES})
endforeach ()
# We don't run tests that are expected to fail. We could use the WILL_FAIL
Modified: trunk/Tools/TestWebKitAPI/PlatformEfl.cmake (144663 => 144664)
--- trunk/Tools/TestWebKitAPI/PlatformEfl.cmake 2013-03-04 21:16:49 UTC (rev 144663)
+++ trunk/Tools/TestWebKitAPI/PlatformEfl.cmake 2013-03-04 21:38:38 UTC (rev 144664)
@@ -86,6 +86,7 @@
WKStringJSString
WKURL
WillSendSubmitEvent
+ efl/WKViewClientWebProcessCallbacks
)
set(test_webkit2_api_fail_BINARIES
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/efl/WKViewClientWebProcessCallbacks.cpp (0 => 144664)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/efl/WKViewClientWebProcessCallbacks.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/efl/WKViewClientWebProcessCallbacks.cpp 2013-03-04 21:38:38 UTC (rev 144664)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include "WKView.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+struct TestStatesData {
+ TestStatesData(WKViewRef view, WKURLRef url)
+ : view(view)
+ , url(url)
+ , didFinishLoad(false)
+ , didCrash(false)
+ , didRelaunch(false)
+ {
+ }
+
+ WKViewRef view;
+ WKURLRef url;
+ bool didFinishLoad;
+ bool didCrash;
+ bool didRelaunch;
+};
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void* clientInfo)
+{
+ TestStatesData* states = const_cast<TestStatesData*>(static_cast<const TestStatesData*>(clientInfo));
+ states->didFinishLoad = true;
+}
+
+static void setPageLoaderClient(WKPageRef page, const void* clientInfo)
+{
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+ loaderClient.clientInfo = clientInfo;
+
+ WKPageSetPageLoaderClient(page, &loaderClient);
+}
+
+void webProcessCrashed(WKViewRef view, WKURLRef url, const void* clientInfo)
+{
+ TestStatesData* states = const_cast<TestStatesData*>(static_cast<const TestStatesData*>(clientInfo));
+
+ EXPECT_EQ(states->view, view);
+ EXPECT_TRUE(WKURLIsEqual(url, states->url));
+
+ states->didCrash = true;
+}
+
+void webProcessDidRelaunch(WKViewRef view, const void* clientInfo)
+{
+ TestStatesData* states = const_cast<TestStatesData*>(static_cast<const TestStatesData*>(clientInfo));
+
+ EXPECT_EQ(states->view, view);
+
+ states->didRelaunch = true;
+}
+
+static void setViewClient(WKViewRef view, const void* clientInfo)
+{
+ WKViewClient viewClient;
+ memset(&viewClient, 0, sizeof(WKViewClient));
+
+ viewClient.version = kWKViewClientCurrentVersion;
+ viewClient.clientInfo = clientInfo;
+ viewClient.webProcessCrashed = webProcessCrashed;
+ viewClient.webProcessDidRelaunch = webProcessDidRelaunch;
+
+ WKViewSetViewClient(view, &viewClient);
+}
+
+TEST(WebKit2, WKViewClientWebProcessCallbacks)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+ WKRetainPtr<WKURLRef> url = "" "html");
+
+ PlatformWebView view(context.get());
+
+ TestStatesData states = TestStatesData(view.platformView(), url.get());
+
+ setPageLoaderClient(view.page(), &states);
+ setViewClient(view.platformView(), &states);
+
+ WKPageLoadURL(view.page(), url.get());
+ Util::run(&states.didFinishLoad);
+
+ WKPageTerminate(view.page());
+ Util::run(&states.didCrash);
+
+ WKPageReload(view.page());
+ Util::run(&states.didRelaunch);
+}
+
+} // namespace TestWebKitAPI