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 72257 7a747adc8303dea9846ab4a291b0394952c9eb3d
parent 72256 4a894d4dc4da26a41e9ef1d1fea436d10324347d
child 72258 016fcb800fc235e81e9c202b66ba140a1a69df0f
push id20681
push usermak77@bonardo.net
push dateMon, 04 Jul 2011 10:46:25 +0000
treeherdermozilla-central@fb1291a31b54 [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;
     }
   },