void
PaymentRequestUpdateEvent::UpdateWith(Promise& aPromise, ErrorResult& aRv)
{
  if (!IsTrusted()) {
    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
    return;
  }

  MOZ_ASSERT(mRequest);

  if (mWaitForUpdate || !mRequest->ReadyForUpdate()) {
    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
    return;
  }

  aPromise.AppendNativeHandler(this);

  StopPropagation();
  StopImmediatePropagation();
  mWaitForUpdate = true;
  mRequest->SetUpdating(true);
}
void KVGeoNavigator::PropagateParticle(KVNucleus* part, TVector3* TheOrigin)
{
   // Propagate a particle through the geometry in the direction of its momentum,
   // until we reach the boundary of the geometry, or until fStopPropagation is set to kFALSE.
   // Propagation will also stop if we encounter a volume whose name begins with "DEADZONE"

   // Define point of origin of particles
   if (TheOrigin) fGeometry->SetCurrentPoint(TheOrigin->X(), TheOrigin->Y(), TheOrigin->Z());
   else fGeometry->SetCurrentPoint(0., 0., 0.);

   // unit vector in direction of particle's momentum
   TVector3 v = part->GetMomentum().Unit();
   // use particle's momentum direction
   fGeometry->SetCurrentDirection(v.x(), v.y(), v.z());
   fGeometry->FindNode();

   fCurrentVolume = fGeometry->GetCurrentVolume();
   fCurrentNode = fGeometry->GetCurrentNode();
   fMotherNode = fGeometry->GetMother();
   fCurrentMatrix = *(fGeometry->GetCurrentMatrix());
   fCurrentPath = fGeometry->GetPath();
   // move along trajectory until we hit a new volume
   fGeometry->FindNextBoundaryAndStep();
   fStepSize = fGeometry->GetStep();
   TGeoVolume* newVol = fGeometry->GetCurrentVolume();
   TGeoNode* newNod = fGeometry->GetCurrentNode();
   TGeoNode* newMom = fGeometry->GetMother();
   TGeoHMatrix* newMatx = fGeometry->GetCurrentMatrix();
   TString newPath = fGeometry->GetPath();

   Double_t XX, YY, ZZ;
   XX = YY = ZZ = 0.;

   // reset user flag for stopping propagation of particle
   SetStopPropagation(kFALSE);

//    Info("PropagateParticle","Beginning: i am in %s on node %s with path %s, and matrix:",
//         fCurrentVolume->GetName(),fCurrentNode->GetName(),fCurrentPath.Data());
//    fCurrentMatrix.Print();

   // track particle until we leave the geometry or until fStopPropagation
   // becomes kTRUE
   while (!fGeometry->IsOutside()) {

      const Double_t* posi = fGeometry->GetCurrentPoint();
      fEntryPoint.SetXYZ(XX, YY, ZZ);
      XX = posi[0];
      YY = posi[1];
      ZZ = posi[2];
      fExitPoint.SetXYZ(XX, YY, ZZ);

      TString vn = GetCurrentVolume()->GetName();
      if (vn.BeginsWith("DEADZONE")) {
         part->GetParameters()->SetValue("DEADZONE", Form("%s/%s", GetCurrentVolume()->GetName(), GetCurrentNode()->GetName()));
         break;
      }

//        Info("PropagateParticle","just before ParticleEntersNewVolume\nnow i am in %s on node %s with path %s and matrix:",
//             fCurrentVolume->GetName(),fCurrentNode->GetName(),fCurrentPath.Data());
//        fCurrentMatrix.Print();

      ParticleEntersNewVolume(part);

      if (StopPropagation()) break;

      fCurrentVolume = newVol;
      fCurrentNode = newNod;
      fMotherNode = newMom;
      fCurrentMatrix = *newMatx;
      fCurrentPath = newPath;

//        Info("PropagateParticle","after ParticleEntersNewVolume\nnow i am in %s on node %s with path %s and matrix:",
//             fCurrentVolume->GetName(),fCurrentNode->GetName(),fCurrentPath.Data());
//        fCurrentMatrix.Print();

      // move on to next volume crossed by trajectory
      fGeometry->FindNextBoundaryAndStep();
      fStepSize = fGeometry->GetStep();
      newVol = fGeometry->GetCurrentVolume();
      newNod = fGeometry->GetCurrentNode();
      newMom = fGeometry->GetMother();
      newMatx = fGeometry->GetCurrentMatrix();
      newPath = fGeometry->GetPath();
   }
}