mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1078153 - capture the callback in a generated function object to prevent it becomes dead during GC. r=khuey
This commit is contained in:
parent
3426bbc46f
commit
4b2793e9b0
@ -1400,21 +1400,18 @@ SpecialPowersAPI.prototype = {
|
||||
var self = this;
|
||||
let count = 0;
|
||||
|
||||
function doPreciseGCandCC() {
|
||||
function scheduledGCCallback() {
|
||||
function genGCCallback(cb) {
|
||||
return function() {
|
||||
self.getDOMWindowUtils(win).cycleCollect();
|
||||
|
||||
if (++count < 2) {
|
||||
doPreciseGCandCC();
|
||||
Cu.schedulePreciseGC(genGCCallback(cb));
|
||||
} else {
|
||||
callback();
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
Cu.schedulePreciseGC(scheduledGCCallback);
|
||||
}
|
||||
|
||||
doPreciseGCandCC();
|
||||
Cu.schedulePreciseGC(genGCCallback(callback));
|
||||
},
|
||||
|
||||
setGCZeal: function(zeal) {
|
||||
|
Loading…
Reference in New Issue
Block a user