Backed out changeset 97c8c8491b17 (bug 926830) for mochitest memory leak on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 21 Feb 2014 14:32:57 +0100
changeset 170244 95e4bcfcd8dcbcef8228fbc824ba7f710ad49958
parent 170243 4bb782896814631e19e8e021080962b5c56d2256
child 170245 4146284b29b8331eaa398d30f3a8dccf4b32495b
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs926830
milestone30.0a1
backs out97c8c8491b1738fc566d9ba559ec3bdd2ee15a12
Backed out changeset 97c8c8491b17 (bug 926830) for mochitest memory leak on a CLOSED TREE
content/base/test/chrome/chrome.ini
content/base/test/chrome/head.js
content/base/test/chrome/test_bug391728.html
content/base/test/head_plain.js
content/base/test/mochitest.ini
content/base/test/test_mixed_content_blocker.html
content/base/test/test_object.html
content/base/test/test_plugin_freezing.html
content/html/content/test/mochitest.ini
content/html/content/test/test_iframe_sandbox_plugins.html
--- a/content/base/test/chrome/chrome.ini
+++ b/content/base/test/chrome/chrome.ini
@@ -6,17 +6,16 @@ support-files =
   cpows_parent.xul
   file_bug391728.html
   file_bug391728_2.html
   file_bug549682.xul
   file_bug616841.xul
   file_bug816340.xul
   fileconstructor_file.png
   frame_bug814638.xul
-  head.js
   host_bug814638.xul
   title_window.xul
 
 [test_bug206691.xul]
 [test_bug339494.xul]
 [test_bug357450.xul]
 [test_bug380418.html]
 [test_bug380418.html^headers^]
deleted file mode 100644
--- a/content/base/test/chrome/head.js
+++ /dev/null
@@ -1,26 +0,0 @@
-function getTestPlugin(aName) {
-  var pluginName = aName || "Test Plug-in";
-  var ph = Components.classes["@mozilla.org/plugin/host;1"]
-             .getService(Components.interfaces.nsIPluginHost);
-  var tags = ph.getPluginTags();
-
-  // Find the test plugin
-  for (var i = 0; i < tags.length; i++) {
-    if (tags[i].name == pluginName)
-      return tags[i];
-  }
-  ok(false, "Unable to find plugin");
-  return null;
-}
-
-// call this to set the test plugin(s) initially expected enabled state.
-// it will automatically be reset to its previous value after the test
-// ends
-function setTestPluginEnabledState(newEnabledState, pluginName) {
-  var plugin = getTestPlugin(pluginName);
-  var oldEnabledState = plugin.enabledState;
-  plugin.enabledState = newEnabledState;
-  SimpleTest.registerCleanupFunction(function() {
-    getTestPlugin(pluginName).enabledState = oldEnabledState;
-  });
-}
--- a/content/base/test/chrome/test_bug391728.html
+++ b/content/base/test/chrome/test_bug391728.html
@@ -2,17 +2,16 @@
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=391728
 -->
 <head>
   <title>Test for Bug 391728</title>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
-  <script type="text/javascript" src="head.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391728">Mozilla Bug 391728</a>
 <p id="display"></p>
 <div id="content">
   <iframe id="testframe" width="150" height="250" src="about:blank"></iframe>
 </div>
@@ -96,16 +95,17 @@ function start_test(plugin) {
   var frame = document.getElementById("testframe");
   frame.addEventListener("load", frame_loaded, true);
   load_frame(test_normal, "file_bug391728");
 }
 
 function finish_test(plugin) {
   Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
   resetBlocklist();
+  plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
   SimpleTest.finish();
 }
 
 function load_frame(nextTest, file) {
   gNextTest = nextTest;
   gDisabled = [];
   gUnknown = [];
   gBlocked = [];
@@ -147,28 +147,28 @@ function test_list(list) {
   }
 }
 
 function test_normal(plugin) {
   is(gUnknown.length, 0, "Should not have been any unknown plugins");
   is(gDisabled.length, 0, "Should not have been any disabled plugins");
   is(gBlocked.length, 0, "Should not have been any blocked plugins");
   test_style("solid");
-  setTestPluginEnabledState(Components.interfaces.nsIPluginTag.STATE_DISABLED);
+  plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_DISABLED;
   load_frame(test_disabled, "file_bug391728");
 }
 
 function test_disabled(plugin) {
   is(gUnknown.length, 0, "Should not have been any unknown plugins");
   is(gDisabled.length, PLUGIN_COUNT, "Should have been disabled plugins");
   test_list(gDisabled);
   is(gBlocked.length, 0, "Should not have been any blocked plugins");
   test_style("dotted");
   ok(plugin.disabled, "Plugin lost its disabled status");
-  setTestPluginEnabledState(Components.interfaces.nsIPluginTag.STATE_ENABLED);
+  plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
 
   setAndUpdateBlocklist(gHttpTestRoot + "blockPluginHard.xml",
     function() {
       load_frame(test_blocked, "file_bug391728");
     });
 }
 
 function test_blocked(plugin) {
@@ -189,14 +189,13 @@ function test_unknown(plugin) {
   test_style("none");
   setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
     ok(!plugin.blocklisted, "Plugin shouldn't remain blocklisted");
     finish_test(plugin);
   });
 }
 
 SimpleTest.waitForExplicitFinish();
-setTestPluginEnabledState(Components.interfaces.nsIPluginTag.STATE_ENABLED);
 window.addEventListener("load", init_test, false);
 </script>
 </pre>
 </body>
 </html>
deleted file mode 100644
--- a/content/base/test/head_plain.js
+++ /dev/null
@@ -1,27 +0,0 @@
-
-function getTestPlugin(pluginName) {
-  var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
-                                 .getService(SpecialPowers.Ci.nsIPluginHost);
-  var tags = ph.getPluginTags();
-  var name = pluginName || "Test Plug-in";
-  for (var tag of tags) {
-    if (tag.name == name) {
-      return tag;
-    }
-  }
-
-  ok(false, "Could not find plugin tag with plugin name '" + name + "'");
-  return null;
-}
-
-// call this to set the test plugin(s) initially expected enabled state.
-// it will automatically be reset to its previous value after the test
-// ends
-function setTestPluginEnabledState(newEnabledState, pluginName) {
-  var plugin = getTestPlugin(pluginName);
-  var oldEnabledState = plugin.enabledState;
-  plugin.enabledState = newEnabledState;
-  SimpleTest.registerCleanupFunction(function() {
-    getTestPlugin(pluginName).enabledState = oldEnabledState;
-  });
-}
--- a/content/base/test/mochitest.ini
+++ b/content/base/test/mochitest.ini
@@ -195,17 +195,16 @@ support-files =
   file_xhtmlserializer_2_basic.xhtml
   file_xhtmlserializer_2_enthtml.xhtml
   file_xhtmlserializer_2_entw3c.xhtml
   file_xhtmlserializer_2_latin1.xhtml
   fileutils.js
   forRemoval.resource
   forRemoval.resource^headers^
   formReset.html
-  head_plain.js
   invalid_accesscontrol.resource
   invalid_accesscontrol.resource^headers^
   mutationobserver_dialog.html
   progressserver.sjs
   responseIdentical.sjs
   script-1_bug597345.sjs
   script-2_bug597345.js
   script_bug602838.sjs
--- a/content/base/test/test_mixed_content_blocker.html
+++ b/content/base/test/test_mixed_content_blocker.html
@@ -3,21 +3,28 @@
 <!--
 Tests for Mixed Content Blocker
 https://bugzilla.mozilla.org/show_bug.cgi?id=62178
 -->
 <head>
   <meta charset="utf-8">
   <title>Tests for Bug 62178</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="head_plain.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 
   <script>
-  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+  var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
+                        .getService(SpecialPowers.Ci.nsIPluginHost);
+  var tags = ph.getPluginTags();
+  for (var tag of tags) {
+    if (tag.name == "Test Plug-in") {
+      tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;;
+    }
+  }
+
 
   var origBlockDisplay = SpecialPowers.getBoolPref("security.mixed_content.block_display_content");
   var origBlockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
 
   var counter = 0;
   var settings = [ [true, true], [true, false], [false, true], [false, false] ];
 
   var blockActive;
--- a/content/base/test/test_object.html
+++ b/content/base/test/test_object.html
@@ -1,23 +1,29 @@
 <!DOCTYPE html>
 <html>
   <head>
     <title>Plugin instantiation</title>
     <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     <script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script>
-    <script type="application/javascript" src="head_plain.js"></script>
     <meta charset="utf-8">
   <body onload="onLoad()">
     <script class="testbody" type="text/javascript;version=1.8">
 
       "use strict";
       SimpleTest.waitForExplicitFinish();
 
-      setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+      var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
+                        .getService(SpecialPowers.Ci.nsIPluginHost);
+      var pluginTags = pluginHost.getPluginTags();
+      for (var tag of pluginTags) {
+        if (tag.name == "Test Plug-in") {
+          tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;;
+        }
+      }
 
       // This can go away once embed also is on WebIDL
       let OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
 
       // Use string modes in this test to make the test easier to read/debug.
       // nsIObjectLoadingContent refers to this as "type", but I am using "mode"
       // in the test to avoid confusing with content-type.
       let prettyModes = {};
--- a/content/base/test/test_plugin_freezing.html
+++ b/content/base/test/test_plugin_freezing.html
@@ -1,23 +1,19 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for plugin freezing and thawing</title>
   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="head_plain.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <div id="content" style="display: none">
 </div>
-<script type="text/javascript">
-setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-</script>
 <embed id='e1' type='application/x-test'></embed>
 <script>
 var e1 = document.getElementById('e1');
 var w;
 
 var testIndex = 0;
 var tests;
 
--- a/content/html/content/test/mochitest.ini
+++ b/content/html/content/test/mochitest.ini
@@ -12,17 +12,16 @@ support-files =
   bug277890_iframe.html
   bug277890_load.html
   bug340800_iframe.txt
   bug372098-link-target.html
   bug392567.jar
   bug392567.jar^headers^
   bug441930_iframe.html
   bug514856_iframe.html
-  enableTestPlugin.js
   file_bug209275_1.html
   file_bug209275_2.html
   file_bug209275_3.html
   file_bug297761.html
   file_bug417760.png
   file_bug893537.html
   file_formSubmission_img.jpg
   file_formSubmission_text.txt
--- a/content/html/content/test/test_iframe_sandbox_plugins.html
+++ b/content/html/content/test/test_iframe_sandbox_plugins.html
@@ -3,17 +3,16 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=341604
 Implement HTML5 sandbox attribute for IFRAMEs
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 341604 - plugins</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="enableTestPlugin.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <script type="application/javascript">
 /** Test for Bug 341604 - Implement HTML5 sandbox attribute for IFRAMEs **/
 /** Plugin tests **/
 SimpleTest.waitForExplicitFinish();
 
 function doTest() {