Bug 1594390 - Keep session history listener alive in docshell/test/navigation/browser_test_bfcache_eviction.js, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D56600

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Anny Gakhokidze 2019-12-10 21:10:52 +00:00
Родитель 4fb06e5cf3
Коммит f0f6cb1643
2 изменённых файлов: 7 добавлений и 2 удалений

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

@ -8,7 +8,6 @@ support-files =
bug343515_pg3_2.html
[browser_test_bfcache_eviction.js]
skip-if = debug && (os == "mac" || os == "linux") || (os == "win") #Bug 1594390
[browser_bug343515.js]
[browser_test-content-chromeflags.js]
tags = openwindow

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

@ -10,7 +10,7 @@ add_task(async function() {
// 1. Open a tab
var testPage =
"data:text/html,<html id='html1'><body id='body1'></body></html>";
"data:text/html,<html id='html1'><body id='body1'>First tab ever opened</body></html>";
await BrowserTestUtils.withNewTab({ gBrowser, url: testPage }, async function(
browser
) {
@ -31,6 +31,7 @@ add_task(async function() {
"History listener got called after a content viewer was evicted"
);
legacySHistory.removeSHistoryListener(historyListener);
delete content._testListener;
// 6. Resolve the promise when we got our 'content viewer evicted' event
resolve();
},
@ -40,6 +41,8 @@ add_task(async function() {
]),
};
legacySHistory.addSHistoryListener(historyListener);
// Keep the weak shistory listener alive
content._testListener = historyListener;
});
});
} else {
@ -56,6 +59,7 @@ add_task(async function() {
"History listener got called after a content viewer was evicted"
);
legacySHistory.removeSHistoryListener(historyListener);
delete content._testListener;
// 6. Resolve the promise when we got our 'content viewer evicted' event
testDone.resolve();
},
@ -65,6 +69,8 @@ add_task(async function() {
]),
};
legacySHistory.addSHistoryListener(historyListener);
// Keep the weak shistory listener alive
content._testListener = historyListener;
}
// 4. Open a second tab