Commit ff211541 authored by bweinstein@apple.com's avatar bweinstein@apple.com

Source/WebKit2: After relaunching an unresponsive web process, web page stops...

Source/WebKit2: After relaunching an unresponsive web process, web page stops responding to mouse movement
https://bugs.webkit.org/show_bug.cgi?id=60669
<rdar://problem/9409934>

Reviewed by Anders Carlsson.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidCrash): Set m_processingMouseMoveEvent to false when the WebProcess
    crashes.

Tools: After relaunching an unresponsive web process, web page stops responding to mouse movement
https://bugs.webkit.org/show_bug.cgi?id=60669
<rdar://problem/9409934>
        
Reviewed by Anders Carlsson.

This test follows the steps needed to reproduce this bug:
1) Hang the web process
2) While the web process is hung, move the mouse (so WebPageProxy thinks it is processing a mouse move event)
3) Kill and restart the WebProcess
4) Move the mouse
        
We are testing that we receive mouse move events after the WebProcess has restarted.

* TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame): Set a flag that we finished loading.
(TestWebKitAPI::processDidBecomeUnresponsive): Kill the web process once we become unresponsive.
(TestWebKitAPI::processDidCrash): Reload the page when the process crashes, which restarts the web process.
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp: Added.
(TestWebKitAPI::MouseMoveAfterCrashTest::MouseMoveAfterCrashTest):
(TestWebKitAPI::MouseMoveAfterCrashTest::didReceiveMessage):
* TestWebKitAPI/Tests/WebKit2/mouse-move-listener.html: Added.

* TestWebKitAPI/PlatformWebView.h:
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::simulateMouseMove): Sends the messages that simulate a mouse move.
* TestWebKitAPI/win/PlatformWebViewWin.cpp:
(TestWebKitAPI::PlatformWebView::simulateMouseMove): Ditto.

Add new files.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/win/TestWebKitAPI.vcproj:
* TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj:
* TestWebKitAPI/win/copy-resources.cmd:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0f8a9043
2011-05-11 Brian Weinstein <bweinstein@apple.com>
Reviewed by Anders Carlsson.
After relaunching an unresponsive web process, web page stops responding to mouse movement
https://bugs.webkit.org/show_bug.cgi?id=60669
<rdar://problem/9409934>
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processDidCrash): Set m_processingMouseMoveEvent to false when the WebProcess
crashes.
2011-05-10 Tony Gentilcore <tonyg@chromium.org>
Reviewed by Darin Adler.
......
......@@ -2903,6 +2903,8 @@ void WebPageProxy::processDidCrash()
m_nextMouseMoveEvent = nullptr;
m_currentlyProcessedMouseDownEvent = nullptr;
m_processingMouseMoveEvent = false;
#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
dismissCorrectionPanel(ReasonForDismissingCorrectionPanelIgnored);
m_pageClient->dismissDictionaryLookupPanel();
......
2011-05-11 Brian Weinstein <bweinstein@apple.com>
Reviewed by Anders Carlsson.
After relaunching an unresponsive web process, web page stops responding to mouse movement
https://bugs.webkit.org/show_bug.cgi?id=60669
<rdar://problem/9409934>
This test follows the steps needed to reproduce this bug:
1) Hang the web process
2) While the web process is hung, move the mouse (so WebPageProxy thinks it is processing a mouse move event)
3) Kill and restart the WebProcess
4) Move the mouse
We are testing that we receive mouse move events after the WebProcess has restarted.
* TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame): Set a flag that we finished loading.
(TestWebKitAPI::processDidBecomeUnresponsive): Kill the web process once we become unresponsive.
(TestWebKitAPI::processDidCrash): Reload the page when the process crashes, which restarts the web process.
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp: Added.
(TestWebKitAPI::MouseMoveAfterCrashTest::MouseMoveAfterCrashTest):
(TestWebKitAPI::MouseMoveAfterCrashTest::didReceiveMessage):
* TestWebKitAPI/Tests/WebKit2/mouse-move-listener.html: Added.
* TestWebKitAPI/PlatformWebView.h:
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::simulateMouseMove): Sends the messages that simulate a mouse move.
* TestWebKitAPI/win/PlatformWebViewWin.cpp:
(TestWebKitAPI::PlatformWebView::simulateMouseMove): Ditto.
Add new files.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/win/TestWebKitAPI.vcproj:
* TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj:
* TestWebKitAPI/win/copy-resources.cmd:
2011-05-12 Tomasz Morawski <t.morawski@samsung.com>
Reviewed by Antonio Gomes.
......
......@@ -66,6 +66,7 @@ public:
void simulateSpacebarKeyPress();
void simulateAltKeyPress();
void simulateRightClick(unsigned x, unsigned y);
void simulateMouseMove(unsigned x, unsigned y);
#if PLATFORM(WIN)
void simulateAKeyDown();
......
......@@ -13,6 +13,9 @@
1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */; };
1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; };
333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */; };
33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */; };
33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; };
33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
4BFDFFA9131477770061F24B /* HitTestResultNodeHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */; };
BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
......@@ -87,6 +90,7 @@
dstPath = "";
dstSubfolderSpec = 7;
files = (
33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */,
BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */,
1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */,
BC909784125571CF00083756 /* simple.html in Copy Resources */,
......@@ -107,6 +111,9 @@
1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ForceRepaint.cpp; sourceTree = "<group>"; };
1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; sourceTree = "<group>"; };
333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; };
33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; };
33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash_Bundle.cpp; sourceTree = "<group>"; };
33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle_Bundle.cpp; sourceTree = "<group>"; };
4BFDFFA8131477770061F24B /* HitTestResultNodeHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestResultNodeHandle.cpp; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -285,6 +292,8 @@
4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */,
BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */,
33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */,
BC909779125571AB00083756 /* PageLoadBasic.cpp */,
BC2D004812A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp */,
333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */,
......@@ -313,6 +322,7 @@
BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
1A02C84B125D4A5E00E3F4BD /* find.html */,
BCBD372E125ABBE600D2C29F /* icon.png */,
33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */,
1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */,
C0ADBE8412FCA6B600D2C129 /* simple-form.html */,
BC909778125571AB00083756 /* simple.html */,
......@@ -448,6 +458,7 @@
BC246D8E132F115A00B56D7C /* AboutBlankLoad.cpp in Sources */,
BC246D9A132F1FE100B56D7C /* CanHandleRequest.cpp in Sources */,
F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */,
33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -464,6 +475,7 @@
4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */,
C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */,
BC246D9C132F1FF000B56D7C /* CanHandleRequest_Bundle.cpp in Sources */,
33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
/*
* Copyright (C) 2011 Apple Inc. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS 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 "Test.h"
#include "JavaScriptTest.h"
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
namespace TestWebKitAPI {
static bool didFinishLoad;
static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
{
didFinishLoad = true;
}
static void processDidCrash(WKPageRef page, const void*)
{
WKPageReload(page);
}
static void setPageLoaderClient(WKPageRef page)
{
WKPageLoaderClient loaderClient;
memset(&loaderClient, 0, sizeof(loaderClient));
loaderClient.version = 0;
loaderClient.clientInfo = 0;
loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
loaderClient.processDidCrash = processDidCrash;
WKPageSetPageLoaderClient(page, &loaderClient);
}
TEST(WebKit2, MouseMoveAfterCrash)
{
WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("MouseMoveAfterCrashTest"));
PlatformWebView webView(context.get());
setPageLoaderClient(webView.page());
WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("mouse-move-listener", "html"));
WKPageLoadURL(webView.page(), url.get());
Util::run(&didFinishLoad);
didFinishLoad = false;
WKContextPostMessageToInjectedBundle(context.get(), Util::toWK("Pause").get(), 0);
webView.simulateSpacebarKeyPress();
// Move the mouse once we are hung.
webView.simulateMouseMove(10, 10);
webView.simulateMouseMove(20, 20);
// After moving the mouse (while the web process was hung on the Pause message), kill the web process. It is restarted in
// processDidCrash by reloading the page.
WKPageTerminate(webView.page());
// Wait until we load the page a second time (via reloading the page in processDidCrash).
Util::run(&didFinishLoad);
TEST_ASSERT(runJSTest(webView.page(), "didMoveMouse()", "false"));
// Once the page has reloaded, try moving the mouse to verify that we get mouse move events.
webView.simulateMouseMove(10, 10);
webView.simulateMouseMove(20, 20);
TEST_ASSERT(runJSTest(webView.page(), "didMoveMouse()", "true"));
}
} // namespace TestWebKitAPI
/*
* Copyright (C) 2011 Apple Inc. 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS 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 "InjectedBundleTest.h"
#include "PlatformUtilities.h"
namespace TestWebKitAPI {
class MouseMoveAfterCrashTest : public InjectedBundleTest {
public:
MouseMoveAfterCrashTest(const std::string& identifier);
private:
virtual void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody);
};
static InjectedBundleTest::Register<MouseMoveAfterCrashTest> registrar("MouseMoveAfterCrashTest");
MouseMoveAfterCrashTest::MouseMoveAfterCrashTest(const std::string& identifier)
: InjectedBundleTest(identifier)
{
}
void MouseMoveAfterCrashTest::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef)
{
if (!WKStringIsEqualToUTF8CString(messageName, "Pause"))
return;
Util::sleep(30);
}
} // namespace TestWebKitAPI
<!DOCTYPE html>
<script>
var mouseMoved = false;
function mouseMoveHandler()
{
mouseMoved = true;
}
function didMoveMouse()
{
return mouseMoved;
}
addEventListener("mousemove", mouseMoveHandler);
</script>
......@@ -122,5 +122,21 @@ void PlatformWebView::simulateRightClick(unsigned x, unsigned y)
[m_view rightMouseUp:event];
}
void PlatformWebView::simulateMouseMove(unsigned x, unsigned y)
{
NSEvent *event = [NSEvent mouseEventWithType:NSMouseMoved
location:NSMakePoint(x, y)
modifierFlags:0
timestamp:GetCurrentEventTime()
windowNumber:[m_window windowNumber]
context:[NSGraphicsContext currentContext]
eventNumber:0
clickCount:0
pressure:0];
[m_view mouseMoved:event];
}
} // namespace TestWebKitAPI
......@@ -117,6 +117,13 @@ void PlatformWebView::simulateRightClick(unsigned x, unsigned y)
::SendMessageW(window, WM_RBUTTONUP, 0, MAKELPARAM(x, y));
}
void PlatformWebView::simulateMouseMove(unsigned x, unsigned y)
{
HWND window = WKViewGetWindow(m_view);
::SendMessageW(window, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));
}
LRESULT PlatformWebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PlatformWebView* webView;
......
......@@ -471,6 +471,14 @@
RelativePath="..\Tests\WebKit2\InjectedBundleBasic.cpp"
>
</File>
<File
RelativePath="..\Tests\WebKit2\mouse-move-listener.html"
>
</File>
<File
RelativePath="..\Tests\WebKit2\MouseMoveAfterCrash.cpp"
>
</File>
<File
RelativePath="..\Tests\WebKit2\PageLoadBasic.cpp"
>
......
......@@ -415,6 +415,10 @@
RelativePath="..\Tests\WebKit2\InjectedBundleBasic_Bundle.cpp"
>
</File>
<File
RelativePath="..\Tests\WebKit2\MouseMoveAfterCrash_Bundle.cpp"
>
</File>
<File
RelativePath="..\Tests\WebKit2\ResponsivenessTimerDoesntFireEarly_Bundle.cpp"
>
......
......@@ -11,6 +11,7 @@ for %%f in (
..\Tests\WebKit2\file-with-anchor.html
..\Tests\WebKit2\find.html
..\Tests\WebKit2\icon.png
..\Tests\WebKit2\mouse-move-listener.html
..\Tests\WebKit2\simple.html
..\Tests\WebKit2\simple-accelerated-compositing.html
..\Tests\WebKit2\simple-form.html
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment