Bug 1447871 P3 Make nsIGlobalObject::ForEachEventTargetObject() protect against side effects that might delete other DETH objects. r=asuth

This commit is contained in:
Ben Kelly 2018-03-30 11:25:48 -07:00
Родитель dcad56bf27
Коммит 48efa4db3f
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -157,6 +157,11 @@ nsIGlobalObject::ForEachEventTargetObject(const std::function<void(DOMEventTarge
// Iterate the target list and call the function on each one.
bool done = false;
for (auto target : targetList) {
// Check to see if a previous iteration's callback triggered the removal
// of this target as a side-effect. If it did, then just ignore it.
if (!mEventTargetObjects.Contains(target)) {
continue;
}
aFunc(target, &done);
if (done) {
break;