Bug 1776962 - Close SharedWorker on DETH disconnect. r=dom-worker-reviewers,smaug

SharedWorker can be a better lifecycle participant by closing itself
promptly when its global disconnects its DETHs.  This avoids the need
to wait for CC.

Differential Revision: https://phabricator.services.mozilla.com/D191821
This commit is contained in:
Andrew Sutherland 2023-10-28 00:29:52 +00:00
Родитель 90898c25ea
Коммит 572daab0e8
2 изменённых файлов: 7 добавлений и 0 удалений

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

@ -427,6 +427,11 @@ void SharedWorker::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
DOMEventTargetHelper::GetEventTargetParent(aVisitor);
}
void SharedWorker::DisconnectFromOwner() {
Close();
DOMEventTargetHelper::DisconnectFromOwner();
}
void SharedWorker::ErrorPropagation(nsresult aError) {
AssertIsOnMainThread();
MOZ_ASSERT(mActor);

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

@ -62,6 +62,8 @@ class SharedWorker final : public DOMEventTargetHelper {
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
void DisconnectFromOwner() override;
void ErrorPropagation(nsresult aError);
// Methods called from the window.