void GeckoMediaPluginService::GMPCrashCallback::Run(const nsACString& aPluginName) { dom::PluginCrashedEventInit init; init.mPluginID = mPluginId; init.mBubbles = true; init.mCancelable = true; init.mGmpPlugin = true; CopyUTF8toUTF16(aPluginName, init.mPluginName); init.mSubmittedCrashReport = false; // The following PluginCrashedEvent fields stay empty: // init.mBrowserDumpID // init.mPluginFilename // TODO: Can/should we fill them? nsCOMPtr<nsPIDOMWindow> parentWindow; nsCOMPtr<nsIDocument> document; if (!GetParentWindowAndDocumentIfValid(parentWindow, document)) { return; } RefPtr<dom::PluginCrashedEvent> event = dom::PluginCrashedEvent::Constructor(document, NS_LITERAL_STRING("PluginCrashed"), init); event->SetTrusted(true); event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true; EventDispatcher::DispatchDOMEvent(parentWindow, nullptr, event, nullptr, nullptr); }
bool GeckoMediaPluginService::GMPCrashCallback::IsStillValid() { nsCOMPtr<nsPIDOMWindow> parentWindow; nsCOMPtr<nsIDocument> document; return GetParentWindowAndDocumentIfValid(parentWindow, document); }
virtual bool IsStillValid() override { nsCOMPtr<nsPIDOMWindow> parentWindow; nsCOMPtr<nsIDocument> document; return GetParentWindowAndDocumentIfValid(parentWindow, document); }