diff --git a/gfx/2d/RecordedEventImpl.h b/gfx/2d/RecordedEventImpl.h
index 71902998254815765729dd0cdc67cd82e279e8a4..23698ee70eb4da4108e2b369a5a60f75688cee92 100644
--- a/gfx/2d/RecordedEventImpl.h
+++ b/gfx/2d/RecordedEventImpl.h
@@ -65,7 +65,7 @@ class RecordedDrawTargetCreation
   BackendType mBackendType;
   IntRect mRect;
   SurfaceFormat mFormat;
-  bool mHasExistingData;
+  bool mHasExistingData = false;
   RefPtr<SourceSurface> mExistingData;
 
  private:
diff --git a/gfx/2d/RecordingTypes.h b/gfx/2d/RecordingTypes.h
index 818e9c17294e2db8ef9f90acdf1ba9fe202cf0ac..94325b129599f871d28f501358ec207904a54d22 100644
--- a/gfx/2d/RecordingTypes.h
+++ b/gfx/2d/RecordingTypes.h
@@ -24,6 +24,28 @@ struct ElementStreamFormat {
     aStream.read(reinterpret_cast<char*>(&aElement), sizeof(T));
   }
 };
+template <class S>
+struct ElementStreamFormat<S, bool> {
+  static void Write(S& aStream, const bool& aElement) {
+    char boolChar = aElement ? '\x01' : '\x00';
+    aStream.write(&boolChar, sizeof(boolChar));
+  }
+  static void Read(S& aStream, bool& aElement) {
+    char boolChar;
+    aStream.read(&boolChar, sizeof(boolChar));
+    switch (boolChar) {
+      case '\x00':
+        aElement = false;
+        break;
+      case '\x01':
+        aElement = true;
+        break;
+      default:
+        aStream.SetIsBad();
+        break;
+    }
+  }
+};
 
 template <class S, class T>
 void WriteElement(S& aStream, const T& aElement) {