Bug 1626812 - Dispatch XRSessionEvent end when exiting XRSession. r=kip

Differential Revision: https://phabricator.services.mozilla.com/D69296

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daosheng Mu 2020-04-07 21:26:46 +00:00
parent 673fd01dae
commit 7efbfa3c65

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/XRSession.h"
#include "mozilla/dom/XRSessionEvent.h"
#include "mozilla/dom/DocumentInlines.h"
#include "XRSystem.h"
#include "XRRenderState.h"
@ -413,7 +414,16 @@ void XRSession::ExitPresentInternal() {
mDisplayPresentation = nullptr;
if (!mEnded) {
mEnded = true;
DispatchTrustedEvent(NS_LITERAL_STRING("end"));
XRSessionEventInit init;
init.mBubbles = false;
init.mCancelable = false;
init.mSession = this;
RefPtr<XRSessionEvent> event = XRSessionEvent::Constructor(this,
NS_LITERAL_STRING("end"), init);
event->SetTrusted(true);
this->DispatchEvent(*event);
}
}