Bug 1475515 - Remove member initialization for union Extra::mMessage. r?bz draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Fri, 13 Jul 2018 14:39:12 +0300
changeset 817727 d2a787ce12be5a0e65de9315ebbb291536e6bf0a
parent 817721 bbca8d90968e7c82f084e89385509bfde123e9ff
push id116151
push userbmo:bpostelnicu@mozilla.com
push dateFri, 13 Jul 2018 11:41:25 +0000
reviewersbz
bugs1475515
milestone63.0a1
Bug 1475515 - Remove member initialization for union Extra::mMessage. r?bz MozReview-Commit-ID: GgJyXg5KxQm
dom/bindings/ErrorResult.h
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -504,33 +504,33 @@ private:
   //                                               on us.
   nsresult mResult;
 
   struct Message;
   struct DOMExceptionInfo;
   union Extra {
     // mMessage is set by ThrowErrorWithMessage and reported (and deallocated)
     // by SetPendingExceptionWithMessage.
+    MOZ_INIT_OUTSIDE_CTOR
     Message* mMessage; // valid when IsErrorWithMessage()
 
     // mJSException is set (and rooted) by ThrowJSException and reported (and
     // unrooted) by SetPendingJSException.
+    MOZ_INIT_OUTSIDE_CTOR
     JS::Value mJSException; // valid when IsJSException()
 
     // mDOMExceptionInfo is set by ThrowDOMException and reported (and
     // deallocated) by SetPendingDOMException.
+    MOZ_INIT_OUTSIDE_CTOR
     DOMExceptionInfo* mDOMExceptionInfo; // valid when IsDOMException()
 
     // |mJSException| has a non-trivial constructor and therefore MUST be
     // placement-new'd into existence.
     MOZ_PUSH_DISABLE_NONTRIVIAL_UNION_WARNINGS
-    Extra()
-      : mMessage(nullptr)
-    {
-    }
+    Extra() {}
     MOZ_POP_DISABLE_NONTRIVIAL_UNION_WARNINGS
   } mExtra;
 
   Message* InitMessage(Message* aMessage) {
     // The |new| here switches the active arm of |mExtra|, from the compiler's
     // point of view.  Mere assignment *won't* necessarily do the right thing!
     new (&mExtra.mMessage) Message*(aMessage);
     return mExtra.mMessage;