Bug 537787 - Update websocket test to use SpecialPowers. r=ctalbert try: -b do -p all -u mochitests -t none
authorJosh Matthews <josh@joshmatthews.net>
Tue, 24 May 2011 02:43:05 +0300
changeset 72233 7a747adc8303
parent 72232 4a894d4dc4da
child 72234 016fcb800fc2
push id381
push userjduell@mozilla.com
push dateSun, 03 Jul 2011 00:34:23 +0000
treeherdermozilla-inbound@7a747adc8303 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersctalbert
bugs537787
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 537787 - Update websocket test to use SpecialPowers. r=ctalbert try: -b do -p all -u mochitests -t none
content/base/test/test_websocket.html
content/base/test/test_ws_basic_tests.html
testing/mochitest/specialpowers/content/specialpowers.js
--- a/content/base/test/test_websocket.html
+++ b/content/base/test/test_websocket.html
@@ -124,25 +124,21 @@ function CreateTestWS(ws_location, ws_pr
   }
 
   all_ws.push(ws);
   return ws;
 }
 
 function forcegc()
 {
-  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  Components.utils.forceGC();
-  var wu =  window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                  .getInterface(Components.interfaces.nsIDOMWindowUtils);
-  wu.garbageCollect();
+  SpecialPowers.forceGC();
+  SpecialPowers.gc();
   setTimeout(function()
   {
-    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-    wu.garbageCollect();
+    SpecialPowers.gc();
   }, 1);
 }
 
 function doTest(number)
 {
   if (doTest.timeoutId !== null) {
     clearTimeout(doTest.timeoutId);
     doTest.timeoutId = null;
--- a/content/base/test/test_ws_basic_tests.html
+++ b/content/base/test/test_ws_basic_tests.html
@@ -17,21 +17,18 @@
 <script class="testbody" type="text/javascript">
 
 var ws;
 
 var params = ["protocol", "resource", "origin", "end"];
 var results = ["test", "/tests/content/base/test/file_ws_basic_tests", "http://mochi.test:8888", "end"];
 
 function forcegc(){
-  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-  Components.utils.forceGC();
-  var wu =  window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                  .getInterface(Components.interfaces.nsIDOMWindowUtils);
-  wu.garbageCollect();
+  SpecialPowers.forceGC();
+  SpecialPowers.gc();
 }
 
 function finishWSTest() {
     SimpleTest.finish();
 }
 
 function testWebSocket () {
   var url = "ws://mochi.test:8888/tests/content/base/test/file_ws_basic_tests";
--- a/testing/mochitest/specialpowers/content/specialpowers.js
+++ b/testing/mochitest/specialpowers/content/specialpowers.js
@@ -207,16 +207,20 @@ SpecialPowers.prototype = {
     return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
              .createInstance(Ci.nsIXMLHttpRequest);
   },
 
   gc: function() {
     this.DOMWindowUtils.garbageCollect();
   },
 
+  forceGC: function() {
+    Components.utils.forceGC();
+  },
+
   hasContentProcesses: function() {
     try {
       var rt = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
       return rt.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
     } catch (e) {
       return true;
     }
   },