зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543387 - Ignore initial about:blank load when restoring scroll position. r=snorp
When restoreState is called early in a GeckoSession's life, the scroll position restore code can catch the pageshow event for the initial about:blank load rather than for the page being restored, resulting in a failure to restore scroll position. Differential Revision: https://phabricator.services.mozilla.com/D32163 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7ba536e61d
Коммит
54ce8c8653
|
@ -228,17 +228,22 @@ class GeckoViewContentChild extends GeckoViewChildModule {
|
|||
}
|
||||
}, {capture: true, mozSystemGroup: true, once: true});
|
||||
|
||||
addEventListener("pageshow", _ => {
|
||||
const scrolldata = this._savedState.scrolldata;
|
||||
if (scrolldata) {
|
||||
this.Utils.restoreFrameTreeData(content, scrolldata, (frame, data) => {
|
||||
if (data.scroll) {
|
||||
SessionStoreUtils.restoreScrollPosition(frame, data);
|
||||
}
|
||||
});
|
||||
let scrollRestore = _ => {
|
||||
if (content.location != "about:blank") {
|
||||
const scrolldata = this._savedState.scrolldata;
|
||||
if (scrolldata) {
|
||||
this.Utils.restoreFrameTreeData(content, scrolldata, (frame, data) => {
|
||||
if (data.scroll) {
|
||||
SessionStoreUtils.restoreScrollPosition(frame, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
delete this._savedState;
|
||||
removeEventListener("pageshow", scrollRestore);
|
||||
}
|
||||
delete this._savedState;
|
||||
}, {capture: true, mozSystemGroup: true, once: true});
|
||||
}
|
||||
|
||||
addEventListener("pageshow", scrollRestore, {capture: true, mozSystemGroup: true});
|
||||
|
||||
if (!this.progressFilter) {
|
||||
this.progressFilter =
|
||||
|
|
Загрузка…
Ссылка в новой задаче