xpcom/tests/unit/test_nsIProcess_stress.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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