xpcom/tests/unit/test_nsIProcess_stress.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:97945b1e68c2
1 function run_test() {
2 set_process_running_environment();
3
4 var file = get_test_program("TestQuickReturn");
5 var thread = Components.classes["@mozilla.org/thread-manager;1"]
6 .getService().currentThread;
7
8 for (var i = 0; i < 1000; i++) {
9 var process = Components.classes["@mozilla.org/process/util;1"]
10 .createInstance(Components.interfaces.nsIProcess);
11 process.init(file);
12
13 process.run(false, [], 0);
14
15 try {
16 process.kill();
17 }
18 catch (e) { }
19
20 // We need to ensure that we process any events on the main thread -
21 // this allow threads to clean up properly and avoid out of memory
22 // errors during the test.
23 while (thread.hasPendingEvents())
24 thread.processNextEvent(false);
25 }
26
27 }

mercurial