xpcom/tests/unit/test_nsIProcess_stress.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 function run_test() {
     2   set_process_running_environment();
     4   var file = get_test_program("TestQuickReturn");
     5   var thread = Components.classes["@mozilla.org/thread-manager;1"]
     6                          .getService().currentThread;
     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);
    13     process.run(false, [], 0);
    15     try {
    16       process.kill();
    17     }
    18     catch (e) { }
    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   }
    27 }

mercurial