js/src/tests/js1_8/extensions/for-in.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 // |reftest| skip
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /*
     4  * Any copyright is dedicated to the Public Domain.
     5  * http://creativecommons.org/licenses/publicdomain/
     6  * Contributor: Jason Orendorff
     7  */
     9 //-----------------------------------------------------------------------------
    11 var summary = "Contention among threads enumerating properties";
    12 // Adapted from mozilla/js/src/xpconnect/tests/js/old/threads.js
    14 printStatus (summary);
    16 var LOOP_COUNT = 1000;
    17 var THREAD_COUNT = 10;
    19 var foo;
    20 var bar;
    22 function makeWorkerFn(id) {
    23   return function() {
    24     foo = id + 1;
    25     bar[id] = {p: 0};
    26     var n, m;
    27     for (n in bar) {
    28       for (m in bar[n]) {}
    29     }
    30     for (n in parent({})) {}
    31   };
    32 }
    34 function range(n) {
    35   for (let i = 0; i < n; i++)
    36     yield i;
    37 }
    39 var expect;
    40 var actual;
    42 expect = actual = 'No crash';
    43 if (typeof scatter == 'undefined') {
    44   print('Test skipped. scatter not defined.');
    45 } else if (typeof parent === "undefined") {
    46   print('Test skipped, no parent() function.');
    47 } else {
    48   for (let i = 0; i < LOOP_COUNT; i++) {
    49     foo = 0;
    50     bar = new Array(THREAD_COUNT);
    51     scatter([makeWorkerFn(j) for (j in range(THREAD_COUNT))]);
    52   }
    53 }
    55 reportCompare(expect, actual, summary);

mercurial