summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebHistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/jni/WebHistory.cpp')
-rw-r--r--WebKit/android/jni/WebHistory.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp
index 191f818..647dfb4 100644
--- a/WebKit/android/jni/WebHistory.cpp
+++ b/WebKit/android/jni/WebHistory.cpp
@@ -242,6 +242,14 @@ WebHistoryItem::~WebHistoryItem() {
}
}
+void WebHistoryItem::detach(WebCore::HistoryItem* item) {
+ if (mHistoryItem == item) {
+ mHistoryItem = NULL;
+ } else if (mHistoryItem) {
+ LOGE("WebHistoryItem::detach doesn't have a matching HistoryItem");
+ }
+}
+
void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) {
// Do not want to update during inflation.
if (!m_active)
@@ -261,6 +269,13 @@ void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) {
while (webItem->parent())
webItem = webItem->parent();
item = webItem->historyItem();
+ if (!item) {
+ // If a HistoryItem only exists for page cache, it is possible that
+ // the parent HistoryItem destroyed before the child HistoryItem. If
+ // it happens, skip updating.
+ LOGW("Can't updateHistoryItem as the top HistoryItem is gone");
+ return;
+ }
}
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)