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; bool shouldBeKeptAlive = false;
if (!mKeepingAliveTypes.mAtoms.IsEmpty()) { if (NS_SUCCEEDED(CheckInnerWindowCorrectness())) {
for (uint32_t i = 0; i < mKeepingAliveTypes.mAtoms.Length(); ++i) { if (!mKeepingAliveTypes.mAtoms.IsEmpty()) {
if (HasListenersFor(mKeepingAliveTypes.mAtoms[i])) { for (uint32_t i = 0; i < mKeepingAliveTypes.mAtoms.Length(); ++i) {
shouldBeKeptAlive = true; if (HasListenersFor(mKeepingAliveTypes.mAtoms[i])) {
break; shouldBeKeptAlive = true;
break;
}
} }
} }
}
if (!shouldBeKeptAlive && !mKeepingAliveTypes.mStrings.IsEmpty()) { if (!shouldBeKeptAlive && !mKeepingAliveTypes.mStrings.IsEmpty()) {
for (uint32_t i = 0; i < mKeepingAliveTypes.mStrings.Length(); ++i) { for (uint32_t i = 0; i < mKeepingAliveTypes.mStrings.Length(); ++i) {
if (HasListenersFor(mKeepingAliveTypes.mStrings[i])) { if (HasListenersFor(mKeepingAliveTypes.mStrings[i])) {
shouldBeKeptAlive = true; shouldBeKeptAlive = true;
break; break;
}
} }
} }
} }