js/src/tests/js1_5/Regress/regress-204210.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 *
michael@0 8 * Date: 29 April 2003
michael@0 9 * SUMMARY: eval() is not a constructor, but don't crash on |new eval();|
michael@0 10 *
michael@0 11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=204210
michael@0 12 *
michael@0 13 */
michael@0 14 //-----------------------------------------------------------------------------
michael@0 15 var UBound = 0;
michael@0 16 var BUGNUMBER = 204210;
michael@0 17 var summary = "eval() is not a constructor, but don't crash on |new eval();|";
michael@0 18 var status = '';
michael@0 19 var statusitems = [];
michael@0 20 var actual = '';
michael@0 21 var actualvalues = [];
michael@0 22 var expect= '';
michael@0 23 var expectedvalues = [];
michael@0 24
michael@0 25 printBugNumber(BUGNUMBER);
michael@0 26 printStatus(summary);
michael@0 27
michael@0 28 /*
michael@0 29 * Just testing that we don't crash on any of these constructs -
michael@0 30 */
michael@0 31
michael@0 32
michael@0 33 /*
michael@0 34 * global scope -
michael@0 35 */
michael@0 36 try
michael@0 37 {
michael@0 38 var x = new eval();
michael@0 39 new eval();
michael@0 40 }
michael@0 41 catch(e)
michael@0 42 {
michael@0 43 }
michael@0 44
michael@0 45
michael@0 46 /*
michael@0 47 * function scope -
michael@0 48 */
michael@0 49 f();
michael@0 50 function f()
michael@0 51 {
michael@0 52 try
michael@0 53 {
michael@0 54 var x = new eval();
michael@0 55 new eval();
michael@0 56 }
michael@0 57 catch(e)
michael@0 58 {
michael@0 59 }
michael@0 60 }
michael@0 61
michael@0 62
michael@0 63 /*
michael@0 64 * eval scope -
michael@0 65 */
michael@0 66 var s = '';
michael@0 67 s += 'try';
michael@0 68 s += '{';
michael@0 69 s += ' var x = new eval();';
michael@0 70 s += ' new eval();';
michael@0 71 s += '}';
michael@0 72 s += 'catch(e)';
michael@0 73 s += '{';
michael@0 74 s += '}';
michael@0 75 eval(s);
michael@0 76
michael@0 77
michael@0 78 /*
michael@0 79 * some combinations of scope -
michael@0 80 */
michael@0 81 s = '';
michael@0 82 s += 'function g()';
michael@0 83 s += '{';
michael@0 84 s += ' try';
michael@0 85 s += ' {';
michael@0 86 s += ' var x = new eval();';
michael@0 87 s += ' new eval();';
michael@0 88 s += ' }';
michael@0 89 s += ' catch(e)';
michael@0 90 s += ' {';
michael@0 91 s += ' }';
michael@0 92 s += '}';
michael@0 93 s += 'g();';
michael@0 94 eval(s);
michael@0 95
michael@0 96
michael@0 97 function h()
michael@0 98 {
michael@0 99 var s = '';
michael@0 100 s += 'function f()';
michael@0 101 s += '{';
michael@0 102 s += ' try';
michael@0 103 s += ' {';
michael@0 104 s += ' var x = new eval();';
michael@0 105 s += ' new eval();';
michael@0 106 s += ' }';
michael@0 107 s += ' catch(e)';
michael@0 108 s += ' {';
michael@0 109 s += ' }';
michael@0 110 s += '}';
michael@0 111 s += 'f();';
michael@0 112 eval(s);
michael@0 113 }
michael@0 114 h();
michael@0 115
michael@0 116 reportCompare('No Crash', 'No Crash', '');

mercurial