Modified: trunk/Source/WebKit2/ChangeLog (176132 => 176133)
--- trunk/Source/WebKit2/ChangeLog 2014-11-14 19:25:34 UTC (rev 176132)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-14 20:05:26 UTC (rev 176133)
@@ -1,3 +1,26 @@
+2014-11-14 Dan Bernstein <m...@apple.com>
+
+ Add some tracing to help investigating <rdar://problem/18905383> [iOS] Crash due to null m_webPageProxyForBackForwardListForCurrentSwipe in ViewGestureController::endSwipeGesture
+ https://bugs.webkit.org/show_bug.cgi?id=138750
+
+ Reviewed by Tim Horton.
+
+ Emit trace messages at various points, and log them prior to crashing if the error condition
+ occurs. Otherwise, clear the trace messages.
+
+ * UIProcess/ios/ViewGestureControllerIOS.mm:
+ (WebKit::addLogEntry): Helper function that adds a message, including a time stamp and a
+ backtrace, to m_logEntries.
+ (WebKit::dumpLogEntries): Helper function that logs everything in m_logEntries.
+ (WebKit::ViewGestureController::beginSwipeGesture): Add a log entry.
+ (WebKit::ViewGestureController::endSwipeGesture): If
+ m_webPageProxyForBackForwardListForCurrentSwipe is null, dump the log entries just before
+ crashing. Otherwise, clear m_logEntries.
+ (WebKit::ViewGestureController::willCommitPostSwipeTransitionLayerTree): Add a log entry.
+ (WebKit::ViewGestureController::removeSwipeSnapshot): Add a log entry.
+ * UIProcess/mac/ViewGestureController.h: Defined ENABLE_VIEW_GESTURE_CONTROLLER_TRACING,
+ and added m_logEntries member variable.
+
2014-11-14 Beth Dakin <bda...@apple.com>
URLs for some videos are not valid URLs, should not be exposed to action menu
Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (176132 => 176133)
--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm 2014-11-14 19:25:34 UTC (rev 176132)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm 2014-11-14 20:05:26 UTC (rev 176133)
@@ -46,6 +46,7 @@
#import <UIKit/_UINavigationParallaxTransition.h>
#import <WebCore/IOSurface.h>
#import <wtf/NeverDestroyed.h>
+#import <wtf/text/StringBuilder.h>
using namespace WebCore;
@@ -170,6 +171,32 @@
m_liveSwipeView = swipingView;
}
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+static void addLogEntry(Vector<String>& entries, const String& message)
+{
+ void* stack[32];
+ int size = WTF_ARRAY_LENGTH(stack);
+ WTFGetBacktrace(stack, &size);
+ StringBuilder stringBuilder;
+ stringBuilder.append(String::format("%f [ ]", CFAbsoluteTimeGetCurrent()));
+ for (int i = 2; i < size; ++i) {
+ if (i > 2)
+ stringBuilder.appendLiteral(", ");
+ stringBuilder.append(String::format("%p", stack[i]));
+ }
+ stringBuilder.appendLiteral(" ] ");
+ stringBuilder.append(message);
+ entries.append(stringBuilder.toString());
+}
+
+static void dumpLogEntries(const Vector<String>& entries, WebPageProxy* webPageProxy)
+{
+ for (const auto& entry: entries)
+ WTFLogAlways(entry.utf8().data());
+ WTFLogAlways("m_webPageProxy: %p", webPageProxy);
+}
+#endif
+
void ViewGestureController::beginSwipeGesture(_UINavigationInteractiveTransitionBase *transition, SwipeDirection direction)
{
if (m_activeGestureType != ViewGestureType::None)
@@ -178,6 +205,9 @@
m_webPageProxy.recordNavigationSnapshot();
m_webPageProxyForBackForwardListForCurrentSwipe = m_alternateBackForwardListSourceView.get() ? m_alternateBackForwardListSourceView.get()->_page : &m_webPageProxy;
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+ addLogEntry(m_logEntries, String::format("m_webPageProxyForBackForwardListForCurrentSwipe: %p", m_webPageProxyForBackForwardListForCurrentSwipe.get()));
+#endif
m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidBegin();
auto& backForwardList = m_webPageProxyForBackForwardListForCurrentSwipe->backForwardList();
@@ -279,7 +309,14 @@
// removeSwipeSnapshot will clear m_webPageProxyForBackForwardListForCurrentSwipe, so hold on to it here.
RefPtr<WebPageProxy> webPageProxyForBackForwardListForCurrentSwipe = m_webPageProxyForBackForwardListForCurrentSwipe;
removeSwipeSnapshot();
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+ if (!webPageProxyForBackForwardListForCurrentSwipe)
+ dumpLogEntries(m_logEntries, &m_webPageProxy);
+ m_logEntries.clear();
+#endif
+
webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidEnd(false, *targetItem);
+
return;
}
@@ -287,6 +324,12 @@
if (ViewSnapshot* snapshot = targetItem->snapshot())
m_snapshotRemovalTargetRenderTreeSize = snapshot->renderTreeSize() * swipeSnapshotRemovalRenderTreeSizeTargetFraction;
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+ if (!m_webPageProxyForBackForwardListForCurrentSwipe)
+ dumpLogEntries(m_logEntries, &m_webPageProxy);
+ m_logEntries.clear();
+#endif
+
m_webPageProxyForBackForwardListForCurrentSwipe->navigationGestureDidEnd(true, *targetItem);
m_webPageProxyForBackForwardListForCurrentSwipe->goToBackForwardItem(targetItem);
@@ -307,6 +350,9 @@
void ViewGestureController::willCommitPostSwipeTransitionLayerTree(bool successful)
{
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+ addLogEntry(m_logEntries, String::format("successful: %d; m_activeGestureType: %d; m_webPageProxyForBackForwardListForCurrentSwipe: %p", successful, m_activeGestureType, m_webPageProxyForBackForwardListForCurrentSwipe.get()));
+#endif
if (m_activeGestureType != ViewGestureType::Swipe)
return;
@@ -341,6 +387,9 @@
m_swipeWatchdogTimer.stop();
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+ addLogEntry(m_logEntries, String::format("m_activeGestureType: %d; m_webPageProxyForBackForwardListForCurrentSwipe: %p", m_activeGestureType, m_webPageProxyForBackForwardListForCurrentSwipe.get()));
+#endif
if (m_activeGestureType != ViewGestureType::Swipe)
return;
Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (176132 => 176133)
--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h 2014-11-14 19:25:34 UTC (rev 176132)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h 2014-11-14 20:05:26 UTC (rev 176133)
@@ -33,6 +33,8 @@
#include <wtf/RetainPtr.h>
#include <wtf/RunLoop.h>
+#define ENABLE_VIEW_GESTURE_CONTROLLER_TRACING 1
+
OBJC_CLASS CALayer;
#if PLATFORM(IOS)
@@ -213,7 +215,10 @@
bool m_shouldRemoveSnapshotWhenTargetRenderTreeSizeHit;
WeakObjCPtr<WKWebView> m_alternateBackForwardListSourceView;
RefPtr<WebPageProxy> m_webPageProxyForBackForwardListForCurrentSwipe;
+#if ENABLE(VIEW_GESTURE_CONTROLLER_TRACING)
+ Vector<String> m_logEntries;
#endif
+#endif
};
} // namespace WebKit