Bug 1406108: Make MediaQueryList iteration no longer copy RefPtrs. draft
authorBrad Werth <bwerth@mozilla.com>
Tue, 19 Sep 2017 17:05:16 -0700
changeset 675612 e85db7a4cfc0f4418ba511fe90baffb288ee3d3d
parent 675508 53bbdaaa2b8c1819061be26101b075c081b23260
child 734660 68a8822ee3c3ff57ffe961ebc6839ba57ccff8d3
push id83190
push userbwerth@mozilla.com
push dateThu, 05 Oct 2017 16:54:42 +0000
bugs1406108
milestone58.0a1
Bug 1406108: Make MediaQueryList iteration no longer copy RefPtrs. MozReview-Commit-ID: 4eDs6viuxvT
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2121,17 +2121,17 @@ nsPresContext::MediaFeatureValuesChanged
     // Copy pointers to all the lists into a new array, in case one of our
     // notifications modifies the list.
     nsTArray<RefPtr<mozilla::dom::MediaQueryList>> localMediaQueryLists;
     for (auto* mql : mDocument->MediaQueryLists()) {
       localMediaQueryLists.AppendElement(mql);
     }
 
     // Now iterate our local array of the lists.
-    for (auto mql : localMediaQueryLists) {
+    for (const auto& mql : localMediaQueryLists) {
       nsAutoMicroTask mt;
       mql->MaybeNotify();
     }
   }
 }
 
 void
 nsPresContext::PostMediaFeatureValuesChangedEvent()