diff --git a/dom/plugins/ipc/PPluginModule.ipdl b/dom/plugins/ipc/PPluginModule.ipdl index fbb6e722f4f..325a7273bf9 100644 --- a/dom/plugins/ipc/PPluginModule.ipdl +++ b/dom/plugins/ipc/PPluginModule.ipdl @@ -39,6 +39,7 @@ include protocol PPluginIdentifier; include protocol PPluginInstance; +include protocol PPluginScriptableObject; include "npapi.h"; include "mozilla/plugins/PluginMessageUtils.h"; @@ -153,6 +154,9 @@ parent: async PushCursor(NSCursorInfo cursorInfo); async PopCursor(); sync GetNativeCursorsSupported() returns (bool supported); + + sync NPN_SetException(nullable PPluginScriptableObject actor, + nsCString message); }; } // namespace plugins diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index f437b352dad..94240ffe58f 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -1516,7 +1516,19 @@ _setexception(NPObject* aNPObj, { PLUGIN_LOG_DEBUG_FUNCTION; ENSURE_PLUGIN_THREAD_VOID(); - NS_WARNING("Not yet implemented!"); + + PluginModuleChild* self = PluginModuleChild::current(); + PluginScriptableObjectChild* actor = NULL; + if (aNPObj) { + actor = self->GetActorForNPObject(aNPObj); + if (!actor) { + NS_ERROR("Failed to get actor!"); + return; + } + } + + self->SendNPN_SetException(static_cast(actor), + NullableString(aMessage)); } void NP_CALLBACK diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index c48e926c2c1..aceb7492eee 100644 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1209,3 +1209,21 @@ PluginModuleParent::RemoveFromRefreshTimer(PluginInstanceParent *aInstance) { } } #endif + +bool +PluginModuleParent::RecvNPN_SetException(PPluginScriptableObjectParent* aActor, + const nsCString& aMessage) +{ + PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION)); + + NPObject* aNPObj = NULL; + if (aActor) { + aNPObj = static_cast(aActor)->GetObject(true); + if (!aNPObj) { + NS_ERROR("Failed to get object!"); + return false; + } + } + mozilla::plugins::parent::_setexception(aNPObj, NullableStringGet(aMessage)); + return true; +} diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index 4efb3500363..576dddb7f31 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -210,6 +210,10 @@ protected: NS_OVERRIDE virtual bool RecvGetNativeCursorsSupported(bool* supported); + NS_OVERRIDE virtual bool + RecvNPN_SetException(PPluginScriptableObjectParent* aActor, + const nsCString& aMessage); + static PluginInstanceParent* InstCast(NPP instance); static BrowserStreamParent* StreamCast(NPP instance, NPStream* s); diff --git a/dom/plugins/test/mochitest/Makefile.in b/dom/plugins/test/mochitest/Makefile.in index dc48592f145..0e27707eee0 100644 --- a/dom/plugins/test/mochitest/Makefile.in +++ b/dom/plugins/test/mochitest/Makefile.in @@ -102,10 +102,10 @@ _MOCHITEST_FILES = \ test_clear_site_data.html \ test_zero_opacity.html \ test_NPPVpluginWantsAllNetworkStreams.html \ + test_npruntime_npnsetexception.html \ $(NULL) # test_plugin_scroll_painting.html \ bug 596491 -# test_npruntime_npnsetexception.html \ Disabled for e10s ifeq ($(OS_ARCH),WINNT) _MOCHITEST_FILES += \