зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1706445 - Stop using "SessionStore:flush" for SHIP, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D116144
This commit is contained in:
Родитель
555cddd8c9
Коммит
47ad1edf15
|
@ -6,6 +6,11 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["TabStateFlusher"];
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"Services",
|
||||
"resource://gre/modules/Services.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"SessionStore",
|
||||
|
@ -110,6 +115,8 @@ var TabStateFlusherInternal = {
|
|||
*/
|
||||
nativePromise = browser.frameLoader.requestTabStateFlush();
|
||||
}
|
||||
|
||||
if (!Services.appinfo.sessionHistoryInParent) {
|
||||
/*
|
||||
In the event that we have to trigger a process switch and thus change
|
||||
browser remoteness, session store needs to register and track the new
|
||||
|
@ -125,6 +132,7 @@ var TabStateFlusherInternal = {
|
|||
id,
|
||||
epoch: SessionStore.getCurrentEpoch(browser),
|
||||
});
|
||||
}
|
||||
|
||||
// Retrieve active requests for given browser.
|
||||
let permanentKey = browser.permanentKey;
|
||||
|
@ -136,13 +144,20 @@ var TabStateFlusherInternal = {
|
|||
this._requests.set(permanentKey, request);
|
||||
}
|
||||
|
||||
let promise = new Promise(resolve => {
|
||||
// Non-SHIP flushes resolve this after the "SessionStore:update" message. We
|
||||
// don't use that message for SHIP, so it's fine to resolve the request
|
||||
// immediately after the native promise resolves, since SessionStore will
|
||||
// have processed all updates from this browser by that point.
|
||||
let requestPromise = Promise.resolve();
|
||||
if (!Services.appinfo.sessionHistoryInParent) {
|
||||
requestPromise = new Promise(resolve => {
|
||||
// Store resolve() so that we can resolve the promise later.
|
||||
request.perBrowserRequests.set(id, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.race([
|
||||
nativePromise.then(_ => promise),
|
||||
nativePromise.then(_ => requestPromise),
|
||||
request.cancelPromise,
|
||||
]);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче