michael@0: function run_test() { michael@0: set_process_running_environment(); michael@0: michael@0: var file = get_test_program("TestQuickReturn"); michael@0: var thread = Components.classes["@mozilla.org/thread-manager;1"] michael@0: .getService().currentThread; michael@0: michael@0: for (var i = 0; i < 1000; i++) { michael@0: var process = Components.classes["@mozilla.org/process/util;1"] michael@0: .createInstance(Components.interfaces.nsIProcess); michael@0: process.init(file); michael@0: michael@0: process.run(false, [], 0); michael@0: michael@0: try { michael@0: process.kill(); michael@0: } michael@0: catch (e) { } michael@0: michael@0: // We need to ensure that we process any events on the main thread - michael@0: // this allow threads to clean up properly and avoid out of memory michael@0: // errors during the test. michael@0: while (thread.hasPendingEvents()) michael@0: thread.processNextEvent(false); michael@0: } michael@0: michael@0: }