Backed out changeset f2cade11e3c0 (bug 926830) for mochitest memory leak on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 21 Feb 2014 14:32:28 +0100
changeset 170241 203b1197d4137f02abc72c126962550ebd486dbb
parent 170240 0eb667c32670eb6066ab22bcee41cf77dc2e6a35
child 170242 b994e8b4c3690b443f6c4dd11eb109e443c1c91c
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs926830
milestone30.0a1
backs outf2cade11e3c086de118a03b99fb8445d41b9c201
Backed out changeset f2cade11e3c0 (bug 926830) for mochitest memory leak on a CLOSED TREE
widget/tests/chrome.ini
widget/tests/mochitest.ini
widget/tests/test_plugin_input_event.html
widget/tests/test_plugin_scroll_consistency.html
widget/tests/test_plugin_scroll_invalidation.html
widget/tests/utils.js
--- a/widget/tests/chrome.ini
+++ b/widget/tests/chrome.ini
@@ -1,12 +1,10 @@
 [DEFAULT]
-support-files =
-  empty_window.xul
-  utils.js
+support-files = empty_window.xul
 
 [test_bug343416.xul]
 [test_bug429954.xul]
 support-files = window_bug429954.xul
 [test_bug444800.xul]
 [test_bug478536.xul]
 skip-if = true # Bug 561929
 support-files = window_bug478536.xul
--- a/widget/tests/mochitest.ini
+++ b/widget/tests/mochitest.ini
@@ -1,11 +1,8 @@
-[DEFAULT]
-support-files = utils.js
-
 [test_assign_event_data.html]
 skip-if = toolkit == "cocoa" # Bug 933303
 [test_bug565392.html]
 skip-if = toolkit != "windows"
 [test_picker_no_crash.html]
 skip-if = toolkit != "windows"
 support-files = window_picker_no_crash_child.html
 [test_plugin_scroll_invalidation.html]
--- a/widget/tests/test_plugin_input_event.html
+++ b/widget/tests/test_plugin_input_event.html
@@ -3,23 +3,29 @@
 <head>
   <title>Test for plugin input event</title>
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"></script>
-  <script type="text/javascript" src="utils.js"></script>
   <link rel="stylesheet" type="text/css"
           href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
 <script type="application/javascript">
-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;;
+  }
+}
 </script>
 
 <p id="display">
   <embed id="plugin" type="application/x-test" wmode="opaque">
 </p>
 <div id="content" style="display: none">
 
 </div>
--- a/widget/tests/test_plugin_scroll_consistency.html
+++ b/widget/tests/test_plugin_scroll_consistency.html
@@ -1,20 +1,26 @@
 <html>
 <head>
   <title>Test for plugin child widgets not being messed up by scrolling</title>
   <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="utils.js"></script>
   <link rel="stylesheet" type="text/css"
           href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body onload="setTimeout(runTests, 0)">
 <script type="application/javascript">
-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;;
+  }
+}
 </script>
 
 <p id="display">
   <div style="overflow:hidden; height:100px;" id="scroll">
     <embed type="application/x-test" wmode="window" width="100" height="800" id="plugin"></object>
     <div style="height:1000px;"></div>
   </div>
 </p>
--- a/widget/tests/test_plugin_scroll_invalidation.html
+++ b/widget/tests/test_plugin_scroll_invalidation.html
@@ -1,19 +1,25 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for plugin child widgets not being invalidated by scrolling</title>
   <script type="text/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" />
 </head>
 <body onload="initialize()">
 <script type="application/javascript">
-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;;
+  }
+}
 </script>
 
 <p id="display">
   <iframe id="i" src="plugin_scroll_invalidation.html"
    width="50" height="50" scrolling="no"></iframe>
 </p>
 <div id="content" style="display: none">
 
deleted file mode 100644
--- a/widget/tests/utils.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 it's 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;
-  });
-}