Bug 1646810 - Expose browser-custom-element::afterChangeRemoteness. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D93864
This commit is contained in:
Agi Sferro 2020-10-19 17:25:25 +00:00
Родитель 8f5674570f
Коммит cc915ca469
2 изменённых файлов: 19 добавлений и 17 удалений

Просмотреть файл

@ -1981,6 +1981,11 @@
if (!Services.appinfo.sessionHistoryInParent) {
b.prepareToChangeRemoteness = () =>
SessionStore.prepareToChangeRemoteness(b);
b.afterChangeRemoteness = switchId => {
let tab = this.getTabForBrowser(b);
SessionStore.finishTabRemotenessChange(tab, switchId);
return true;
};
}
const defaultBrowserAttributes = {
@ -5767,11 +5772,6 @@
}
}
},
finishBrowserRemotenessChange(aBrowser, aSwitchId) {
let tab = this.getTabForBrowser(aBrowser);
SessionStore.finishTabRemotenessChange(tab, aSwitchId);
},
};
/**

Просмотреть файл

@ -1928,6 +1928,17 @@
/* no-op unless replaced */
}
// This method is replaced by frontend code in order to handle restoring
// remote session history
//
// Called immediately after changing remoteness. If this method returns
// `true`, Gecko will assume frontend handled resuming the load, and will
// not attempt to resume the load itself.
afterChangeRemoteness(browser, redirectLoadSwitchId) {
/* no-op unless replaced */
return false;
}
// Called by Gecko before the remoteness change happens, allowing for
// listeners, etc. to be stashed before the process switch.
beforeChangeRemoteness() {
@ -1952,18 +1963,9 @@
event.initEvent("DidChangeBrowserRemoteness", true, false);
this.dispatchEvent(event);
// If we have a tabbrowser, we need to let it handle restoring session
// history, and performing the `resumeRedirectedLoad`, in order to get
// sesssion state set up correctly.
// FIXME: This probably needs to be hookable by GeckoView.
if (!Services.appinfo.sessionHistoryInParent) {
let tabbrowser = this.getTabBrowser();
if (tabbrowser) {
tabbrowser.finishBrowserRemotenessChange(this, redirectLoadSwitchId);
return true;
}
}
return false;
// Call into frontend code which may want to handle the load (e.g. to
// while restoring session state).
return this.afterChangeRemoteness(redirectLoadSwitchId);
}
}