Backed out 7 changesets (bug 406541, bug 738396, bug 852315, bug 971273, bug 971279) for various java/plugin-related failures on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 20 Feb 2014 16:19:30 -0800
changeset 170141 128cbf1edc402482d096b0acc820549b0a7ebe68
parent 170140 d3b246449a75f182807b6b45aecdf11902f01fcc
child 170142 063362390b6e4010d6a418edd6925ffe588d5f5f
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs406541, 738396, 852315, 971273, 971279
milestone30.0a1
backs out13cc8a7ee9257a27dae141b2dab83d1f295027ae
23dfc36f99d43a293666dc73422e6722e165f18d
fb56bd7c0febde91ca0923a73390600209ac470e
b24d1437c6f367c71d3295bb8242dc5194b71643
5028e1290b4504dbaa9529166fcb3ab4142ec9dd
34ecdab0cfc2ed48060bca6eb0c6ef21d8ed1460
95b4aa01923daf54fa381789622171e6f72ffc53
Backed out 7 changesets (bug 406541, bug 738396, bug 852315, bug 971273, bug 971279) for various java/plugin-related failures on a CLOSED TREE Backed out changeset 13cc8a7ee925 (bug 852315) Backed out changeset 23dfc36f99d4 (bug 852315) Backed out changeset fb56bd7c0feb (bug 406541) Backed out changeset b24d1437c6f3 (bug 738396) Backed out changeset 5028e1290b45 (bug 971279) Backed out changeset 34ecdab0cfc2 (bug 971279) Backed out changeset 95b4aa01923d (bug 971273)
browser/base/content/browser-plugins.js
content/base/src/nsObjectLoadingContent.cpp
content/html/content/src/HTMLSharedObjectElement.h
dom/base/Navigator.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/test/mochitest/file_bug738396.html
dom/plugins/test/mochitest/mochitest.ini
dom/plugins/test/mochitest/test_bug406541.html
dom/plugins/test/mochitest/test_bug738396.html
dom/plugins/test/mochitest/test_bug852315.html
dom/plugins/test/testplugin/javaplugin/Info.plist
dom/plugins/test/testplugin/javaplugin/Makefile.in
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
dom/plugins/test/testplugin/nptest.cpp
dom/plugins/test/testplugin/nptest.h
mobile/android/chrome/content/PluginHelper.js
modules/libpref/src/init/all.js
testing/mochitest/Makefile.in
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -27,19 +27,24 @@ var gPluginHandler = {
 
     let tagMimetype;
     let pluginName = gNavigatorBundle.getString("pluginInfo.unknownPlugin");
     let pluginTag = null;
     let permissionString = null;
     let fallbackType = null;
     let blocklistState = null;
 
-    tagMimetype = pluginElement.actualType;
-    if (tagMimetype == "") {
-      tagMimetype = pluginElement.type;
+    if (pluginElement instanceof HTMLAppletElement) {
+      tagMimetype = "application/x-java-vm";
+    } else {
+      tagMimetype = pluginElement.actualType;
+
+      if (tagMimetype == "") {
+        tagMimetype = pluginElement.type;
+      }
     }
 
     if (gPluginHandler.isKnownPlugin(pluginElement)) {
       pluginTag = pluginHost.getPluginTagForType(pluginElement.actualType);
       pluginName = gPluginHandler.makeNicePluginName(pluginTag.name);
 
       permissionString = pluginHost.getPermissionStringForType(pluginElement.actualType);
       fallbackType = pluginElement.defaultFallbackType;
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -87,18 +87,16 @@
 // Thanks so much, Microsoft! :(
 #ifdef CreateEvent
 #undef CreateEvent
 #endif
 #endif // XP_WIN
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
-static const char *kPrefJavaMIME = "plugin.java.mime";
-
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetObjectLog()
 {
   static PRLogModuleInfo *sLog;
@@ -899,18 +897,16 @@ nsObjectLoadingContent::InstantiatePlugi
   NS_DispatchToCurrentThread(ev);
 
   return NS_OK;
 }
 
 void
 nsObjectLoadingContent::NotifyOwnerDocumentActivityChanged()
 {
-  // XXX(johns): We cannot touch plugins or run arbitrary script from this call,
-  //             as nsDocument is in a non-reentrant state.
 
   // If we have a plugin we want to queue an event to stop it unless we are
   // moved into an active document before returning to the event loop.
   if (mInstanceOwner)
     QueueCheckPluginStopEvent();
 }
 
 // nsIRequestObserver
@@ -1409,22 +1405,18 @@ nsObjectLoadingContent::UpdateObjectPara
   // already opened a channel or tried to instantiate content, whereas channel
   // parameter changes require re-opening the channel even if we haven't gotten
   // that far.
   nsObjectLoadingContent::ParameterUpdateFlags retval = eParamNoChange;
 
   ///
   /// Initial MIME Type
   ///
-
   if (aJavaURI || thisContent->NodeInfo()->Equals(nsGkAtoms::applet)) {
-    nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
-    newMime = javaMIME;
-    NS_ASSERTION(nsPluginHost::IsJavaMIMEType(newMime.get()),
-                 "plugin.mime.java should be recognized by IsJavaMIMEType");
+    newMime.AssignLiteral("application/x-java-vm");
     isJava = true;
   } else {
     nsAutoString rawTypeAttr;
     thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
     if (!rawTypeAttr.IsEmpty()) {
       typeAttr = rawTypeAttr;
       CopyUTF16toUTF8(rawTypeAttr, newMime);
       isJava = nsPluginHost::IsJavaMIMEType(newMime.get());
@@ -1435,22 +1427,19 @@ nsObjectLoadingContent::UpdateObjectPara
   /// classID
   ///
 
   if (caps & eSupportClassID) {
     nsAutoString classIDAttr;
     thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
     if (!classIDAttr.IsEmpty()) {
       // Our classid support is limited to 'java:' ids
-      nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
-      NS_ASSERTION(nsPluginHost::IsJavaMIMEType(newMime.get()),
-                   "plugin.mime.java should be recognized by IsJavaMIMEType");
       if (StringBeginsWith(classIDAttr, NS_LITERAL_STRING("java:")) &&
-          PluginExistsForType(javaMIME)) {
-        newMime = javaMIME;
+          PluginExistsForType("application/x-java-vm")) {
+        newMime.Assign("application/x-java-vm");
         isJava = true;
       } else {
         // XXX(johns): Our de-facto behavior since forever was to refuse to load
         // Objects who don't have a classid we support, regardless of other type
         // or uri info leads to a valid plugin.
         newMime.Truncate();
         stateInvalid = true;
       }
--- a/content/html/content/src/HTMLSharedObjectElement.h
+++ b/content/html/content/src/HTMLSharedObjectElement.h
@@ -189,16 +189,29 @@ public:
   }
 
 private:
   /**
    * Calls LoadObject with the correct arguments to start the plugin load.
    */
   NS_HIDDEN_(void) StartObjectLoad(bool aNotify);
 
+  void GetTypeAttrValue(nsCString &aValue) const
+  {
+    if (mNodeInfo->Equals(nsGkAtoms::applet)) {
+      aValue.AppendLiteral("application/x-java-vm");
+    }
+    else {
+      nsAutoString type;
+      GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
+
+      CopyUTF16toUTF8(type, aValue);
+    }
+  }
+
   nsIAtom *URIAttrName() const
   {
     return mNodeInfo->Equals(nsGkAtoms::applet) ?
            nsGkAtoms::code :
            nsGkAtoms::src;
   }
 
   // mIsDoneAddingChildren is only really used for <applet>.  This boolean is
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -571,32 +571,30 @@ Navigator::GetDoNotTrack(nsAString &aRes
 
   return NS_OK;
 }
 
 bool
 Navigator::JavaEnabled(ErrorResult& aRv)
 {
   Telemetry::AutoTimer<Telemetry::CHECK_JAVA_ENABLED> telemetryTimer;
-
-  // Return true if we have a handler for the java mime
-  nsAdoptingString javaMIME = Preferences::GetString("plugin.java.mime");
-  NS_ENSURE_TRUE(!javaMIME.IsEmpty(), false);
-
+  // Return true if we have a handler for "application/x-java-vm",
+  // otherwise return false.
   if (!mMimeTypes) {
     if (!mWindow) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return false;
     }
     mMimeTypes = new nsMimeTypeArray(mWindow);
   }
 
   RefreshMIMEArray();
 
-  nsMimeType *mimeType = mMimeTypes->NamedItem(javaMIME);
+  nsMimeType *mimeType =
+    mMimeTypes->NamedItem(NS_LITERAL_STRING("application/x-java-vm"));
 
   return mimeType && mimeType->GetEnabledPlugin();
 }
 
 void
 Navigator::RefreshMIMEArray()
 {
   if (mMimeTypes) {
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -119,17 +119,16 @@ using mozilla::TimeStamp;
   }
 
 // 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 *kPrefDisableFullPage = "plugin.disable_full_page_plugin_for_types";
-static const char *kPrefJavaMIME = "plugin.java.mime";
 
 // Version of cached plugin info
 // 0.01 first implementation
 // 0.02 added caching of CanUnload to fix bug 105935
 // 0.03 changed name, description and mime desc from string to bytes, bug 108246
 // 0.04 added new mime entry point on Mac, bug 113464
 // 0.05 added new entry point check for the default plugin, bug 132430
 // 0.06 strip off suffixes in mime description strings, bug 53895
@@ -1551,33 +1550,23 @@ nsPluginHost::SiteHasData(nsIPluginTag* 
   NS_ENSURE_SUCCESS(rv, rv);
 
   *result = !matches.IsEmpty();
   return NS_OK;
 }
 
 bool nsPluginHost::IsJavaMIMEType(const char* aType)
 {
-  // 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);
   return aType &&
-    (javaMIME.LowerCaseEqualsASCII(aType) ||
-     (0 == PL_strncasecmp(aType, "application/x-java-vm",
+    ((0 == PL_strncasecmp(aType, "application/x-java-vm",
                           sizeof("application/x-java-vm") - 1)) ||
      (0 == PL_strncasecmp(aType, "application/x-java-applet",
                           sizeof("application/x-java-applet") - 1)) ||
      (0 == PL_strncasecmp(aType, "application/x-java-bean",
-                          sizeof("application/x-java-bean") - 1))
-#ifdef DEBUG
-     // Emulate java handling for the npjavatest plugin
-     || (0 == PL_strncasecmp(aType, "application/x-java-test",
-                             sizeof("application/x-java-test") - 1))
-#endif
-     );
+                          sizeof("application/x-java-bean") - 1)));
 }
 
 // Check whether or not a tag is a live, valid tag, and that it's loaded.
 bool
 nsPluginHost::IsLiveTag(nsIPluginTag* aPluginTag)
 {
   nsPluginTag* tag;
   for (tag = mPlugins; tag; tag = tag->mNext) {
deleted file mode 100644
--- a/dom/plugins/test/mochitest/file_bug738396.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <title>Helper for test_bug738396.html</title>
-  <meta charset="utf-8">
-</head>
-<body>
-  <!-- Test that the plugin sees "good" in each of these cases -->
-  <div id="codebasevis">
-    <applet codebase="good" codebase="bad" ></applet>
-
-    <applet codebase="bad">
-      <param name="codebase" value="good">
-    </applet>
-
-    <applet codebase="bad">
-      <param name="codebase" value="stillbad">
-      <param name="codebase" value="good">
-    </applet>
-
-    <applet>
-      <param name="codebase" value="good">
-    </applet>
-
-    <object type="application/x-java-test" codebase="good" codebase="bad"></object>
-
-    <object type="application/x-java-test" codebase="bad">
-      <param name="codebase" value="good">
-    </object>
-
-    <object type="application/x-java-test" codebase="bad">
-      <param name="codebase" value="stillbad">
-      <param name="codebase" value="good">
-    </object>
-
-    <object type="application/x-java-test">
-      <param name="codebase" value="good">
-    </object>
-
-    <embed type="application/x-java-test" codebase="good" codebase="bad">
-  </div>
-  <div id="blockedcodebase">
-    <!-- Test that none of these are allowed to load -->
-    <applet codebase="file:///" codebase="notused"></applet>
-
-    <applet codebase="notused">
-      <param name="codebase" value="file:///">
-    </applet>
-
-    <applet codebase="notused">
-      <param name="codebase" value="notused">
-      <param name="codebase" value="file:///">
-    </applet>
-
-    <applet>
-      <param name="codebase" value="file:///">
-    </applet>
-
-    <object type="application/x-java-test" codebase="file:///" codebase="notused"></object>
-
-    <object type="application/x-java-test" codebase="notused">
-      <param name="codebase" value="file:///">
-    </object>
-
-    <object type="application/x-java-test" codebase="notused">
-      <param name="codebase" value="notused">
-      <param name="codebase" value="file:///">
-    </object>
-
-    <object type="application/x-java-test">
-      <param name="codebase" value="file:///">
-    </object>
-
-    <embed type="application/x-java-test" codebase="file:///" codebase="notused">
-  </div>
-  <div id="nocodebase">
-    <applet></applet>
-    <object type="application/x-java-test"></object>
-    <embed type="application/x-java-test">
-  </div>
-  <div id="emptycodebase">
-    <applet codebase=""></applet>
-    <object type="application/x-java-test" codebase=""></object>
-    <embed type="application/x-java-test" codebase="">
-  </div>
-</body>
-</html>
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -1,13 +1,12 @@
 [DEFAULT]
 support-files =
   307-xo-redirect.sjs
   crashing_subpage.html
-  file_bug738396.html
   file_bug771202.html
   file_bug863792.html
   large-pic.jpg
   loremipsum.txt
   loremipsum.xtest
   loremipsum.xtest^headers^
   loremipsum_file.txt
   loremipsum_nocache.txt
@@ -19,26 +18,23 @@ support-files =
   plugin_window.html
   pluginstream.js
   post.sjs
   utils.js
 
 [test_GCrace.html]
 [test_NPNVdocumentOrigin.html]
 [test_NPPVpluginWantsAllNetworkStreams.html]
-[test_bug406541.html]
 [test_bug532208.html]
 [test_bug539565-1.html]
 [test_bug539565-2.html]
-[test_bug738396.html]
 [test_bug771202.html]
 [test_bug777098.html]
 [test_bug784131.html]
 [test_bug813906.html]
-[test_bug852315.html]
 [test_bug854082.html]
 [test_bug863792.html]
 [test_bug967694.html]
 [test_cocoa_focus.html]
 skip-if = toolkit != "cocoa"
 support-files = cocoa_focus.html
 [test_cocoa_window_focus.html]
 skip-if = toolkit != "cocoa"
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_bug406541.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<!doctype html>
-<html>
-<head>
-  <title>Test for Bug 406541</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="utils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-  <meta http-equiv="content-type" content="text/html; charset=utf-8">
-</head>
-<body>
-<script type="application/x-child-payload" id="child-payload">
-  // This is injected into the file:/// origin iframe, see below.
-
-  // appletA should spawn, appletB, with a codebase outside the temp directory,
-  // should not.
-  var appletA = document.createElement("applet");
-  var appletB = document.createElement("applet");
-  var appletC = document.createElement("applet");
-  appletA.type = appletB.type = appletC.type = "application/x-java-test";
-  appletB.setAttribute("codebase", "file:///");
-  appletC.setAttribute("codebase", "./subdir_bug406541/");
-  document.body.appendChild(appletA);
-  document.body.appendChild(appletB);
-  document.body.appendChild(appletC);
-  function isSpawned(plugin) {
-    try {
-      var x = plugin.getJavaCodebase();
-      return true;
-    } catch (e) {}
-    return false;
-  }
-  window.parent.postMessage({ "A": isSpawned(appletA),
-                              "B": isSpawned(appletB),
-                              "C": isSpawned(appletC) }, "*");
-</script>
-<script type="application/javascript">
-  SimpleTest.waitForExplicitFinish();
-  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED,
-                            "Java Test Plug-in");
-  SpecialPowers.pushPrefEnv({ "set": [
-                              ['plugin.java.mime', 'application/x-java-test']
-                            ] }, runTest);
-
-  function runTest() {
-    // Create a empty file and point an iframe at it
-    var Cc = SpecialPowers.Cc;
-    var Ci = SpecialPowers.Ci;
-    var file = Cc["@mozilla.org/file/directory_service;1"]
-      .getService(Ci.nsIProperties)
-      .get("TmpD", Ci.nsIFile);
-    var subdir = Cc["@mozilla.org/file/directory_service;1"]
-      .getService(Ci.nsIProperties)
-      .get("TmpD", Ci.nsIFile);
-    file.append("test_bug406541.html");
-    file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
-    subdir.append("subdir_bug406541");
-    subdir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0600);
-
-    var i = document.createElement("iframe");
-    var loaded = false;
-    i.addEventListener("load", function initialLoad() {
-      if (!loaded) {
-        // Once loaded, use special powers to point it at the file
-        SpecialPowers.wrap(i.contentWindow).location.href = "file://" + file.path;
-        loaded = true;
-      } else {
-        // Inject the child-payload script to the file:/// origin. Let it test
-        // applet spawning and send the results in a postMessage. (Because I
-        // couldn't get SpecialPowers to let me touch applets cross-origin, then
-        // gave up.)
-        var innerdoc = SpecialPowers.wrap(i.contentWindow).document;
-        var s = innerdoc.createElement("script");
-        s.type = "text/javascript";
-        s.textContent = document.getElementById("child-payload").textContent;
-        var finished = false;
-        window.onmessage = function(message) {
-          ok(message.data.A, "Plugin A should spawn");
-          ok(!message.data.B, "Plugin B should NOT spawn");
-          ok(message.data.C, "Plugin C should spawn");
-          file.remove(false);
-          subdir.remove(false);
-          finished = true;
-          SimpleTest.finish();
-        };
-        innerdoc.body.appendChild(s);
-
-        SimpleTest.executeSoon(function() {
-          if (!finished) {
-            ok(finished, "Should have received callback by now");
-            SimpleTest.finish();
-          }
-        });
-      }
-    }, false);
-    document.body.appendChild(i);
-  }
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_bug738396.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!doctype html>
-<html>
-<head>
-  <title>Test for Bug 738396</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="utils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-  <meta http-equiv="content-type" content="text/html; charset=utf-8">
-</head>
-<body>
-  <script type="text/javascript">
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED,
-                              "Java Test Plug-in");
-
-    SpecialPowers.pushPrefEnv({ "set": [
-                                ['plugin.java.mime', 'application/x-java-test']
-                              ] }, loadFrame);
-    SimpleTest.waitForExplicitFinish();
-
-    function loadFrame() {
-      var iframe = document.createElement("iframe");
-      iframe.src = "./file_bug738396.html";
-      iframe.addEventListener("load", function() {
-        runTest(iframe.contentDocument);
-      });
-      document.body.appendChild(iframe);
-    }
-
-    function runTest(doc) {
-      // Check that the canonicalized version of the codebase 'good' was passed
-      // to the plugin in all cases
-      var a = doc.createElement('a');
-      a.href = "good";
-      var goodCodebase = a.href;
-      var codebasevis = doc.getElementById("codebasevis")
-        .querySelectorAll("applet, object, embed");
-      for (var elem of codebasevis) {
-        var codebase = null;
-        try {
-          codebase = elem.getJavaCodebase();
-        } catch (e) {}
-        is(codebase, goodCodebase,
-           "Check that the test plugin sees the proper codebase");
-      }
-      // Check that none of the applets in blockedcodebase were allowed to spawn
-      var blockedcodebase = doc.getElementById("blockedcodebase")
-        .querySelectorAll("applet, object, embed");
-      for (var elem of blockedcodebase) {
-        var spawned = false;
-        try {
-          elem.getObjectValue();
-          spawned = true;
-        } catch (e) {}
-        ok(!spawned, "Plugin should not be allowed to spawn");
-      }
-
-      // With no codebase, the codebase should resolve to "."
-      a.href = ".";
-      goodCodebase = a.href;
-      var nocodebase = doc.getElementById("nocodebase")
-        .querySelectorAll("applet, object, embed");
-      for (var elem of nocodebase) {
-        var codebase = null;
-        try {
-          codebase = elem.getJavaCodebase();
-        } catch (e) {}
-        is(codebase, goodCodebase, "Codebase should resolve to '.'");
-      }
-
-      // With empty codebase, the codebase should resolve to "/"
-      a.href = "/";
-      goodCodebase = a.href;
-      var nocodebase = doc.getElementById("emptycodebase")
-        .querySelectorAll("applet, object, embed");
-      for (var elem of nocodebase) {
-        var codebase = null;
-        try {
-          codebase = elem.getJavaCodebase();
-        } catch (e) {}
-        is(codebase, goodCodebase, "Codebase should resolve to '/'");
-      }
-
-      SimpleTest.finish();
-    }
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_bug852315.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!doctype html>
-<html>
-<head>
-  <title>Test for Bug 852315</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="utils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-  <meta http-equiv="content-type" content="text/html; charset=utf-8">
-  <base href="chrome://browser/content/">
-</head>
-<body>
-<script type="application/javascript">
-
-SimpleTest.waitForExplicitFinish();
-setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-
-// Tests that the document-inactive notification stopping plugins does not
-// fatally re-enter when adding other plugins to the document.
-
-var i = document.createElement("iframe");
-var ob = document.body;
-i.addEventListener("load", function loadfunc() {
-  var d = i.contentWindow.document;
-  var e = i.contentDocument.createElement("embed");
-  var destroyran = false;
-  e.type = "application/x-test";
-  i.contentDocument.body.appendChild(e);
-
-  // On despawn, append an embed tag to document.
-  e.callOnDestroy(function() {
-    var e2 = d.createElement("embed");
-    d.body.appendChild(e2);
-    destroyran = true;
-  });
-
-  // Navigate the frame to cause the document with the plugin to go inactive
-  i.removeEventListener("load", loadfunc);
-  i.src = "about:blank";
-  SimpleTest.executeSoon(function() {
-    ok(destroyran, "OnDestroy callback ran and did not crash");
-    SimpleTest.finish();
-  });
-});
-document.body.appendChild(i);
-
-</script>
-</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/Makefile.in
+++ /dev/null
@@ -1,8 +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/.
-
-RELATIVE_PATH=..
-COCOA_NAME=JavaTest
-include @srcdir@/../testplugin.mk
deleted file mode 100644
--- a/dom/plugins/test/testplugin/javaplugin/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; 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/.
-
-LIBRARY_NAME = 'nptestjava'
-
-relative_path = '..'
-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,14 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; 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']
+DIRS += ['secondplugin']
 
 LIBRARY_NAME = 'nptest'
 
 FAIL_ON_WARNINGS = not CONFIG['_MSC_VER']
 
 relative_path = '.'
 include('testplugin.mozbuild')
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -47,17 +47,16 @@
 #include <list>
 #include <ctime>
 
 #ifdef XP_WIN
 #include <process.h>
 #include <float.h>
 #include <windows.h>
 #define getpid _getpid
-#define strcasecmp _stricmp
 #else
 #include <unistd.h>
 #include <pthread.h>
 #endif
 
 #include "mozilla/NullPtr.h"
 
 using namespace std;
@@ -135,17 +134,16 @@ static bool setColor(NPObject* npobj, co
 static bool throwExceptionNextInvoke(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool convertPointX(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool setPluginWantsAllStreams(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool crashOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
-static bool getJavaCodebase(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool checkObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool enableFPExceptions(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool setCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool asyncCallbackTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool checkGCRace(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
 static bool hangPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
@@ -199,17 +197,16 @@ static const NPUTF8* sPluginMethodIdenti
   "throwExceptionNextInvoke",
   "convertPointX",
   "convertPointY",
   "streamTest",
   "setPluginWantsAllStreams",
   "crash",
   "crashOnDestroy",
   "getObjectValue",
-  "getJavaCodebase",
   "checkObjectValue",
   "enableFPExceptions",
   "setCookie",
   "getCookie",
   "getAuthInfo",
   "asyncCallbackTest",
   "checkGCRace",
   "hang",
@@ -264,17 +261,16 @@ static const ScriptableFunction sPluginM
   throwExceptionNextInvoke,
   convertPointX,
   convertPointY,
   streamTest,
   setPluginWantsAllStreams,
   crashPlugin,
   crashOnDestroy,
   getObjectValue,
-  getJavaCodebase,
   checkObjectValue,
   enableFPExceptions,
   setCookie,
   getCookie,
   getAuthInfo,
   asyncCallbackTest,
   checkGCRace,
   hangPlugin,
@@ -958,21 +954,16 @@ NPP_New(NPMIMEType pluginType, NPP insta
       instanceData->cleanupWidget = false;
     }
     if (!strcmp(argn[i], "closestream")) {
       instanceData->closeStream = true;
     }
     if (strcmp(argn[i], "bugmode") == 0) {
       instanceData->bugMode = atoi(argv[i]);
     }
-    // Try to emulate java's codebase handling: Use the last seen codebase
-    // value, regardless of whether it is in attributes or params.
-    if (strcasecmp(argn[i], "codebase") == 0) {
-      instanceData->javaCodebase = argv[i];
-    }
   }
 
   if (!browserSupportsWindowless || !pluginSupportsWindowlessMode()) {
     requestWindow = true;
   } else if (!pluginSupportsWindowMode()) {
     requestWindow = false;
   }
   if (requestWindow) {
@@ -2893,28 +2884,16 @@ void notifyDidPaint(InstanceData* instan
   }
 }
 
 static const NPClass kTestSharedNPClass = {
   NP_CLASS_STRUCT_VERSION,
   // Everything else is nullptr
 };
 
-static bool getJavaCodebase(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
-  if (argCount != 0) {
-    return false;
-  }
-
-  NPP npp = static_cast<TestNPObject*>(npobj)->npp;
-  InstanceData* id = static_cast<InstanceData*>(npp->pdata);
-  STRINGZ_TO_NPVARIANT(NPN_StrDup(id->javaCodebase.c_str()), *result);
-  return true;
-}
-
 static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
 
   NPObject* o = NPN_CreateObject(npp,
                                  const_cast<NPClass*>(&kTestSharedNPClass));
   if (!o)
     return false;
--- a/dom/plugins/test/testplugin/nptest.h
+++ b/dom/plugins/test/testplugin/nptest.h
@@ -147,14 +147,13 @@ typedef struct InstanceData {
   bool closeStream;
   std::string lastKeyText;
   bool wantsAllStreams;
   AsyncDrawing asyncDrawing;
   NPAsyncSurface *frontBuffer;
   NPAsyncSurface *backBuffer;
   int32_t mouseUpEventCount;
   int32_t bugMode;
-  std::string javaCodebase;
 } InstanceData;
 
 void notifyDidPaint(InstanceData* instanceData);
 
 #endif // nptest_h_
--- a/mobile/android/chrome/content/PluginHelper.js
+++ b/mobile/android/chrome/content/PluginHelper.js
@@ -131,20 +131,26 @@ var PluginHelper = {
     //     the bottom causes scrollHeight to be larger than it should be.
     let overflows = (overlay.scrollWidth > pluginRect.width) ||
                     (overlay.scrollHeight - 5 > pluginRect.height);
 
     return overflows;
   },
 
   getPluginMimeType: function (plugin) {
-    var tagMimetype = plugin.actualType;
+    var tagMimetype;
+    if (plugin instanceof HTMLAppletElement) {
+      tagMimetype = "application/x-java-vm";
+    } else {
+      tagMimetype = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent)
+                          .actualType;
 
-    if (tagMimetype == "") {
-      tagMimetype = plugin.type;
+      if (tagMimetype == "") {
+        tagMimetype = plugin.type;
+      }
     }
 
     return tagMimetype;
   },
 
   handlePluginBindingAttached: function (aTab, aEvent) {
     let plugin = aEvent.target;
     let doc = plugin.ownerDocument;
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1897,21 +1897,16 @@ pref("plugins.click_to_play", false);
 // Player ("Shockwave for Director"). To hide all plugins from enumeration, use
 // the empty string "" to match no plugin names. To allow all plugins to be
 // enumerated, use the string "*" to match all plugin names.
 pref("plugins.enumerable_names", "Java,Nexus Personal,QuickTime,Shockwave");
 
 // The default value for nsIPluginTag.enabledState (STATE_ENABLED = 2)
 pref("plugin.default.state", 2);
 
-// The MIME type that should bind to legacy java-specific invocations like
-// <applet> and <object data="java:foo">. Setting this to a non-java MIME type
-// is undefined behavior.
-pref("plugin.java.mime", "application/x-java-vm");
-
 // How long in minutes we will allow a plugin to work after the user has chosen
 // to allow it "now"
 pref("plugin.sessionPermissionNow.intervalInMinutes", 60);
 // How long in days we will allow a plugin to work after the user has chosen
 // to allow it persistently.
 pref("plugin.persistentPermissionAlways.intervalInDays", 90);
 
 #ifndef DEBUG
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -149,23 +149,21 @@ endif
 TEST_HARNESS_COMPONENTS := \
   test_necko.xpt \
   $(NULL)
 
 # We need the test plugin as some tests rely on it
 ifeq (Darwin,$(OS_TARGET))
 TEST_HARNESS_PLUGINS := \
   Test.plugin/ \
-  SecondTest.plugin/ \
-  JavaTest.plugin/
+  SecondTest.plugin/
 else
 TEST_HARNESS_PLUGINS := \
   $(DLL_PREFIX)nptest$(DLL_SUFFIX) \
-  $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX) \
-  $(DLL_PREFIX)nptestjava$(DLL_SUFFIX)
+  $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX)
 endif
 
 # Rules for staging the necessary harness bits for a test package
 PKG_STAGE = $(DIST)/test-package-stage
 DIST_BIN = $(DIST)/bin
 
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@