Bug 1449736: Properly detect failure in receiving plugin NPObjects (r=jmathies)
☠☠ backed out by 75be9882c2ae ☠ ☠
authorDavid Parks <dparks@mozilla.com>
Wed, 09 Jan 2019 16:36:59 +0000
changeset 510431 49be7aaa199c0be85ec2667c650d4627cfec84c1
parent 510430 23186317acd06f39ae6a2f661543757c3ac062b6
child 510432 15895cfafac18c606afcfac68d89cc4f3653d065
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1449736
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1449736: Properly detect failure in receiving plugin NPObjects (r=jmathies) We need to recognize IPDL errors in order to return the proper error status when the right PluginScriptableObject could not be found. Differential Revision: https://phabricator.services.mozilla.com/D15469
dom/plugins/ipc/PluginInstanceChild.cpp
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -263,38 +263,38 @@ NPError PluginInstanceChild::DoNPP_New()
 
 int PluginInstanceChild::GetQuirks() {
   return PluginModuleChild::GetChrome()->GetQuirks();
 }
 
 NPError PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue,
                                                          NPObject** aObject) {
   PluginScriptableObjectChild* actor = nullptr;
-  NPError result = NPERR_NO_ERROR;
+  NPError result = NPERR_GENERIC_ERROR;
 
   switch (aValue) {
     case NPNVWindowNPObject:
       if (!(actor = mCachedWindowActor)) {
         PPluginScriptableObjectChild* actorProtocol;
-        CallNPN_GetValue_NPNVWindowNPObject(&actorProtocol, &result);
-        if (result == NPERR_NO_ERROR) {
+        if (CallNPN_GetValue_NPNVWindowNPObject(&actorProtocol, &result) &&
+            (result == NPERR_NO_ERROR)) {
           actor = mCachedWindowActor =
               static_cast<PluginScriptableObjectChild*>(actorProtocol);
           NS_ASSERTION(actor, "Null actor!");
           PluginModuleChild::sBrowserFuncs.retainobject(
               actor->GetObject(false));
         }
       }
       break;
 
     case NPNVPluginElementNPObject:
       if (!(actor = mCachedElementActor)) {
         PPluginScriptableObjectChild* actorProtocol;
-        CallNPN_GetValue_NPNVPluginElementNPObject(&actorProtocol, &result);
-        if (result == NPERR_NO_ERROR) {
+        if (CallNPN_GetValue_NPNVPluginElementNPObject(&actorProtocol, &result) &&
+            (result == NPERR_NO_ERROR)) {
           actor = mCachedElementActor =
               static_cast<PluginScriptableObjectChild*>(actorProtocol);
           NS_ASSERTION(actor, "Null actor!");
           PluginModuleChild::sBrowserFuncs.retainobject(
               actor->GetObject(false));
         }
       }
       break;