Bug 669196 - Patch 2: Handle more failures from shistory gracefully, so session restore keeps updating. [r=gavin]
authorPaul O’Shannessy <paul@oshannessy.com>
Mon, 01 Aug 2011 16:14:19 -0700
changeset 74440 d93bbef62f0b7a57e8cae609feecc1fb8f78c507
parent 74439 968f8f50e4280a312f1130bf946470fc1b0f4cea
child 74441 e9c579848ab6e09d1229d68fe0f60e00ed566d9c
push id235
push userbzbarsky@mozilla.com
push dateTue, 27 Sep 2011 17:13:04 +0000
treeherdermozilla-beta@2d1e082d176a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs669196
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 669196 - Patch 2: Handle more failures from shistory gracefully, so session restore keeps updating. [r=gavin]
browser/components/sessionstore/src/nsSessionStore.js
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -1907,17 +1907,25 @@ SessionStoreService.prototype = {
    *        the tab is pinned and should be treated differently for privacy
    */
   _serializeSessionStorage:
     function sss_serializeSessionStorage(aTabData, aHistory, aDocShell, aFullData, aIsPinned) {
     let storageData = {};
     let hasContent = false;
 
     for (let i = 0; i < aHistory.count; i++) {
-      let uri = aHistory.getEntryAtIndex(i, false).URI;
+      let uri;
+      try {
+        uri = aHistory.getEntryAtIndex(i, false).URI;
+      }
+      catch (ex) {
+        // Chances are that this is getEntryAtIndex throwing, as seen in bug 669196.
+        // We've already asserted in _collectTabData, so we won't show that again.
+        continue;
+      }
       // sessionStorage is saved per origin (cf. nsDocShell::GetSessionStorageForURI)
       let domain = uri.spec;
       try {
         if (uri.host)
           domain = uri.prePath;
       }
       catch (ex) { /* this throws for host-less URIs (such as about: or jar:) */ }
       if (storageData[domain] ||