js/src/tests/js1_5/Regress/regress-96128-n.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * Date: 29 Aug 2001
michael@0 8 *
michael@0 9 * SUMMARY: Negative test that JS infinite recursion protection works.
michael@0 10 * We expect the code here to fail (i.e. exit code 3), but NOT crash.
michael@0 11 *
michael@0 12 * See http://bugzilla.mozilla.org/show_bug.cgi?id=96128
michael@0 13 */
michael@0 14 //-----------------------------------------------------------------------------
michael@0 15 var BUGNUMBER = 96128;
michael@0 16 var summary = 'Testing that JS infinite recursion protection works';
michael@0 17
michael@0 18
michael@0 19 function objRecurse()
michael@0 20 {
michael@0 21 /*
michael@0 22 * jband:
michael@0 23 *
michael@0 24 * Causes a stack overflow crash in debug builds of both the browser
michael@0 25 * and the shell. In the release builds this is safely caught by the
michael@0 26 * "too much recursion" mechanism. If I remove the 'new' from the code below
michael@0 27 * this is safely caught in both debug and release builds. The 'new' causes a
michael@0 28 * lookup for the Constructor name and seems to (at least) double the number
michael@0 29 * of items on the C stack for the given interpLevel depth.
michael@0 30 */
michael@0 31 return new objRecurse();
michael@0 32 }
michael@0 33
michael@0 34
michael@0 35
michael@0 36 //-----------------------------------------------------------------------------
michael@0 37 test();
michael@0 38 //-----------------------------------------------------------------------------
michael@0 39
michael@0 40
michael@0 41 function test()
michael@0 42 {
michael@0 43 enterFunc ('test');
michael@0 44 printBugNumber(BUGNUMBER);
michael@0 45 printStatus (summary);
michael@0 46
michael@0 47 // we expect this to fail (exit code 3), but NOT crash. -
michael@0 48 var obj = new objRecurse();
michael@0 49
michael@0 50 exitFunc ('test');
michael@0 51 }

mercurial