Bug 1626570 - Improve handling of copying arrays in dom/html/. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D73647
This commit is contained in:
Simon Giesecke 2020-05-07 08:09:51 +00:00
Родитель c1fe95dc03
Коммит 7a24ea2236
3 изменённых файлов: 5 добавлений и 6 удалений

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

@ -6803,8 +6803,7 @@ void HTMLInputElement::SetFilePickerFiltersFromAccept(
// Remove similar filters
// Iterate over a copy, as we might modify the original filters list
nsTArray<nsFilePickerFilter> filtersCopy;
filtersCopy = filters;
const nsTArray<nsFilePickerFilter> filtersCopy = filters.Clone();
for (uint32_t i = 0; i < filtersCopy.Length(); ++i) {
const nsFilePickerFilter& filterToCheck = filtersCopy[i];
if (filterToCheck.mFilterMask) {

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

@ -741,7 +741,7 @@ class HTMLMediaElement::MediaStreamRenderer
mWatchManager(this, aMainThread) {}
void Shutdown() {
for (const auto& t : nsTArray<WeakPtr<MediaStreamTrack>>(mAudioTracks)) {
for (const auto& t : mAudioTracks.Clone()) {
if (t) {
RemoveTrack(t->AsAudioStreamTrack());
}
@ -3691,10 +3691,10 @@ already_AddRefed<DOMMediaStream> HTMLMediaElement::CaptureStreamInternal(
}
nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow();
OutputMediaStream* out = mOutputStreams.AppendElement(OutputMediaStream(
OutputMediaStream* out = mOutputStreams.EmplaceBack(
MakeRefPtr<DOMMediaStream>(window),
aStreamCaptureType == StreamCaptureType::CAPTURE_AUDIO,
aFinishBehavior == StreamCaptureBehavior::FINISH_WHEN_ENDED));
aFinishBehavior == StreamCaptureBehavior::FINISH_WHEN_ENDED);
if (aFinishBehavior == StreamCaptureBehavior::FINISH_WHEN_ENDED &&
!mOutputTrackSources.IsEmpty()) {

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

@ -137,7 +137,7 @@ void HTMLSlotElement::AssignedNodes(const AssignedNodesOptions& aOptions,
return FlattenAssignedNodes(this, aNodes);
}
aNodes = mAssignedNodes;
aNodes = mAssignedNodes.Clone();
}
void HTMLSlotElement::AssignedElements(const AssignedNodesOptions& aOptions,