Bug 1287143 - Remove the window argument to SpecialPowers.exactGC(). r=jmaher

Cu.forceCC() is the same as DOMWindowUtils.cycleCollect(), but does
not require a window.
This commit is contained in:
Andrew McCreight 2016-07-19 13:13:00 +08:00
Родитель 332fcd9fc9
Коммит 623b56a3f1
20 изменённых файлов: 22 добавлений и 23 удалений

Просмотреть файл

@ -87,7 +87,7 @@ add_task(function* () {
function waitForDestroyedDocuments() {
let deferred = promise.defer();
SpecialPowers.exactGC(window, deferred.resolve);
SpecialPowers.exactGC(deferred.resolve);
return deferred.promise;
}

Просмотреть файл

@ -195,7 +195,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=889335
document.body.removeChild(frame);
frame = null;
SpecialPowers.exactGC(window, function() {
SpecialPowers.exactGC(function() {
// This should not crash.
SpecialPowers.pushPrefEnv({"set": [['intl.accept_languages', 'en-GB']]}, nextTest);
});

Просмотреть файл

@ -29,7 +29,7 @@ function callback() {
}
delete window.XMLHttpRequestUpload;
SpecialPowers.exactGC(window, callback);
SpecialPowers.exactGC(callback);
</script>
</pre>

Просмотреть файл

@ -54,7 +54,7 @@ function resetStorage() {
function gc() {
return new Promise(function(resolve, reject) {
SpecialPowers.exactGC(window, resolve);
SpecialPowers.exactGC(resolve);
});
}

Просмотреть файл

@ -54,7 +54,7 @@ function resetStorage() {
function gc() {
return new Promise(function(resolve, reject) {
SpecialPowers.exactGC(window, resolve);
SpecialPowers.exactGC(resolve);
});
}

Просмотреть файл

@ -54,7 +54,7 @@ function resetStorage() {
function gc() {
return new Promise(function(resolve, reject) {
SpecialPowers.exactGC(window, resolve);
SpecialPowers.exactGC(resolve);
});
}

Просмотреть файл

@ -345,7 +345,7 @@ function gc()
function scheduleGC()
{
SpecialPowers.exactGC(window, continueToNextStep);
SpecialPowers.exactGC(continueToNextStep);
}
function workerScript() {

Просмотреть файл

@ -217,7 +217,7 @@ function gc()
function scheduleGC()
{
SpecialPowers.exactGC(null, continueToNextStep);
SpecialPowers.exactGC(continueToNextStep);
}
function setTimeout(fun, timeout) {
@ -492,7 +492,7 @@ var SpecialPowers = {
this._getPrefs().clearUserPref(prefName);
},
// Copied (and slightly adjusted) from specialpowersAPI.js
exactGC: function(win, callback) {
exactGC: function(callback) {
let count = 0;
function doPreciseGCandCC() {

Просмотреть файл

@ -1665,7 +1665,7 @@ function mediaTestCleanup(callback) {
removeNodeAndSource(A[i]);
A[i] = null;
}
SpecialPowers.exactGC(window, callback);
SpecialPowers.exactGC(callback);
}
function setMediaTestsPrefs(callback, extraPrefs) {

Просмотреть файл

@ -20,7 +20,7 @@ function doTest() {
v.onended = function() {
info("Got ended.");
v.onended = null;
SpecialPowers.exactGC(window, function() {
SpecialPowers.exactGC(function() {
info("GC completed.");
v.play();
SimpleTest.finish();

Просмотреть файл

@ -324,7 +324,7 @@ function setupEnvironment() {
// We don't care about waiting for this to complete, we just want to ensure
// that we don't build up a huge backlog of GC work.
SpecialPowers.exactGC(window);
SpecialPowers.exactGC();
}
// This is called by steeplechase; which provides the test configuration options

Просмотреть файл

@ -55,7 +55,7 @@ add_task(function*() {
ok(time < 1000, "Interval is not throttled with audio playing (" + time + " ms)");
// Destroy the oscillator, but not the audio context
yield new Promise(resolve => SpecialPowers.exactGC(browser.contentWindow, resolve));
yield new Promise(resolve => SpecialPowers.exactGC(resolve));
yield oscillatorDemisePromise;
time = yield ContentTask.spawn(browser, null, function () {

Просмотреть файл

@ -59,7 +59,7 @@
function gc() {
return new Promise(function(resolve) {
SpecialPowers.exactGC(window, resolve);
SpecialPowers.exactGC(resolve);
});
}

Просмотреть файл

@ -38,7 +38,7 @@
// properly store and retrieve the security info from the cache.
iframe.parentNode.removeChild(iframe);
iframe = null;
SpecialPowers.exactGC(window, function() {
SpecialPowers.exactGC(function() {
iframe = document.createElement("iframe");
iframe.src = "https://example.com/tests/dom/workers/test/serviceworkers/fetch/https/synth.html";
document.body.appendChild(iframe);

Просмотреть файл

@ -23,7 +23,7 @@
iframe.src = "about:blank";
document.body.removeChild(iframe);
iframe = null;
SpecialPowers.exactGC(window, function() {
SpecialPowers.exactGC(function() {
resolve(result);
});
};

Просмотреть файл

@ -59,7 +59,7 @@
iframe.src = "about:blank";
document.body.removeChild(iframe);
iframe = null;
SpecialPowers.exactGC(window, function() {
SpecialPowers.exactGC(function() {
resolve(message.data);
});
};

Просмотреть файл

@ -58,7 +58,7 @@
iframe.src = "about:blank";
document.body.removeChild(iframe);
iframe = null;
SpecialPowers.exactGC(window, function() {
SpecialPowers.exactGC(function() {
resolve(message.data);
});
};

Просмотреть файл

@ -113,7 +113,7 @@
for (let i = 0; i < 3; i++) {
info("Running GC");
SpecialPowers.exactGC(window, sendToGenerator);
SpecialPowers.exactGC(sendToGenerator);
yield undefined;
info("Waiting the event queue to clear");

Просмотреть файл

@ -29,6 +29,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=484459
SimpleTest.finish();
}
SpecialPowers.exactGC(window, callback);
SpecialPowers.exactGC(callback);
]]></script>
</window>

Просмотреть файл

@ -1489,13 +1489,12 @@ SpecialPowersAPI.prototype = {
// needs to run several times and when no other JS is running.
// The current number of iterations has been determined according to massive
// cross platform testing.
exactGC: function(win, callback) {
var self = this;
exactGC: function(callback) {
let count = 0;
function genGCCallback(cb) {
return function() {
self.getDOMWindowUtils(win).cycleCollect();
Cu.forceCC();
if (++count < 2) {
Cu.schedulePreciseGC(genGCCallback(cb));
} else if (cb) {