Bug 1337441 - Prevent crash when accessing VRDisplayEvent.display within onvrdisplayactivate draft
authorKearwood Gilbert <kgilbert@mozilla.com>
Thu, 09 Feb 2017 17:46:18 -0800
changeset 481575 7e039c3f302516ae2198e700c9356a7f590c495c
parent 481376 eea9995ed14c07675c972400e8ce36b3608c01b1
child 545223 62b69409b6d82379a3264edd44ec4795c1b0a1a1
push id44847
push userbmo:kgilbert@mozilla.com
push dateFri, 10 Feb 2017 01:46:39 +0000
bugs1337441
milestone54.0a1
Bug 1337441 - Prevent crash when accessing VRDisplayEvent.display within onvrdisplayactivate - A non-null value is now always returned, as VRDisplayEvent.display is required. MozReview-Commit-ID: IrE2a7rw3Co
dom/vr/VRDisplayEvent.cpp
--- a/dom/vr/VRDisplayEvent.cpp
+++ b/dom/vr/VRDisplayEvent.cpp
@@ -59,16 +59,17 @@ VRDisplayEvent::Constructor(mozilla::dom
                             const VRDisplayEventInit& aEventInitDict)
 {
   RefPtr<VRDisplayEvent> e = new VRDisplayEvent(aOwner);
   bool trusted = e->Init(aOwner);
   e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
   if (aEventInitDict.mReason.WasPassed()) {
     e->mReason = Some(aEventInitDict.mReason.Value());
   }
+  e->mDisplay = aEventInitDict.mDisplay;
   e->SetTrusted(trusted);
   e->SetComposed(aEventInitDict.mComposed);
   return e.forget();
 }
 
 already_AddRefed<VRDisplayEvent>
 VRDisplayEvent::Constructor(const GlobalObject& aGlobal, const nsAString& aType,
                             const VRDisplayEventInit& aEventInitDict,