This patch doesn't change behavior. Before this patch, we're appending to the array that we're iterating over, which is risky, though it happens to be safe right now since we don't use any of the newly-invalid-data after the array is mutated. This patch just uses a less risky approach (appending to a temporary array) to avoid this fragility. Differential Revision: https://phabricator.services.mozilla.com/D197217