nsresult PresentationRequestParent::DoRequest(const SendSessionMessageRequest& aRequest) { MOZ_ASSERT(mService); // Validate the accessibility (primarily for receiver side) so that a // compromised child process can't fake the ID. if (NS_WARN_IF(!static_cast<PresentationService*>(mService.get())-> IsSessionAccessible(aRequest.sessionId(), OtherPid()))) { return NotifyError(NS_ERROR_DOM_SECURITY_ERR); } nsresult rv = mService->SendSessionMessage(aRequest.sessionId(), aRequest.data()); if (NS_WARN_IF(NS_FAILED(rv))) { return NotifyError(rv); } return NotifySuccess(); }
nsresult PresentationRequestParent::DoRequest(const SendSessionMessageRequest& aRequest) { MOZ_ASSERT(mService); // Validate the accessibility (primarily for receiver side) so that a // compromised child process can't fake the ID. if (NS_WARN_IF(!static_cast<PresentationService*>(mService.get())-> IsSessionAccessible(aRequest.sessionId(), OtherPid()))) { return NotifyError(NS_ERROR_DOM_SECURITY_ERR); } nsTArray<mozilla::ipc::FileDescriptor> fds; nsCOMPtr<nsIInputStream> stream = DeserializeInputStream(aRequest.data(), fds); if(NS_WARN_IF(!stream)) { return NotifyError(NS_ERROR_NOT_AVAILABLE); } nsresult rv = mService->SendSessionMessage(aRequest.sessionId(), stream); if (NS_WARN_IF(NS_FAILED(rv))) { return NotifyError(rv); } return NotifySuccess(); }