зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1278831 - PermissionStatus must keep itself alive when it has a event listener, r=smaug
This commit is contained in:
Родитель
eb256a84b2
Коммит
49cbe794ae
|
@ -35,6 +35,7 @@ PermissionStatus::PermissionStatus(nsPIDOMWindowInner* aWindow,
|
|||
, mName(aName)
|
||||
, mState(PermissionState::Denied)
|
||||
{
|
||||
KeepAliveIfHasListenersFor(NS_LITERAL_STRING("change"));
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -125,5 +126,18 @@ PermissionStatus::PermissionChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
PermissionStatus::DisconnectFromOwner()
|
||||
{
|
||||
IgnoreKeepAliveIfHasListenersFor(NS_LITERAL_STRING("change"));
|
||||
|
||||
if (mObserver) {
|
||||
mObserver->RemoveSink(this);
|
||||
mObserver = nullptr;
|
||||
}
|
||||
|
||||
DOMEventTargetHelper::DisconnectFromOwner();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
|
||||
IMPL_EVENT_HANDLER(change)
|
||||
|
||||
void
|
||||
DisconnectFromOwner() override;
|
||||
|
||||
private:
|
||||
~PermissionStatus();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче