Bug 1436240: Make sure to always initialize mMatches to something meaningful. r?xidorn draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 07 Feb 2018 03:31:40 +0100
changeset 751977 f046bb8b289f06147aba077dafc25f96cfc17d13
parent 751919 3f2d5744bb7dfd8965ab04629e9db7bd8de616e7
push id98117
push userbmo:emilio@crisal.io
push dateWed, 07 Feb 2018 10:26:59 +0000
reviewersxidorn
bugs1436240
milestone60.0a1
Bug 1436240: Make sure to always initialize mMatches to something meaningful. r?xidorn MozReview-Commit-ID: 1FpAZIzyLOU
layout/style/MediaQueryList.cpp
--- a/layout/style/MediaQueryList.cpp
+++ b/layout/style/MediaQueryList.cpp
@@ -19,16 +19,17 @@
 
 namespace mozilla {
 namespace dom {
 
 MediaQueryList::MediaQueryList(nsIDocument* aDocument,
                                const nsAString& aMediaQueryList,
                                CallerType aCallerType)
   : mDocument(aDocument)
+  , mMatches(false)
   , mMatchesValid(false)
 {
   mMediaList =
     MediaList::Create(aDocument->GetStyleBackendType(),
                       aMediaQueryList,
                       aCallerType);
 
   KeepAliveIfHasListenersFor(ONCHANGE_STRING);
@@ -133,16 +134,18 @@ MediaQueryList::Disconnect()
   DisconnectFromOwner();
 
   IgnoreKeepAliveIfHasListenersFor(ONCHANGE_STRING);
 }
 
 void
 MediaQueryList::RecomputeMatches()
 {
+  mMatches = false;
+
   if (!mDocument) {
     return;
   }
 
   if (mDocument->GetParentDocument()) {
     // Flush frames on the parent so our prescontext will get
     // recreated as needed.
     mDocument->GetParentDocument()->FlushPendingNotifications(FlushType::Frames);