Bug 1488321 - Update comm-central for nsISHEntry.{index,getEntryAtIndex()} changes. r=frg
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 05 Sep 2018 08:30:29 +1000
changeset 33086 4e7bcb952b297e85c6768466c639bf55c735a442
parent 33085 be7897269d30e94b5dd1506f4dd14476491d1789
child 33087 a86f6197340ca93718eed554ae3c9a5417f4899a
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersfrg
bugs1488321
Bug 1488321 - Update comm-central for nsISHEntry.{index,getEntryAtIndex()} changes. r=frg 'index' is now writable, and getEntryAtIndex() has lost its second argument.
suite/browser/sessionHistoryUI.js
suite/browser/tabbrowser.xml
suite/components/helpviewer/content/help.js
suite/components/sessionstore/nsSessionStore.js
suite/components/tests/browser/browser_687710_2.js
--- a/suite/browser/sessionHistoryUI.js
+++ b/suite/browser/sessionHistoryUI.js
@@ -40,43 +40,43 @@ function FillHistoryMenu(aParent, aMenu)
   {
     case "back":
       end = index > MAX_HISTORY_MENU_ITEMS ? index - MAX_HISTORY_MENU_ITEMS
                                            : 0;
       if (index <= end)
         return false;
       for (let j = index - 1; j >= end; j--)
       {
-        let entry = sessionHistory.getEntryAtIndex(j, false);
+        let entry = sessionHistory.getEntryAtIndex(j);
         if (entry)
           createHistoryMenuItem(aParent, j, entry);
       }
       break;
     case "forward":
       end = count - index > MAX_HISTORY_MENU_ITEMS ? index + MAX_HISTORY_MENU_ITEMS
                                                    : count - 1;
       if (index >= end)
         return false;
       for (let j = index + 1; j <= end; j++)
       {
-        let entry = sessionHistory.getEntryAtIndex(j, false);
+        let entry = sessionHistory.getEntryAtIndex(j);
         if (entry)
           createHistoryMenuItem(aParent, j, entry);
       }
       break;
     case "go":
       var startHistory = document.getElementById("startHistorySeparator");
       var endHistory = document.getElementById("endHistorySeparator");
       // var syncMenuItem = document.getElementById("sync-tabs-menuitem");
       startHistory.hidden = (count == 0);
       end = count > MAX_HISTORY_MENU_ITEMS ? count - MAX_HISTORY_MENU_ITEMS
                                            : 0;
       for (let j = count - 1; j >= end; j--)
       {
-        let entry = sessionHistory.getEntryAtIndex(j, false);
+        let entry = sessionHistory.getEntryAtIndex(j);
         if (entry)
           createHistoryMenuItem(aParent, j, entry, endHistory, j == index);
       }
       // toggleTabsFromOtherComputers();
       // endHistory.hidden = (endHistory == aParent.lastChild || syncMenuItem.hidden);
       endHistory.hidden = (endHistory == aParent.lastChild);
       break;
   }
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -2005,17 +2005,17 @@
               history: oldSH,
               toJSON: function() {} // hides this object from JSON.stringify
             };
             this.savedBrowsers.unshift(tabData);
 
             var newSH = Cc["@mozilla.org/browser/shistory;1"]
                           .createInstance(Ci.nsISHistory);
             oldBrowser.webNavigation.sessionHistory = newSH;
-            var entry = oldSH.getEntryAtIndex(oldSH.index, false)
+            var entry = oldSH.getEntryAtIndex(oldSH.index)
                              .QueryInterface(Ci.nsISHEntry)
                              .clone();
             // The bfcache entry is tightly coupled to the original shistory it
             // belongs to, better to drop it.
             entry.abandonBFCacheEntry();
             // don't try to repost data when restoring the tab
             entry.postData = null;
             newSH.addEntry(entry, true);
--- a/suite/components/helpviewer/content/help.js
+++ b/suite/components/helpviewer/content/help.js
@@ -485,27 +485,27 @@ function FillHistoryMenu(aParent, aMenu)
 
     switch (aMenu)
       {
         case "back":
           end = (index > MAX_HISTORY_MENU_ITEMS) ? index - MAX_HISTORY_MENU_ITEMS : 0;
           if ((index - 1) < end) return false;
           for (j = index - 1; j >= end; j--)
             {
-              entry = sessionHistory.getEntryAtIndex(j, false);
+              entry = sessionHistory.getEntryAtIndex(j);
               if (entry)
                 createMenuItem(aParent, j, entry.title);
             }
           break;
         case "forward":
           end  = ((count-index) > MAX_HISTORY_MENU_ITEMS) ? index + MAX_HISTORY_MENU_ITEMS : count - 1;
           if ((index + 1) > end) return false;
           for (j = index + 1; j <= end; j++)
             {
-              entry = sessionHistory.getEntryAtIndex(j, false);
+              entry = sessionHistory.getEntryAtIndex(j);
               if (entry)
                 createMenuItem(aParent, j, entry.title);
             }
           break;
       }
     return true;
   }
 
--- a/suite/components/sessionstore/nsSessionStore.js
+++ b/suite/components/sessionstore/nsSessionStore.js
@@ -1461,17 +1461,17 @@ SessionStoreService.prototype = {
         browser.__SS_data.entries[history.index].url == browser.currentURI.spec &&
         history.index < this._sessionhistory_max_entries - 1 && !aFullData) {
       tabData = browser.__SS_data;
       tabData.index = history.index + 1;
     }
     else if (history && history.count > 0) {
       try {
         for (var j = 0; j < history.count; j++) {
-          let entry = this._serializeHistoryEntry(history.getEntryAtIndex(j, false),
+          let entry = this._serializeHistoryEntry(history.getEntryAtIndex(j),
                                                   aFullData, aTab.pinned);
           tabData.entries.push(entry);
         }
         // If we make it through the for loop, then we're ok and we should clear
         // any indicator of brokenness.
         delete aTab.__SS_broken_history;
       }
       catch (ex) {
@@ -1692,17 +1692,17 @@ SessionStoreService.prototype = {
   _serializeSessionStorage:
     function sss_serializeSessionStorage(aTabData, aHistory, aDocShell, aFullData, aIsPinned) {
     let storageData = {};
     let hasContent = false;
 
     for (let i = 0; i < aHistory.count; i++) {
       let principal;
       try {
-        let uri = aHistory.getEntryAtIndex(i, false).URI;
+        let uri = aHistory.getEntryAtIndex(i).URI;
         principal = SecMan.getDocShellCodebasePrincipal(uri, aDocShell);
       }
       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;
       }
 
@@ -2763,17 +2763,17 @@ SessionStoreService.prototype = {
       browser.__SS_restore_tab = aTab;
 
       didStartLoad = true;
       try {
         // In order to work around certain issues in session history, we need to
         // force session history to update its internal index and call reload
         // instead of gotoIndex. See bug 597315.
         var sessionHistory = browser.webNavigation.sessionHistory;
-        sessionHistory.getEntryAtIndex(activeIndex, true);
+        sessionHistory.index = activeIndex;
         sessionHistory.reloadCurrentEntry();
       }
       catch (ex) {
         // ignore page load errors
         aTab.removeAttribute("busy");
         didStartLoad = false;
       }
     }
--- a/suite/components/tests/browser/browser_687710_2.js
+++ b/suite/components/tests/browser/browser_687710_2.js
@@ -36,21 +36,21 @@ function test()
     for (let j = 0; j < history.count; j++) {
       compareEntries(i, j, history);
     }
   }
 }
 
 function compareEntries(i, j, history)
 {
-  let e1 = history.getEntryAtIndex(i, false)
+  let e1 = history.getEntryAtIndex(i)
                   .QueryInterface(Ci.nsISHEntry)
                   .QueryInterface(Ci.nsISHContainer);
 
-  let e2 = history.getEntryAtIndex(j, false)
+  let e2 = history.getEntryAtIndex(j)
                   .QueryInterface(Ci.nsISHEntry)
                   .QueryInterface(Ci.nsISHContainer);
 
   ok(e1.sharesDocumentWith(e2),
      i + ' should share doc with ' + j);
   is(e1.childCount, e2.childCount,
      'Child count mismatch (' + i + ', ' + j + ')');