Diff
Modified: trunk/LayoutTests/ChangeLog (189391 => 189392)
--- trunk/LayoutTests/ChangeLog 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/LayoutTests/ChangeLog 2015-09-04 22:09:57 UTC (rev 189392)
@@ -1,3 +1,25 @@
+2015-09-04 Tim Horton <[email protected]>
+
+ Add a test for r179736 (programmatic navigation during swipe causing a crash)
+ https://bugs.webkit.org/show_bug.cgi?id=148830
+
+ Reviewed by Beth Dakin.
+
+ * swipe/basic-cached-back-swipe.html:
+ * swipe/pushState-cached-back-swipe.html:
+ * swipe/resources/swipe-test.js:
+ (eventQueue.callAfterEventDispatch):
+ (initializeSwipeTest):
+ (initializeLog): Deleted.
+ * swipe/swipe-start-hysteresis-failures.html:
+ Refactor some things.
+ Make sure that we reset the back forward list before testing, because we expect
+ to start at the "first" item, but there is actually a about:blank before us.
+
+ * swipe/pushState-programmatic-back-while-swiping-crash-expected.txt: Added.
+ * swipe/pushState-programmatic-back-while-swiping-crash.html: Added.
+ Add a test that ensures that r179736 does not recur.
+
2015-09-04 Beth Dakin <[email protected]>
Should have a test for selection behavior when force clicking text
Modified: trunk/LayoutTests/swipe/basic-cached-back-swipe.html (189391 => 189392)
--- trunk/LayoutTests/swipe/basic-cached-back-swipe.html 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/LayoutTests/swipe/basic-cached-back-swipe.html 2015-09-04 22:09:57 UTC (rev 189392)
@@ -70,10 +70,8 @@
document.body.innerHTML = isFirstPage() ? "first" : "second";
if (isFirstPage()) {
- initializeLog();
+ initializeSwipeTest();
- testRunner.setNavigationGesturesEnabled(true);
-
testRunner.installDidBeginSwipeCallback(didBeginSwipeCallback);
testRunner.installWillEndSwipeCallback(willEndSwipeCallback);
testRunner.installDidEndSwipeCallback(didEndSwipeCallback);
Modified: trunk/LayoutTests/swipe/pushState-cached-back-swipe.html (189391 => 189392)
--- trunk/LayoutTests/swipe/pushState-cached-back-swipe.html 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/LayoutTests/swipe/pushState-cached-back-swipe.html 2015-09-04 22:09:57 UTC (rev 189392)
@@ -74,10 +74,8 @@
updateContent();
- initializeLog();
+ initializeSwipeTest();
- testRunner.setNavigationGesturesEnabled(true);
-
testRunner.installDidBeginSwipeCallback(didBeginSwipeCallback);
testRunner.installWillEndSwipeCallback(willEndSwipeCallback);
testRunner.installDidEndSwipeCallback(didEndSwipeCallback);
Added: trunk/LayoutTests/swipe/pushState-programmatic-back-while-swiping-crash-expected.txt (0 => 189392)
--- trunk/LayoutTests/swipe/pushState-programmatic-back-while-swiping-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/swipe/pushState-programmatic-back-while-swiping-crash-expected.txt 2015-09-04 22:09:57 UTC (rev 189392)
@@ -0,0 +1,7 @@
+swipe event (delta 0 0, phase 'maybegin')
+scroll event (delta 1 0, phase 'began')
+scroll event (delta 1 0, phase 'changed')
+swipe event (delta 1 0, phase 'changed')
+swipe event (delta 256 0, phase 'changed')
+swipe event (delta 0 0, phase 'ended')
+
Added: trunk/LayoutTests/swipe/pushState-programmatic-back-while-swiping-crash.html (0 => 189392)
--- trunk/LayoutTests/swipe/pushState-programmatic-back-while-swiping-crash.html (rev 0)
+++ trunk/LayoutTests/swipe/pushState-programmatic-back-while-swiping-crash.html 2015-09-04 22:09:57 UTC (rev 189392)
@@ -0,0 +1,89 @@
+<head>
+<style>
+html {
+ font-size: 32pt;
+}
+</style>
+<script src=""
+<script>
+function startSwipeGesture()
+{
+ eventSender.mouseMoveTo(100, 100);
+
+ eventQueue.enqueueSwipeEvent(0, 0, 'maybegin');
+ eventQueue.enqueueScrollEvent(1, 0, 'began');
+
+ eventQueue.callAfterEventDispatch(goBack);
+}
+
+function goBack()
+{
+ window.history.back();
+
+ eventQueue.callAfterEventDispatch(continueSwipeGesture);
+}
+
+function continueSwipeGesture()
+{
+ eventQueue.enqueueScrollEvent(1, 0, 'changed');
+
+ eventQueue.callAfterEventDispatch(completeSwipeGesture);
+}
+
+function completeSwipeGesture()
+{
+ eventQueue.enqueueSwipeEvent(1, 0, 'changed');
+ eventQueue.enqueueSwipeEvent(256, 0, 'changed');
+ eventQueue.enqueueSwipeEvent(0, 0, 'ended');
+
+ eventQueue.callAfterEventDispatch(testComplete);
+}
+
+function didBeginSwipeCallback()
+{
+ log("Failed. Should not begin swipe; we've already navigated away from the item where the swipe started, and there is no other back item.");
+}
+
+function isFirstPage()
+{
+ return window.location.href.indexOf("second") == -1;
+}
+
+function updateContent()
+{
+ document.body.innerHTML = isFirstPage() ? "first" : "second";
+}
+
+window._onload_ = function () {
+ if (!window.eventSender || !window.testRunner) {
+ document.body.innerHTML = "This test must be run in WebKitTestRunner.";
+ return;
+ }
+
+ updateContent();
+
+ initializeSwipeTest();
+
+ testRunner.installDidBeginSwipeCallback(didBeginSwipeCallback);
+
+ testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+
+ window.addEventListener("popstate", function(e) {
+ updateContent();
+ });
+
+ setTimeout(function () {
+ history.pushState(null, null, "/second");
+ updateContent();
+
+ setTimeout(function () {
+ startSwipeGesture();
+ }, 0);
+ }, 0);
+};
+</script>
+</head>
+<body>
+</body>
\ No newline at end of file
Modified: trunk/LayoutTests/swipe/resources/swipe-test.js (189391 => 189392)
--- trunk/LayoutTests/swipe/resources/swipe-test.js 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/LayoutTests/swipe/resources/swipe-test.js 2015-09-04 22:09:57 UTC (rev 189392)
@@ -19,6 +19,15 @@
return this._queue.length != 0;
},
+ callAfterEventDispatch: function (callback) {
+ var interval = setInterval(function () {
+ if (!eventQueue.hasPendingEvents()) {
+ clearInterval(interval);
+ callback();
+ }
+ }, 0);
+ },
+
_queue: [],
_processEventQueue: function () {
@@ -58,9 +67,11 @@
window.testRunner.notifyDone();
}
-function initializeLog()
+function initializeSwipeTest()
{
window.localStorage["swipeLogging"] = "";
+ testRunner.setNavigationGesturesEnabled(true);
+ testRunner.clearBackForwardList();
}
function startMeasuringDuration(key)
Modified: trunk/LayoutTests/swipe/swipe-start-hysteresis-failures.html (189391 => 189392)
--- trunk/LayoutTests/swipe/swipe-start-hysteresis-failures.html 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/LayoutTests/swipe/swipe-start-hysteresis-failures.html 2015-09-04 22:09:57 UTC (rev 189392)
@@ -16,7 +16,7 @@
eventQueue.enqueueScrollEvent(0, 0, 'changed');
eventQueue.enqueueScrollEvent(0, 0, 'ended');
- waitForEventDispatch(doDiagonalSwipeGesture);
+ eventQueue.callAfterEventDispatch(doDiagonalSwipeGesture);
}
function doDiagonalSwipeGesture()
@@ -28,7 +28,7 @@
eventQueue.enqueueScrollEvent(0, 0, 'changed');
eventQueue.enqueueScrollEvent(0, 0, 'ended');
- waitForEventDispatch(doVerticalSwipeGesture);
+ eventQueue.callAfterEventDispatch(doVerticalSwipeGesture);
}
function doVerticalSwipeGesture()
@@ -40,7 +40,7 @@
eventQueue.enqueueScrollEvent(0, 0, 'changed');
eventQueue.enqueueScrollEvent(0, 0, 'ended');
- waitForEventDispatch(doHorizontalThenVerticalSwipeGesture);
+ eventQueue.callAfterEventDispatch(doHorizontalThenVerticalSwipeGesture);
}
function doHorizontalThenVerticalSwipeGesture()
@@ -52,7 +52,7 @@
eventQueue.enqueueScrollEvent(0, 2, 'changed');
eventQueue.enqueueScrollEvent(0, 0, 'ended');
- waitForEventDispatch(doRegularSwipeGesture);
+ eventQueue.callAfterEventDispatch(doRegularSwipeGesture);
}
function doRegularSwipeGesture()
@@ -78,16 +78,6 @@
eventQueue.enqueueScrollEvent(0, 0, 'ended');
}
-function waitForEventDispatch(callback)
-{
- var interval = setInterval(function () {
- if (!eventQueue.hasPendingEvents()) {
- clearInterval(interval);
- callback();
- }
- }, 0);
-}
-
function didBeginSwipeNotReachedCallback()
{
log("Failure. Should never begin a swipe, because all of the attempted swipes should fail due to the swipe-start hysteresis.");
@@ -107,10 +97,8 @@
document.body.innerHTML = isFirstPage() ? "first" : "second";
if (isFirstPage()) {
- initializeLog();
+ initializeSwipeTest();
- testRunner.setNavigationGesturesEnabled(true);
-
testRunner.installDidBeginSwipeCallback(didBeginSwipeNotReachedCallback);
testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
Modified: trunk/Tools/ChangeLog (189391 => 189392)
--- trunk/Tools/ChangeLog 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/Tools/ChangeLog 2015-09-04 22:09:57 UTC (rev 189392)
@@ -1,3 +1,14 @@
+2015-09-04 Tim Horton <[email protected]>
+
+ Add a test for r179736 (programmatic navigation during swipe causing a crash)
+ https://bugs.webkit.org/show_bug.cgi?id=148830
+
+ Reviewed by Beth Dakin.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::beginTesting):
+ Make sure that TestRunner callbacks don't leak between tests!
+
2015-09-04 Anders Carlsson <[email protected]>
It should be possible to pass relative HTTP test paths to DumpRenderTree
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (189391 => 189392)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2015-09-04 22:08:28 UTC (rev 189391)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2015-09-04 22:09:57 UTC (rev 189392)
@@ -289,6 +289,7 @@
m_testRunner->setCloseRemainingWindowsWhenComplete(false);
m_testRunner->setAcceptsEditing(true);
m_testRunner->setTabKeyCyclesThroughElements(true);
+ m_testRunner->clearTestRunnerCallbacks();
if (m_timeout > 0)
m_testRunner->setCustomTimeout(m_timeout);