Clear prerender history when loading a new page.

Following the recommendation in the bug below.
bug:5030881

Change-Id: Iae1e432e735e443ab03ec1bda6576db638a674a0
diff --git a/src/com/android/browser/PreloadController.java b/src/com/android/browser/PreloadController.java
index 11586ea..652ea8e 100644
--- a/src/com/android/browser/PreloadController.java
+++ b/src/com/android/browser/PreloadController.java
@@ -81,11 +81,25 @@
     @Override
     public void onPageStarted(Tab tab, WebView view, Bitmap favicon) {
         if (LOGD_ENABLED) Log.d(LOGTAG, "onPageStarted()");
+        if (view != null) {
+            // Clear history of all previously visited pages. When the
+            // user visits a preloaded tab, the only item in the history
+            // list should the currently viewed page.
+            view.clearHistory();
+        }
     }
 
     @Override
     public void onPageFinished(Tab tab) {
         if (LOGD_ENABLED) Log.d(LOGTAG, "onPageFinished()");
+        if (tab != null) {
+            final WebView view = tab.getWebView();
+            if (view != null) {
+                // Clear history of all previously visited pages. When the
+                // user visits a preloaded tab.
+                view.clearHistory();
+            }
+        }
     }
 
     @Override