From 21912efc29e7152414d4ce7d0e66008697f88a57 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Tue, 15 Nov 2016 15:35:54 -0800 Subject: [PATCH] Bug 1318506 - Label PluginInstance IPC messages with plugin's DocGroup (r=jimm) The goal here is to assign a DocGroup to every runnable. This patch labels all IPC message handlers for PPluginInstance with the DocGroup of the plugin instance's document. MozReview-Commit-ID: 6OIard9n2GB --- dom/plugins/ipc/PluginModuleParent.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 3f02b60f9af8..7a67e8112f2b 100644 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -2756,6 +2756,19 @@ PluginModuleParent::NPP_NewInternal(NPMIMEType pluginType, NPP instance, // Now replace it with the instance instance->pdata = static_cast(parentInstance); + // Any IPC messages for the PluginInstance actor should be dispatched to the + // DocGroup for the plugin's document. + RefPtr owner = parentInstance->GetOwner(); + nsCOMPtr elt; + owner->GetDOMElement(getter_AddRefs(elt)); + if (nsCOMPtr node = do_QueryInterface(elt)) { + nsCOMPtr doc = node->OwnerDoc(); + if (doc) { + nsCOMPtr eventTarget = doc->EventTargetFor(dom::TaskCategory::Other); + SetEventTargetForActor(parentInstance, eventTarget); + } + } + if (!SendPPluginInstanceConstructor(parentInstance, nsDependentCString(pluginType), mode, names, values)) {