Bug 1278831 - DOMEventTargetHelper must release itself when disconnected from the owner and when kept alive by some event listener, r=smaug

This commit is contained in:
Andrea Marchesini 2018-08-01 00:19:15 +02:00
parent 49cbe794ae
commit 059ca97fce

View File

@ -295,20 +295,22 @@ DOMEventTargetHelper::MaybeUpdateKeepAlive()
{
bool shouldBeKeptAlive = false;
if (!mKeepingAliveTypes.mAtoms.IsEmpty()) {
for (uint32_t i = 0; i < mKeepingAliveTypes.mAtoms.Length(); ++i) {
if (HasListenersFor(mKeepingAliveTypes.mAtoms[i])) {
shouldBeKeptAlive = true;
break;
if (NS_SUCCEEDED(CheckInnerWindowCorrectness())) {
if (!mKeepingAliveTypes.mAtoms.IsEmpty()) {
for (uint32_t i = 0; i < mKeepingAliveTypes.mAtoms.Length(); ++i) {
if (HasListenersFor(mKeepingAliveTypes.mAtoms[i])) {
shouldBeKeptAlive = true;
break;
}
}
}
}
if (!shouldBeKeptAlive && !mKeepingAliveTypes.mStrings.IsEmpty()) {
for (uint32_t i = 0; i < mKeepingAliveTypes.mStrings.Length(); ++i) {
if (HasListenersFor(mKeepingAliveTypes.mStrings[i])) {
shouldBeKeptAlive = true;
break;
if (!shouldBeKeptAlive && !mKeepingAliveTypes.mStrings.IsEmpty()) {
for (uint32_t i = 0; i < mKeepingAliveTypes.mStrings.Length(); ++i) {
if (HasListenersFor(mKeepingAliveTypes.mStrings[i])) {
shouldBeKeptAlive = true;
break;
}
}
}
}