xpcom/tests/unit/test_nsIProcess_stress.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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