Bug 1352572 - Return an NPERR_GENERIC_ERROR if plugin tries to call NPN_PostURL(file=true); r?bsmedberg draft
authorLie Ryan <lie.1296@gmail.com>
Sat, 08 Apr 2017 16:48:47 +0000
changeset 569537 8c436da4ab5c1a46bc4bff7fba0f32604007d57c
parent 569522 0b69bd8646896c719444e4b2398269ba857dc504
child 569538 a060f42eb287942c9a789fa38db9624e46e9f6d1
push id56214
push userbmo:lie.1296@gmail.com
push dateThu, 27 Apr 2017 16:26:57 +0000
reviewersbsmedberg
bugs1352572
milestone55.0a1
Bug 1352572 - Return an NPERR_GENERIC_ERROR if plugin tries to call NPN_PostURL(file=true); r?bsmedberg NPN_PostURL(file=true) is no longer supported in NPAPI. MozReview-Commit-ID: IyLJSj4bKRR
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/test/mochitest/test_streamNotify.html
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -1199,16 +1199,20 @@ NPError
          const char* aTarget,
          uint32_t aLength,
          const char* aBuffer,
          NPBool aIsFile)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
 
+    if (aIsFile) {
+      PLUGIN_LOG_DEBUG(("NPN_PostURL with file=true is no longer supported"));
+      return NPERR_GENERIC_ERROR;
+    }
     NPError err;
     // FIXME what should happen when |aBuffer| is null?
     InstCast(aNPP)->CallNPN_PostURL(NullableString(aRelativeURL),
                                     NullableString(aTarget),
                                     nsDependentCString(aBuffer, aLength),
                                     aIsFile, &err);
     return err;
 }
--- a/dom/plugins/test/mochitest/test_streamNotify.html
+++ b/dom/plugins/test/mochitest/test_streamNotify.html
@@ -78,12 +78,14 @@
                       is(t, "World", "GET data: URI correct");
                       testDone();
                     }, null, true), "streamTest GET data: URI");
 
     ok(!p.streamTest("data:malformed?", false, null, null,
                      function(r, t) {
                        todo(false, "Shouldn't get callback for invalid data: URI");
                      }, null, true), "streamTest GET bad data: URI");
+
+    ok(!p.postFileToURLTest("post.sjs"), "postFileToURLTest POST a file");
   }
   </script>
 
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>