Make sure preloaded tabs have unique IDs.

Bug: 5251821
Change-Id: I6dd7561a2461805912268a5faf967199cf39fd8c
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 932a811..0668b74 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -170,6 +170,12 @@
     }
 
     void addPreloadedTab(Tab tab) {
+        for (Tab current : mTabs) {
+            if (current != null && current.getId() == tab.getId()) {
+                throw new IllegalStateException("Tab with id " + tab.getId() + " already exists: "
+                        + current.toString());
+            }
+        }
         mTabs.add(tab);
         tab.setController(mController);
         mController.onSetWebView(tab, tab.getWebView());