Bug 1230027 - Stop burnCPOWInSandbox from being GC'd during tests. r=yoric

Since no one is holding a reference to the burnCPOWInSandbox function
in the child process, it might get GC'd during the test. Binding it to
the global object should keep the function alive long enough for the
test to call it via CPOW.

--HG--
extra : transplant_source : %60%97%A0%8D%1D%B6%D1G%A0h%2B%11%A9%05%C1%13%25%10cc
This commit is contained in:
Sami Jaktholm 2015-12-22 20:15:17 +02:00
Родитель 5aeac1def0
Коммит 83d60ea279
1 изменённых файлов: 12 добавлений и 8 удалений

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

@ -93,15 +93,19 @@ CPUBurner.frameScript = function() {
});
}
sendAsyncMessage("test-performance-watcher:cpow-init", {}, {
burnCPOWInSandbox: function(addonId) {
try {
burnCPUInSandbox(addonId);
} catch (ex) {
dump(`This is the addon attempting to burn CPOW: error ${ex}\n`);
dump(`${ex.stack}\n`);
}
// Bind the function to the global context or it might be GC'd during test
// causing failures (bug 1230027)
this.burnCPOWInSandbox = function(addonId) {
try {
burnCPUInSandbox(addonId);
} catch (ex) {
dump(`This is the addon attempting to burn CPOW: error ${ex}\n`);
dump(`${ex.stack}\n`);
}
}
sendAsyncMessage("test-performance-watcher:cpow-init", {}, {
burnCPOWInSandbox: this.burnCPOWInSandbox
});
} catch (ex) {