Bug 1669096: Add missing kungFuDeathGrip. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D92490
This commit is contained in:
Kris Maglione 2020-10-06 18:05:32 +00:00
Родитель cee53e9c91
Коммит eeec43da78
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -1201,6 +1201,11 @@ bool nsDocumentViewer::GetIsStopped() { return mStopped; }
NS_IMETHODIMP
nsDocumentViewer::PermitUnload(PermitUnloadAction aAction,
bool* aPermitUnload) {
// We're going to be running JS and nested event loops, which could cause our
// DocShell to be destroyed. Make sure we stay alive until the end of the
// function.
RefPtr<nsDocumentViewer> kungFuDeathGrip(this);
if (StaticPrefs::dom_disable_beforeunload()) {
aAction = eDontPromptAndUnload;
}