Bug 1554512 - Add a handing for scroll position in copyFromCache() r=mikedeboer a=jcristau
authorAlphan Chen <alchen@mozilla.com>
Wed, 29 May 2019 10:20:57 +0000
changeset 536695 023ce53e3a94f9d306aef2ed07e5587784dc5a3a
parent 536694 11ffae4160639b957b802235977a93ffe8bdfce9
child 536696 615fe993833fe6edf90bc5d1386a23de6ffb86d9
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, jcristau
bugs1554512
milestone68.0
Bug 1554512 - Add a handing for scroll position in copyFromCache() r=mikedeboer a=jcristau Need to update the scroll position if it is deleted in the TabStateCachae. Differential Revision: https://phabricator.services.mozilla.com/D32803
browser/components/sessionstore/TabState.jsm
--- a/browser/components/sessionstore/TabState.jsm
+++ b/browser/components/sessionstore/TabState.jsm
@@ -187,10 +187,20 @@ var TabStateInternal = {
 
         if (value.hasOwnProperty("requestedIndex")) {
           tabData.requestedIndex = value.requestedIndex;
         }
       } else {
         tabData[key] = value;
       }
     }
+
+    // [Bug 1554512]
+    // If the latest scroll position is on the top, we will delete scroll entry.
+    // When scroll entry is deleted in TabStateCache, it cannot be updated.
+    // To prevent losing the scroll position, we need to add a handing here.
+    if (tabData.scroll) {
+      if (!data.scroll) {
+        delete tabData.scroll;
+      }
+    }
   },
 };