mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 995266 - Prevent mochitest-browser harness from leaking due to SimpleTest overrides. r=ted
CLOSED TREE
This commit is contained in:
parent
f3d485c035
commit
f50a79817a
@ -20,6 +20,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "BrowserNewTabPreloader",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "CustomizationTabPreloader",
|
||||
"resource:///modules/CustomizationTabPreloader.jsm", "CustomizationTabPreloader");
|
||||
|
||||
const SIMPLETEST_OVERRIDES =
|
||||
["ok", "is", "isnot", "ise", "todo", "todo_is", "todo_isnot", "info", "expectAssertions"];
|
||||
|
||||
window.addEventListener("load", testOnLoad, false);
|
||||
|
||||
function testOnLoad() {
|
||||
@ -88,6 +91,11 @@ function Tester(aTests, aDumper, aCallback) {
|
||||
this.Task = Components.utils.import("resource://gre/modules/Task.jsm", null).Task;
|
||||
this.Promise = Components.utils.import("resource://gre/modules/Promise.jsm", null).Promise;
|
||||
this.Assert = Components.utils.import("resource://testing-common/Assert.jsm", null).Assert;
|
||||
|
||||
this.SimpleTestOriginal = {};
|
||||
SIMPLETEST_OVERRIDES.forEach(m => {
|
||||
this.SimpleTestOriginal[m] = this.SimpleTest[m];
|
||||
});
|
||||
}
|
||||
Tester.prototype = {
|
||||
EventUtils: {},
|
||||
@ -388,6 +396,11 @@ Tester.prototype = {
|
||||
this.haltTests();
|
||||
}
|
||||
|
||||
// Restore original SimpleTest methods to avoid leaks.
|
||||
SIMPLETEST_OVERRIDES.forEach(m => {
|
||||
this.SimpleTest[m] = this.SimpleTestOriginal[m];
|
||||
});
|
||||
|
||||
testScope.destroy();
|
||||
this.currentTest.scope = null;
|
||||
}
|
||||
@ -525,7 +538,7 @@ Tester.prototype = {
|
||||
};
|
||||
|
||||
// Override SimpleTest methods with ours.
|
||||
["ok", "is", "isnot", "ise", "todo", "todo_is", "todo_isnot", "info", "expectAssertions"].forEach(function(m) {
|
||||
SIMPLETEST_OVERRIDES.forEach(function(m) {
|
||||
this.SimpleTest[m] = this[m];
|
||||
}, this.currentTest.scope);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user