Skip to content

Instantly share code, notes, and snippets.

@Infocatcher
Created December 28, 2013 20:28
Show Gist options
  • Select an option

  • Save Infocatcher/8163849 to your computer and use it in GitHub Desktop.

Select an option

Save Infocatcher/8163849 to your computer and use it in GitHub Desktop.
Test Firefox/SeaMonkey extension for memory leaks: automatically opens/closes browser windows. First appears here: https://github.com/Infocatcher/Private_Tab/issues/45#issuecomment-17063542
var count = 25;
var delay = 1000;
function leakTestPrototype() {
for(var i = 1; i <= count; ++i) {
var win = window.openDialog(location.href, "", "chrome,all");
win.addEventListener("load", function loader(e) {
win.removeEventListener(e.type, loader, false);
win.setTimeout(function() {
win.document.documentElement.setAttribute("titlemodifier", "[" + i + "/" + count + "]");
win.gBrowser.updateTitlebar();
}, 0);
win.setTimeout(function() {
win.close();
leakTestPrototype.__gen.next();
}, delay);
}, false);
yield;
}
yield;
}
var leakTest = leakTestPrototype.__gen = leakTestPrototype();
leakTest.next();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment