Bug 1279218 - Remove Java Test Plugin and rest of Java references; r=bsmedberg draft
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 17 Jul 2017 16:45:48 -0700
changeset 617654 1d454b720d7231c8d4a80155b5a65981fa88af77
parent 617653 421234152e9863e0a72da82f61629dd1ad449c80
child 617655 85a11b41649f95e0819c5801b9a099c7f62068c1
child 617657 5442274c1f106d62baac9bdc1c8f68259f643304
child 617670 d9e03399412adb0682ea2fbaf0eb70bcabba3c5c
child 617914 523eb0af58b6835f7c7acdfc1f535b1f2a83c9a1
push id71110
push userbmo:kyle@nonpolynomial.com
push dateFri, 28 Jul 2017 19:36:45 +0000
reviewersbsmedberg
bugs1279218
milestone56.0a1
Bug 1279218 - Remove Java Test Plugin and rest of Java references; r=bsmedberg MozReview-Commit-ID: IzqYDED7Tui
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsNPAPIPluginInstance.h
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginHost.h
dom/plugins/base/nsPluginTags.cpp
dom/plugins/base/nsPluginTags.h
dom/plugins/ipc/PluginTypes.ipdlh
dom/plugins/test/mochitest/test_secondPlugin.html
dom/plugins/test/testplugin/javaplugin/Info.plist
dom/plugins/test/testplugin/javaplugin/moz.build
dom/plugins/test/testplugin/javaplugin/nptest.def
dom/plugins/test/testplugin/javaplugin/nptest.rc
dom/plugins/test/testplugin/javaplugin/nptest_name.cpp
dom/plugins/test/testplugin/moz.build
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -1085,28 +1085,16 @@ NPObject*
 void
 _releaseobject(NPObject* npobj)
 {
   // If nothing is passed, just return, even if we're on the wrong thread.
   if (!npobj) {
     return;
   }
 
-  // THIS IS A KNOWN LEAK. SEE BUG 1221448.
-  // If releaseobject is called off the main thread and we have a valid pointer,
-  // we at least know it was created on the main thread (see _createobject
-  // implementation). However, forwarding the deletion back to the main thread
-  // without careful checking could cause bad memory management races. So, for
-  // now, we leak by warning and then just returning early. But it should fix
-  // java 7 crashes.
-  if (!NS_IsMainThread()) {
-    NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_releaseobject called from the wrong thread\n"));
-    return;
-  }
-
   int32_t refCnt = PR_ATOMIC_DECREMENT((int32_t*)&npobj->referenceCount);
   NS_LOG_RELEASE(npobj, refCnt, "BrowserNPObject");
 
   if (refCnt == 0) {
     nsNPObjWrapper::OnDestroy(npobj);
 
     NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                    ("Deleting NPObject %p, refcount hit 0\n", npobj));
@@ -1287,98 +1275,16 @@ bool
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_GetProperty(npp %p, npobj %p, property %p) called\n",
                   npp, npobj, property));
 
   if (!npobj->_class->getProperty(npobj, property, result))
     return false;
 
-  // If a Java plugin tries to get the document.URL or document.documentURI
-  // property from us, don't pass back a value that Java won't be able to
-  // understand -- one that will make the URL(String) constructor throw a
-  // MalformedURL exception.  Passing such a value causes Java Plugin2 to
-  // crash (to throw a RuntimeException in Plugin2Manager.getDocumentBase()).
-  // Also don't pass back a value that Java is likely to mishandle.
-
-  nsNPAPIPluginInstance* inst = (nsNPAPIPluginInstance*) npp->ndata;
-  if (!inst)
-    return false;
-  nsNPAPIPlugin* plugin = inst->GetPlugin();
-  if (!plugin)
-    return false;
-  RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
-  nsPluginTag* pluginTag = host->TagForPlugin(plugin);
-  if (!pluginTag->mIsJavaPlugin)
-    return true;
-
-  if (!NPVARIANT_IS_STRING(*result))
-    return true;
-
-  NPUTF8* propertyName = _utf8fromidentifier(property);
-  if (!propertyName)
-    return true;
-  bool notURL =
-    (PL_strcasecmp(propertyName, "URL") &&
-     PL_strcasecmp(propertyName, "documentURI"));
-  _memfree(propertyName);
-  if (notURL)
-    return true;
-
-  NPObject* window_obj = _getwindowobject(npp);
-  if (!window_obj)
-    return true;
-
-  NPVariant doc_v;
-  NPObject* document_obj = nullptr;
-  NPIdentifier doc_id = _getstringidentifier("document");
-  bool ok = npobj->_class->getProperty(window_obj, doc_id, &doc_v);
-  _releaseobject(window_obj);
-  if (ok) {
-    if (NPVARIANT_IS_OBJECT(doc_v)) {
-      document_obj = NPVARIANT_TO_OBJECT(doc_v);
-    } else {
-      _releasevariantvalue(&doc_v);
-      return true;
-    }
-  } else {
-    return true;
-  }
-  _releaseobject(document_obj);
-  if (document_obj != npobj)
-    return true;
-
-  NPString urlnp = NPVARIANT_TO_STRING(*result);
-  nsXPIDLCString url;
-  url.Assign(urlnp.UTF8Characters, urlnp.UTF8Length);
-
-  bool javaCompatible = false;
-  if (NS_FAILED(NS_CheckIsJavaCompatibleURLString(url, &javaCompatible)))
-    javaCompatible = false;
-  if (javaCompatible)
-    return true;
-
-  // If Java won't be able to interpret the original value of document.URL or
-  // document.documentURI, or is likely to mishandle it, pass back something
-  // that Java will understand but won't be able to use to access the network,
-  // and for which same-origin checks will always fail.
-
-  if (inst->mFakeURL.IsVoid()) {
-    // Abort (do an error return) if NS_MakeRandomInvalidURLString() fails.
-    if (NS_FAILED(NS_MakeRandomInvalidURLString(inst->mFakeURL))) {
-      _releasevariantvalue(result);
-      return false;
-    }
-  }
-
-  _releasevariantvalue(result);
-  char* fakeurl = (char *) _memalloc(inst->mFakeURL.Length() + 1);
-  strcpy(fakeurl, inst->mFakeURL);
-  STRINGZ_TO_NPVARIANT(fakeurl, *result);
-
   return true;
 }
 
 bool
 _setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
              const NPVariant *value)
 {
   if (!NS_IsMainThread()) {
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -136,17 +136,16 @@ nsNPAPIPluginInstance::nsNPAPIPluginInst
   , mMIMEType(nullptr)
   , mOwner(nullptr)
 #ifdef XP_MACOSX
   , mCurrentPluginEvent(nullptr)
 #endif
 #ifdef MOZ_WIDGET_ANDROID
   , mOnScreen(true)
 #endif
-  , mHaveJavaC2PJSObjectQuirk(false)
   , mCachedParamLength(0)
   , mCachedParamNames(nullptr)
   , mCachedParamValues(nullptr)
   , mMuted(false)
 {
   mNPP.pdata = nullptr;
   mNPP.ndata = this;
 
@@ -413,18 +412,16 @@ nsNPAPIPluginInstance::Start()
     pos++;
   }
 
   const char*   mimetype;
   NPError       error = NPERR_GENERIC_ERROR;
 
   GetMIMEType(&mimetype);
 
-  CheckJavaC2PJSObjectQuirk(quirkParamLength, mCachedParamNames, mCachedParamValues);
-
   bool oldVal = mInPluginInitCall;
   mInPluginInitCall = true;
 
   // Need this on the stack before calling NPP_New otherwise some callbacks that
   // the plugin may make could fail (NPN_HasProperty, for example).
   NPPAutoPusher autopush(&mNPP);
 
   if (!mPlugin)
@@ -459,24 +456,18 @@ nsNPAPIPluginInstance::Start()
 
 nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
 {
   // NPAPI plugins don't want a SetWindow(nullptr).
   if (!window || RUNNING != mRunning)
     return NS_OK;
 
 #if MOZ_WIDGET_GTK
-  // bug 108347, flash plugin on linux doesn't like window->width <=
-  // 0, but Java needs wants this call.
-  if (window && window->type == NPWindowTypeWindow &&
-      (window->width <= 0 || window->height <= 0) &&
-      (nsPluginHost::GetSpecialType(nsDependentCString(mMIMEType)) !=
-       nsPluginHost::eSpecialType_Java)) {
-    return NS_OK;
-  }
+  // bug 108347, flash plugin on linux doesn't like window->width <= 0
+  return NS_OK;
 #endif
 
   if (!mPlugin || !mPlugin->GetLibrary())
     return NS_ERROR_FAILURE;
 
   NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
 
   if (pluginFunctions->setwindow) {
@@ -1039,20 +1030,16 @@ nsNPAPIPluginInstance::CSSZoomFactorChan
   NS_TRY_SAFE_CALL_RETURN(error, (*pluginFunctions->setvalue)(&mNPP, NPNVCSSZoomFactor, &value), this,
                           NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
   return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult
 nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
 {
-  if (mHaveJavaC2PJSObjectQuirk) {
-    return NS_ERROR_FAILURE;
-  }
-
   NPObject *npobj = nullptr;
   nsresult rv = GetValueFromPlugin(NPPVpluginScriptableNPObject, &npobj);
   if (NS_FAILED(rv) || !npobj)
     return NS_ERROR_FAILURE;
 
   *outObject = nsNPObjWrapper::GetNewOrUsed(&mNPP, cx, npobj);
 
   _releaseobject(npobj);
@@ -1594,106 +1581,16 @@ nsNPAPIPluginInstance::FinalizeAsyncSurf
 void
 nsNPAPIPluginInstance::SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed)
 {
   if (mOwner) {
     mOwner->SetCurrentAsyncSurface(surface, changed);
   }
 }
 
-static bool
-GetJavaVersionFromMimetype(nsPluginTag* pluginTag, nsCString& version)
-{
-  for (uint32_t i = 0; i < pluginTag->MimeTypes().Length(); ++i) {
-    nsCString type = pluginTag->MimeTypes()[i];
-    nsAutoCString jpi("application/x-java-applet;jpi-version=");
-
-    int32_t idx = type.Find(jpi, false, 0, -1);
-    if (idx != 0) {
-      continue;
-    }
-
-    type.Cut(0, jpi.Length());
-    if (type.IsEmpty()) {
-      continue;
-    }
-
-    type.ReplaceChar('_', '.');
-    version = type;
-    return true;
-  }
-
-  return false;
-}
-
-void
-nsNPAPIPluginInstance::CheckJavaC2PJSObjectQuirk(uint16_t paramCount,
-                                                 const char* const* paramNames,
-                                                 const char* const* paramValues)
-{
-  if (!mMIMEType || !mPlugin) {
-    return;
-  }
-
-  nsPluginTagType tagtype;
-  nsresult rv = GetTagType(&tagtype);
-  if (NS_FAILED(rv) ||
-      (tagtype != nsPluginTagType_Applet)) {
-    return;
-  }
-
-  RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
-  if (!pluginHost) {
-    return;
-  }
-
-  nsPluginTag* pluginTag = pluginHost->TagForPlugin(mPlugin);
-  if (!pluginTag ||
-      !pluginTag->mIsJavaPlugin) {
-    return;
-  }
-
-  // check the params for "code" being present and non-empty
-  bool haveCodeParam = false;
-  bool isCodeParamEmpty = true;
-
-  for (uint16_t i = paramCount; i > 0; --i) {
-    if (PL_strcasecmp(paramNames[i - 1], "code") == 0) {
-      haveCodeParam = true;
-      if (strlen(paramValues[i - 1]) > 0) {
-        isCodeParamEmpty = false;
-      }
-      break;
-    }
-  }
-
-  // Due to the Java version being specified inconsistently across platforms
-  // check the version via the mimetype for choosing specific Java versions
-  nsCString javaVersion;
-  if (!GetJavaVersionFromMimetype(pluginTag, javaVersion)) {
-    return;
-  }
-
-  mozilla::Version version(javaVersion.get());
-
-  if (version >= "1.7.0.4") {
-    return;
-  }
-
-  if (!haveCodeParam && version >= "1.6.0.34" && version < "1.7") {
-    return;
-  }
-
-  if (haveCodeParam && !isCodeParamEmpty) {
-    return;
-  }
-
-  mHaveJavaC2PJSObjectQuirk = true;
-}
-
 double
 nsNPAPIPluginInstance::GetContentsScaleFactor()
 {
   double scaleFactor = 1.0;
   if (mOwner) {
     mOwner->GetContentsScaleFactor(&scaleFactor);
   }
   return scaleFactor;
--- a/dom/plugins/base/nsNPAPIPluginInstance.h
+++ b/dom/plugins/base/nsNPAPIPluginInstance.h
@@ -329,21 +329,16 @@ public:
   }
 
 protected:
 
   virtual ~nsNPAPIPluginInstance();
 
   nsresult GetTagType(nsPluginTagType *result);
 
-  // check if this is a Java applet and affected by bug 750480
-  void CheckJavaC2PJSObjectQuirk(uint16_t paramCount,
-                                 const char* const* names,
-                                 const char* const* values);
-
   nsresult CreateAudioChannelAgentIfNeeded();
 
   // The structure used to communicate between the plugin instance and
   // the browser.
   NPP_t mNPP;
 
   NPDrawingModel mDrawingModel;
 
@@ -414,19 +409,16 @@ private:
 #ifdef MOZ_WIDGET_ANDROID
   mozilla::java::GeckoSurface::LocalRef CreateSurface();
   std::map<void*, VideoInfo*> mVideos;
   bool mOnScreen;
 
   nsIntSize mCurrentSize;
 #endif
 
-  // is this instance Java and affected by bug 750480?
-  bool mHaveJavaC2PJSObjectQuirk;
-
   static uint32_t gInUnsafePluginCalls;
 
   // The arrays can only be released when the plugin instance is destroyed,
   // because the plugin, in in-process mode, might keep a reference to them.
   uint32_t mCachedParamLength;
   char **mCachedParamNames;
   char **mCachedParamValues;
 
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -134,17 +134,16 @@ using mozilla::dom::FakePluginMimeEntry;
 
 // this is the name of the directory which will be created
 // to cache temporary files.
 #define kPluginTmpDirName NS_LITERAL_CSTRING("plugtmp")
 
 static const char *kPrefWhitelist = "plugin.allowed_types";
 static const char *kPrefLoadInParentPrefix = "plugin.load_in_parent_process.";
 static const char *kPrefDisableFullPage = "plugin.disable_full_page_plugin_for_types";
-static const char *kPrefJavaMIME = "plugin.java.mime";
 
 // How long we wait before unloading an idle plugin process.
 // Defaults to 30 seconds.
 static const char *kPrefUnloadPluginTimeoutSecs = "dom.ipc.plugins.unloadTimeoutSecs";
 static const uint32_t kDefaultPluginUnloadingTimeout = 30;
 
 static const char *kPluginRegistryVersion = "0.18";
 
@@ -1811,30 +1810,16 @@ nsPluginHost::GetSpecialType(const nsACS
   }
 
   if (aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash") ||
       aMIMEType.LowerCaseEqualsASCII("application/futuresplash") ||
       aMIMEType.LowerCaseEqualsASCII("application/x-shockwave-flash-test")) {
     return eSpecialType_Flash;
   }
 
-  // Java registers variants of its MIME with parameters, e.g.
-  // application/x-java-vm;version=1.3
-  const nsACString &noParam = Substring(aMIMEType, 0, aMIMEType.FindChar(';'));
-
-  // The java mime pref may well not be one of these,
-  // e.g. application/x-java-test used in the test suite
-  nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
-  if ((!javaMIME.IsEmpty() && noParam.LowerCaseEqualsASCII(javaMIME)) ||
-      noParam.LowerCaseEqualsASCII("application/x-java-vm") ||
-      noParam.LowerCaseEqualsASCII("application/x-java-applet") ||
-      noParam.LowerCaseEqualsASCII("application/x-java-bean")) {
-    return eSpecialType_Java;
-  }
-
   return eSpecialType_None;
 }
 
 // Check whether or not a tag is a live, valid tag, and that it's loaded.
 bool
 nsPluginHost::IsLiveTag(nsIPluginTag* aPluginTag)
 {
   nsCOMPtr<nsIInternalPluginTag> internalTag(do_QueryInterface(aPluginTag));
@@ -1989,18 +1974,17 @@ ShouldAddPlugin(const nsPluginInfo& info
          !strcmp(info.fMimeTypeArray[i], "application/x-shockwave-flash-test"))) {
       return true;
     }
     if (flashOnly) {
       continue;
     }
     if (info.fMimeTypeArray[i] &&
         (!strcmp(info.fMimeTypeArray[i], "application/x-test") ||
-         !strcmp(info.fMimeTypeArray[i], "application/x-Second-Test") ||
-         !strcmp(info.fMimeTypeArray[i], "application/x-java-test"))) {
+         !strcmp(info.fMimeTypeArray[i], "application/x-Second-Test"))) {
       return true;
     }
   }
 #ifdef PLUGIN_LOGGING
   PLUGIN_LOG(PLUGIN_LOG_NORMAL,
              ("ShouldAddPlugin : Ignoring non-flash plugin library %s\n", aPluginTag->FileName().get()));
 #endif // PLUGIN_LOGGING
   return false;
@@ -2374,17 +2358,16 @@ nsPluginHost::SetPluginsInContent(uint32
                                                tag.name().get(),
                                                tag.description().get(),
                                                tag.filename().get(),
                                                "", // aFullPath
                                                tag.version().get(),
                                                nsTArray<nsCString>(tag.mimeTypes()),
                                                nsTArray<nsCString>(tag.mimeDescriptions()),
                                                nsTArray<nsCString>(tag.extensions()),
-                                               tag.isJavaPlugin(),
                                                tag.isFlashPlugin(),
                                                tag.supportsAsyncRender(),
                                                tag.lastModifiedTime(),
                                                tag.isFromExtension(),
                                                tag.sandboxLevel(),
                                                tag.blocklistState());
       AddPluginTag(pluginTag);
     }
@@ -2620,17 +2603,16 @@ nsPluginHost::SendPluginsToContent()
     }
 
     pluginTags.AppendElement(PluginTag(tag->mId,
                                        tag->Name(),
                                        tag->Description(),
                                        tag->MimeTypes(),
                                        tag->MimeDescriptions(),
                                        tag->Extensions(),
-                                       tag->mIsJavaPlugin,
                                        tag->mIsFlashPlugin,
                                        tag->mSupportsAsyncRender,
                                        tag->FileName(),
                                        tag->Version(),
                                        tag->mLastModifiedTime,
                                        tag->IsFromExtension(),
                                        tag->mSandboxLevel,
                                        blocklistState));
@@ -3957,18 +3939,17 @@ nsPluginHost::CanUsePluginForMIMEType(co
   // We only support flash as a plugin, so if the mime types don't match for
   // those, exit before we start loading plugins.
   //
   // XXX: Remove test/java cases when bug 1351885 lands.
   if (nsPluginHost::GetSpecialType(aMIMEType) == nsPluginHost::eSpecialType_Flash ||
       MimeTypeIsAllowedForFakePlugin(NS_ConvertUTF8toUTF16(aMIMEType)) ||
       aMIMEType.LowerCaseEqualsLiteral("application/x-test") ||
       aMIMEType.LowerCaseEqualsLiteral("application/x-second-test") ||
-      aMIMEType.LowerCaseEqualsLiteral("application/x-third-test") ||
-      aMIMEType.LowerCaseEqualsLiteral("application/x-java-test")) {
+      aMIMEType.LowerCaseEqualsLiteral("application/x-third-test")) {
     return true;
   }
 
   return false;
 }
 
 // Runnable that does an async destroy of a plugin.
 
--- a/dom/plugins/base/nsPluginHost.h
+++ b/dom/plugins/base/nsPluginHost.h
@@ -201,20 +201,17 @@ public:
   CanUsePluginForMIMEType(const nsACString& aMIMEType);
 
   // checks whether aType is a type we recognize for potential special handling
   enum SpecialType {
     eSpecialType_None,
     // Needed to whitelist for async init support
     eSpecialType_Test,
     // Informs some decisions about OOP and quirks
-    eSpecialType_Flash,
-    // Binds to the <applet> tag, has various special
-    // rules around opening channels, codebase, ...
-    eSpecialType_Java
+    eSpecialType_Flash
   };
   static SpecialType GetSpecialType(const nsACString & aMIMEType);
 
   static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
 
   void PluginCrashed(nsNPAPIPlugin* plugin,
                      const nsAString& pluginDumpID,
                      const nsAString& browserDumpID);
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -225,17 +225,16 @@ nsPluginTag::nsPluginTag(nsPluginInfo* a
                          int64_t aLastModifiedTime,
                          bool fromExtension)
   : nsIInternalPluginTag(aPluginInfo->fName, aPluginInfo->fDescription,
                          aPluginInfo->fFileName, aPluginInfo->fVersion),
     mId(sNextId++),
     mContentProcessRunningCount(0),
     mHadLocalInstance(false),
     mLibrary(nullptr),
-    mIsJavaPlugin(false),
     mIsFlashPlugin(false),
     mSupportsAsyncRender(false),
     mFullPath(aPluginInfo->fFullPath),
     mLastModifiedTime(aLastModifiedTime),
     mSandboxLevel(0),
     mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED),
     mCachedBlocklistStateValid(false),
     mIsFromExtension(fromExtension)
@@ -261,17 +260,16 @@ nsPluginTag::nsPluginTag(const char* aNa
                          int64_t aLastModifiedTime,
                          bool fromExtension,
                          bool aArgsAreUTF8)
   : nsIInternalPluginTag(aName, aDescription, aFileName, aVersion),
     mId(sNextId++),
     mContentProcessRunningCount(0),
     mHadLocalInstance(false),
     mLibrary(nullptr),
-    mIsJavaPlugin(false),
     mIsFlashPlugin(false),
     mSupportsAsyncRender(false),
     mFullPath(aFullPath),
     mLastModifiedTime(aLastModifiedTime),
     mSandboxLevel(0),
     mCachedBlocklistState(nsIBlocklistService::STATE_NOT_BLOCKED),
     mCachedBlocklistStateValid(false),
     mIsFromExtension(fromExtension)
@@ -288,29 +286,27 @@ nsPluginTag::nsPluginTag(uint32_t aId,
                          const char* aName,
                          const char* aDescription,
                          const char* aFileName,
                          const char* aFullPath,
                          const char* aVersion,
                          nsTArray<nsCString> aMimeTypes,
                          nsTArray<nsCString> aMimeDescriptions,
                          nsTArray<nsCString> aExtensions,
-                         bool aIsJavaPlugin,
                          bool aIsFlashPlugin,
                          bool aSupportsAsyncRender,
                          int64_t aLastModifiedTime,
                          bool aFromExtension,
                          int32_t aSandboxLevel,
                          uint16_t aBlocklistState)
   : nsIInternalPluginTag(aName, aDescription, aFileName, aVersion, aMimeTypes,
                          aMimeDescriptions, aExtensions),
     mId(aId),
     mContentProcessRunningCount(0),
     mLibrary(nullptr),
-    mIsJavaPlugin(aIsJavaPlugin),
     mIsFlashPlugin(aIsFlashPlugin),
     mSupportsAsyncRender(aSupportsAsyncRender),
     mLastModifiedTime(aLastModifiedTime),
     mSandboxLevel(aSandboxLevel),
     mNiceFileName(),
     mCachedBlocklistState(aBlocklistState),
     mCachedBlocklistStateValid(true),
     mIsFromExtension(aFromExtension)
@@ -345,19 +341,16 @@ void nsPluginTag::InitMime(const char* c
     ToLowerCase(mimeType);
 
     if (!nsPluginHost::IsTypeWhitelisted(mimeType.get())) {
       continue;
     }
 
     // Look for certain special plugins.
     switch (nsPluginHost::GetSpecialType(mimeType)) {
-      case nsPluginHost::eSpecialType_Java:
-        mIsJavaPlugin = true;
-        break;
       case nsPluginHost::eSpecialType_Flash:
         // VLC sometimes claims to implement the Flash MIME type, and we want
         // to allow users to control that separately from Adobe Flash.
         if (Name().EqualsLiteral("Shockwave Flash")) {
           mIsFlashPlugin = true;
         }
         break;
       case nsPluginHost::eSpecialType_Test:
@@ -683,21 +676,16 @@ nsPluginTag::GetNiceFileName()
     return mNiceFileName;
   }
 
   if (mIsFlashPlugin) {
     mNiceFileName.AssignLiteral("flash");
     return mNiceFileName;
   }
 
-  if (mIsJavaPlugin) {
-    mNiceFileName.AssignLiteral("java");
-    return mNiceFileName;
-  }
-
   mNiceFileName = MakeNiceFileName(mFileName);
   return mNiceFileName;
 }
 
 NS_IMETHODIMP
 nsPluginTag::GetNiceName(nsACString & aResult)
 {
   aResult = GetNiceFileName();
--- a/dom/plugins/base/nsPluginTags.h
+++ b/dom/plugins/base/nsPluginTags.h
@@ -125,17 +125,16 @@ public:
               const char* aName,
               const char* aDescription,
               const char* aFileName,
               const char* aFullPath,
               const char* aVersion,
               nsTArray<nsCString> aMimeTypes,
               nsTArray<nsCString> aMimeDescriptions,
               nsTArray<nsCString> aExtensions,
-              bool aIsJavaPlugin,
               bool aIsFlashPlugin,
               bool aSupportsAsyncRender,
               int64_t aLastModifiedTime,
               bool aFromExtension,
               int32_t aSandboxLevel,
               uint16_t aBlocklistState);
 
   void TryUnloadPlugin(bool inShutdown);
@@ -163,17 +162,16 @@ public:
   // Number of PluginModuleParents living in all content processes.
   size_t        mContentProcessRunningCount;
 
   // True if we've ever created an instance of this plugin in the current process.
   bool          mHadLocalInstance;
 
   PRLibrary     *mLibrary;
   RefPtr<nsNPAPIPlugin> mPlugin;
-  bool          mIsJavaPlugin;
   bool          mIsFlashPlugin;
   bool          mSupportsAsyncRender;
   nsCString     mFullPath; // UTF-8
   int64_t       mLastModifiedTime;
   nsCOMPtr<nsITimer> mUnloadTimer;
   int32_t       mSandboxLevel;
 
   void          InvalidateBlocklistState();
--- a/dom/plugins/ipc/PluginTypes.ipdlh
+++ b/dom/plugins/ipc/PluginTypes.ipdlh
@@ -11,17 +11,16 @@ namespace plugins {
 struct PluginTag
 {
   uint32_t id;
   nsCString name;
   nsCString description;
   nsCString[] mimeTypes;
   nsCString[] mimeDescriptions;
   nsCString[] extensions;
-  bool isJavaPlugin;
   bool isFlashPlugin;
   bool supportsAsyncRender; // flash specific
   nsCString filename;
   nsCString version;
   int64_t lastModifiedTime;
   bool isFromExtension;
   int32_t sandboxLevel;
   uint16_t blocklistState;
--- a/dom/plugins/test/mochitest/test_secondPlugin.html
+++ b/dom/plugins/test/mochitest/test_secondPlugin.html
@@ -9,17 +9,17 @@
 
   <body onload="run()">
     <script class="testbody" type="application/javascript">
       "use strict";
 
       SimpleTest.waitForExplicitFinish();
       setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
       setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_DISABLED, "Second Test Plug-in");
-      setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Java Test Plug-in");
+      setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Shockwave Flash");
 
       function findPlugin(pluginName) {
           for (var i = 0; i < navigator.plugins.length; i++) {
             var plugin = navigator.plugins[i];
             if (plugin.name === pluginName) {
               return plugin;
             }
           }
@@ -43,31 +43,31 @@
         pluginElement = document.getElementById("disabledPlugin");
         is(typeof pluginElement.identifierToStringTest, "undefined", "Should NOT be able to call a function on a disabled plugin");
 
         pluginElement = document.getElementById("clickToPlayPlugin");
         is(typeof pluginElement.identifierToStringTest, "undefined", "Should NOT be able to call a function on a click-to-play plugin");
 
         ok(navigator.plugins["Test Plug-in"], "Should have queried a plugin named 'Test Plug-in'");
         ok(!navigator.plugins["Second Test Plug-in"], "Should NOT have queried a disabled plugin named 'Second Test Plug-in'");
-        ok(navigator.plugins["Java Test Plug-in"], "Should have queried a click-to-play plugin named 'Java Test Plug-in'");
+        ok(navigator.plugins["Shockwave Flash"], "Should have queried a click-to-play plugin named 'Shockwave Flash'");
 
         ok(findPlugin("Test Plug-in"), "Should have found a plugin named 'Test Plug-in'");
         ok(!findPlugin("Second Test Plug-in"), "Should NOT found a disabled plugin named 'Second Test Plug-in'");
-        ok(findPlugin("Java Test Plug-in"), "Should have found a click-to-play plugin named 'Java Test Plug-in'");
+        ok(findPlugin("Shockwave Flash"), "Should have found a click-to-play plugin named 'Shockwave Flash'");
 
         ok(navigator.mimeTypes["application/x-test"], "Should have queried a MIME type named 'application/x-test'");
         ok(!navigator.mimeTypes["application/x-second-test"], "Should NOT have queried a disabled type named 'application/x-second-test'");
-        ok(navigator.mimeTypes["application/x-java-test"], "Should have queried a click-to-play MIME type named 'application/x-java-test'");
+        ok(navigator.mimeTypes["application/x-shockwave-flash-test"], "Should have queried a click-to-play MIME type named 'application/x-shockwave-flash-test'");
 
         ok(findMimeType("application/x-test"), "Should have found a MIME type named 'application/x-test'");
         ok(!findMimeType("application/x-second-test"), "Should NOT have found a disabled MIME type named 'application/x-second-test'");
-        ok(findMimeType("application/x-java-test"), "Should have found a click-to-play MIME type named 'application/x-java-test'");
+        ok(findMimeType("application/x-shockwave-flash-test"), "Should have found a click-to-play MIME type named 'application/x-shockwave-flash-test'");
 
         SimpleTest.finish();
       }
     </script>
 
     <object id="plugin" type="application/x-test" width=200 height=200></object>
     <object id="disabledPlugin" type="application/x-second-test" width=200 height=200></object>
-    <object id="clickToPlayPlugin" type="application/x-java-test" width=200 height=200></object>
+    <object id="clickToPlayPlugin" type="application/x-shockwave-flash-test" width=200 height=200></object>
   </body>
 </html>
deleted file mode 100644
--- a/dom/plugins/test/testplugin/javaplugin/Info.plist
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>libnptestjava.dylib</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.mozilla.JavaTestPlugin</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundlePackageType</key>
-	<string>BRPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.0.0.0</string>
-	<key>CFBundleSignature</key>
-	<string>JAVATEST</string>
-	<key>CFBundleVersion</key>
-	<string>1.0.0.0</string>
-	<key>WebPluginName</key>
-	<string>Java Test Plug-in</string>
-	<key>WebPluginDescription</key>
-	<string>Dummy Java plug-in for testing purposes.</string>
-	<key>WebPluginMIMETypes</key>
-	<dict>
-		<key>application/x-java-test</key>
-		<dict>
-			<key>WebPluginExtensions</key>
-			<array>
-				<string>tstjava</string>
-			</array>
-			<key>WebPluginTypeDescription</key>
-			<string>Dummy java type</string>
-		</dict>
-	</dict>
-</dict>
-</plist>
deleted file mode 100644
--- a/dom/plugins/test/testplugin/javaplugin/moz.build
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-SharedLibrary('nptestjava')
-
-relative_path = 'javaplugin'
-cocoa_name = 'JavaTest'
-include('../testplugin.mozbuild')
deleted file mode 100644
--- a/dom/plugins/test/testplugin/javaplugin/nptest.def
+++ /dev/null
@@ -1,7 +0,0 @@
-LIBRARY   NPJAVATEST
-
-EXPORTS
-  NP_GetEntryPoints     @1
-  NP_Initialize         @2
-  NP_Shutdown           @3
-  NP_GetMIMEDescription @4
deleted file mode 100644
--- a/dom/plugins/test/testplugin/javaplugin/nptest.rc
+++ /dev/null
@@ -1,42 +0,0 @@
-#include<winver.h>
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION    1,0,0,0
- PRODUCTVERSION 1,0,0,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "040904e4"
-        BEGIN
-            VALUE "CompanyName", "mozilla.org"
-            VALUE "FileDescription", L"Dummy Java plug-in for testing purposes."
-            VALUE "FileExtents", "tstjava"
-            VALUE "FileOpenName", "Dummy java test type"
-            VALUE "FileVersion", "1.0"
-            VALUE "InternalName", "nptestjava"
-            VALUE "MIMEType", "application/x-java-test"
-            VALUE "OriginalFilename", "nptestjava.dll"
-            VALUE "ProductName", "Java Test Plug-in"
-            VALUE "ProductVersion", "1.0"
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 1252
-    END
-END
deleted file mode 100644
--- a/dom/plugins/test/testplugin/javaplugin/nptest_name.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const char *sPluginName = "Java Test Plug-in";
-const char *sPluginDescription = "Dummy Java plug-in for testing purposes.";
-const char *sMimeDescription = "application/x-java-test:tstjava:Dummy java type";
--- a/dom/plugins/test/testplugin/moz.build
+++ b/dom/plugins/test/testplugin/moz.build
@@ -1,13 +1,13 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-DIRS += ['secondplugin', 'javaplugin', 'thirdplugin', 'flashplugin']
+DIRS += ['secondplugin', 'thirdplugin', 'flashplugin']
 
 SharedLibrary('nptest')
 
 relative_path = '.'
 cocoa_name = 'Test'
 include('testplugin.mozbuild')