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.

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

mercurial