Index: content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java |
index fdae8f3a3afe3a0c9de2649107d28757a127c843..730379a49f4534b3e1c0ebc1be782735694f1c3f 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java |
@@ -224,7 +224,14 @@ class WebContentsObserverProxy extends WebContentsObserver { |
// Java-based WebContents) are quite different, so we explicitly avoid |
// calling it here. |
ThreadUtils.assertOnUiThread(); |
+ for (mObserversIterator.rewind(); mObserversIterator.hasNext();) { |
+ mObserversIterator.next().destroy(); |
+ } |
+ // All observer destroy() implementations should result in their removal |
+ // from the proxy. |
+ assert mObservers.isEmpty(); |
mObservers.clear(); |
+ |
if (mNativeWebContentsObserverProxy != 0) { |
nativeDestroy(mNativeWebContentsObserverProxy); |
mNativeWebContentsObserverProxy = 0; |