2011-05-07  Joe Mason  <jmason@rim.com>

        Reviewed by Daniel Bates.

        FrameLoader::isProcessingUserGesture is wrong in dispatchWillPerformClientRedirect
        https://bugs.webkit.org/show_bug.cgi?id=52211

        Add willPerformClientRedirect to the user-gesture tests.

        * fast/frames/location-redirect-user-gesture-expected.txt:
        * fast/frames/meta-refresh-user-gesture-expected.txt:
2011-05-07  Joe Mason  <jmason@rim.com>

        Reviewed by Daniel Bates.

        FrameLoader::isProcessingUserGesture is wrong in dispatchWillPerformClientRedirect
        https://bugs.webkit.org/show_bug.cgi?id=52211

        Create a UserGestureIndicator when calling the clientRedirected callback.

        * loader/NavigationScheduler.cpp:
        (WebCore::ScheduledURLNavigation::didStartTimer):
        (WebCore::ScheduledURLNavigation::didStopTimer):
        (WebCore::ScheduledFormSubmission::didStartTimer):
        (WebCore::ScheduledFormSubmission::didStopTimer):
2011-05-07  Joe Mason  <jmason@rim.com>

        Reviewed by Daniel Bates.

        FrameLoader::isProcessingUserGesture is wrong in dispatchWillPerformClientRedirect
        https://bugs.webkit.org/show_bug.cgi?id=52211

        Dump isUserProcessingGesture in willPerformClientRedirect so that the layout tests can be extended.

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::dispatchWillPerformClientRedirect):
2011-05-07  Joe Mason  <jmason@rim.com>

        Reviewed by Daniel Bates.

        FrameLoader::isProcessingUserGesture is wrong in dispatchWillPerformClientRedirect
        https://bugs.webkit.org/show_bug.cgi?id=52211

        Dump isUserProcessingGesture in willPerformClientRedirect so that the layout tests can be extended.
        (For the Mac and Chromium ports - other ports don't support dumping user gestures in DRT.)

        * DumpRenderTree/chromium/WebViewHost.cpp:
        (WebViewHost::willPerformClientRedirect):
        (WebViewHost::didStartProvisionalLoad):
        * DumpRenderTree/mac/FrameLoadDelegate.mm:
        (-[FrameLoadDelegate webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86013 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp
index 65a4551..713a2c8 100644
--- a/Source/WebCore/loader/NavigationScheduler.cpp
+++ b/Source/WebCore/loader/NavigationScheduler.cpp
@@ -114,6 +114,8 @@
         if (m_haveToldClient)
             return;
         m_haveToldClient = true;
+
+        UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
         frame->loader()->clientRedirected(KURL(ParsedURLString, m_url), delay(), currentTime() + timer->nextFireInterval(), lockBackForwardList());
     }
 
@@ -121,6 +123,13 @@
     {
         if (!m_haveToldClient)
             return;
+
+        // Do not set a UserGestureIndicator because
+        // clientRedirectCancelledOrFinished() is also called from many places
+        // inside FrameLoader, where the gesture state is not set and is in
+        // fact unavailable. We need to be consistent with them, otherwise the
+        // gesture state will sometimes be set and sometimes not within
+        // dispatchDidCancelClientRedirect().
         frame->loader()->clientRedirectCancelledOrFinished(newLoadInProgress);
     }
 
@@ -224,6 +233,8 @@
         if (m_haveToldClient)
             return;
         m_haveToldClient = true;
+
+        UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
         frame->loader()->clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer->nextFireInterval(), lockBackForwardList());
     }
 
@@ -231,6 +242,13 @@
     {
         if (!m_haveToldClient)
             return;
+
+        // Do not set a UserGestureIndicator because
+        // clientRedirectCancelledOrFinished() is also called from many places
+        // inside FrameLoader, where the gesture state is not set and is in
+        // fact unavailable. We need to be consistent with them, otherwise the
+        // gesture state will sometimes be set and sometimes not within
+        // dispatchDidCancelClientRedirect().
         frame->loader()->clientRedirectCancelledOrFinished(newLoadInProgress);
     }