Bug 1668847 - Don't use SessionHistory.collect from content child r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D92246
This commit is contained in:
Andreas Farre 2020-10-02 15:42:50 +00:00
Родитель 250a54c2c0
Коммит 20f649d371
3 изменённых файлов: 27 добавлений и 2 удалений

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

@ -53,13 +53,11 @@ tags = devtools webextensions
[browser_menu_item_02.js]
[browser_mouse_resize.js]
[browser_navigation.js]
skip-if = fission
[browser_network_throttling.js]
[browser_orientationchange_event.js]
[browser_page_redirection.js]
skip-if = os == "linux"
[browser_page_state.js]
skip-if = fission
[browser_page_style.js]
[browser_permission_doorhanger.js]
tags = devtools geolocation

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

@ -511,6 +511,27 @@ const selectNetworkThrottling = (ui, value) =>
]);
function getSessionHistory(browser) {
if (Services.appinfo.sessionHistoryInParent) {
const browsingContext = browser.browsingContext;
const uri = browsingContext.currentWindowGlobal.documentURI.displaySpec;
const history = browsingContext.sessionHistory;
const userContextId = browsingContext.originAttributes.userContextId;
const body = ContentTask.spawn(browser, browsingContext, function(
// eslint-disable-next-line no-shadow
browsingContext
) {
const docShell = browsingContext.docShell.QueryInterface(
Ci.nsIWebNavigation
);
return docShell.document.body;
});
/* eslint-disable no-undef */
const { SessionHistory } = ChromeUtils.import(
"resource://gre/modules/sessionstore/SessionHistory.jsm"
);
return SessionHistory.collectFromParent(uri, body, history, userContextId);
/* eslint-enable no-undef */
}
return ContentTask.spawn(browser, null, function() {
/* eslint-disable no-undef */
const { SessionHistory } = ChromeUtils.import(

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

@ -36,6 +36,9 @@ var SessionHistory = Object.freeze({
},
collect(docShell, aFromIdx = -1) {
if (Services.appinfo.sessionHistoryInParent) {
throw new Error("Use SessionHistory.collectFromParent instead");
}
return SessionHistoryInternal.collect(docShell, aFromIdx);
},
@ -50,6 +53,9 @@ var SessionHistory = Object.freeze({
},
restore(docShell, tabData) {
if (Services.appinfo.sessionHistoryInParent) {
throw new Error("Use SessionHistory.restoreFromParent instead");
}
return SessionHistoryInternal.restore(
docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory
.legacySHistory,