mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 15:17:29 +09:00
Issue #2452 - Fire events after iterating ServiceWorkerManager::mControlledDocuments is done.
https://bugzilla.mozilla.org/show_bug.cgi?id=1413466
This commit is contained in:
parent
d6dd1f8133
commit
0efbc454b6
1 changed files with 8 additions and 0 deletions
|
|
@ -3082,6 +3082,8 @@ void
|
||||||
ServiceWorkerManager::FireControllerChange(ServiceWorkerRegistrationInfo* aRegistration)
|
ServiceWorkerManager::FireControllerChange(ServiceWorkerRegistrationInfo* aRegistration)
|
||||||
{
|
{
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
|
||||||
|
AutoTArray<nsCOMPtr<nsIDocument>, 16> documents;
|
||||||
for (auto iter = mControlledDocuments.Iter(); !iter.Done(); iter.Next()) {
|
for (auto iter = mControlledDocuments.Iter(); !iter.Done(); iter.Next()) {
|
||||||
if (iter.UserData() != aRegistration) {
|
if (iter.UserData() != aRegistration) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -3092,6 +3094,12 @@ ServiceWorkerManager::FireControllerChange(ServiceWorkerRegistrationInfo* aRegis
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
documents.AppendElement(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fire event after iterating mControlledDocuments is done to prevent
|
||||||
|
// modification by reentering from the event handlers during iteration.
|
||||||
|
for (auto& doc : documents) {
|
||||||
FireControllerChangeOnDocument(doc);
|
FireControllerChangeOnDocument(doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue