Bug 932898 - Fix leaks in DOM tests; r=smaug CLOSED TREE

This commit is contained in:
Tim Taubert 2013-10-31 02:30:00 +00:00
Родитель d0fd168866
Коммит 68c065a82f
2 изменённых файлов: 7 добавлений и 6 удалений

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

@ -12,6 +12,10 @@ function onLoad() {
function onUnload() {
if (!gIterations) {
gBugWindow = null;
Services.obs.removeObserver(onLoad, "bug839193-loaded");
Services.obs.removeObserver(onUnload, "bug839193-unloaded");
window.focus();
finish();
} else {
@ -25,12 +29,8 @@ function onUnload() {
// will be apparent by the checks the harness performs.
function test() {
waitForExplicitFinish();
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.addObserver(onLoad, "bug839193-loaded", false);
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.addObserver(onUnload, "bug839193-unloaded", false);
Services.obs.addObserver(onLoad, "bug839193-loaded", false);
Services.obs.addObserver(onUnload, "bug839193-unloaded", false);
gBugWindow = window.openDialog(gTestRoot + "bug839193.xul");
}

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

@ -34,6 +34,7 @@ function test() {
let workerWindow = frame.contentWindow;
workerWindow.addEventListener("message", function(evt) {
is(evt.data.result, "ok", "check the sandbox code was happy");
frame.remove();
finish();
}, true);
let sandbox = new Cu.Sandbox(workerWindow);