diff --git a/content/base/test/test_websocket.html b/content/base/test/test_websocket.html
index 6beb2da225f6..3363342a6d6c 100644
--- a/content/base/test/test_websocket.html
+++ b/content/base/test/test_websocket.html
@@ -129,15 +129,11 @@ function CreateTestWS(ws_location, ws_protocol)
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);
}
diff --git a/content/base/test/test_ws_basic_tests.html b/content/base/test/test_ws_basic_tests.html
index 1a06efa153b6..a656e47a862d 100644
--- a/content/base/test/test_ws_basic_tests.html
+++ b/content/base/test/test_ws_basic_tests.html
@@ -22,11 +22,8 @@ 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() {
diff --git a/testing/mochitest/specialpowers/content/specialpowers.js b/testing/mochitest/specialpowers/content/specialpowers.js
index 297c8de38aa8..8473628977f9 100644
--- a/testing/mochitest/specialpowers/content/specialpowers.js
+++ b/testing/mochitest/specialpowers/content/specialpowers.js
@@ -212,6 +212,10 @@ SpecialPowers.prototype = {
this.DOMWindowUtils.garbageCollect();
},
+ forceGC: function() {
+ Components.utils.forceGC();
+ },
+
hasContentProcesses: function() {
try {
var rt = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);