js/src/tests/ecma_3/Object/regress-72773.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: 09 May 2001
michael@0 8 *
michael@0 9 * SUMMARY: Regression test: we shouldn't crash on this code
michael@0 10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=72773
michael@0 11 *
michael@0 12 * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
michael@0 13 *
michael@0 14 * Same as class-001.js - but testing user-defined types here, not
michael@0 15 * native types. Therefore we expect the [[Class]] property to equal
michael@0 16 * 'Object' in each case -
michael@0 17 *
michael@0 18 * The getJSClass() function we use is in a utility file, e.g. "shell.js"
michael@0 19 */
michael@0 20 //-----------------------------------------------------------------------------
michael@0 21 var BUGNUMBER = 72773;
michael@0 22 var summary = "Regression test: we shouldn't crash on this code";
michael@0 23 var status = '';
michael@0 24 var actual = '';
michael@0 25 var expect = '';
michael@0 26 var sToEval = '';
michael@0 27
michael@0 28 /*
michael@0 29 * This code should produce an error, but not a crash.
michael@0 30 * 'TypeError: Function.prototype.toString called on incompatible object'
michael@0 31 */
michael@0 32 sToEval += 'function Cow(name){this.name = name;}'
michael@0 33 sToEval += 'function Calf(str){this.name = str;}'
michael@0 34 sToEval += 'Calf.prototype = Cow;'
michael@0 35 sToEval += 'new Calf().toString();'
michael@0 36
michael@0 37 status = 'Trying to catch an expected error';
michael@0 38 try
michael@0 39 {
michael@0 40 eval(sToEval);
michael@0 41 }
michael@0 42 catch(e)
michael@0 43 {
michael@0 44 actual = getJSClass(e);
michael@0 45 expect = 'Error';
michael@0 46 }
michael@0 47
michael@0 48
michael@0 49 //----------------------------------------------------------------------------------------------
michael@0 50 test();
michael@0 51 //----------------------------------------------------------------------------------------------
michael@0 52
michael@0 53
michael@0 54 function test()
michael@0 55 {
michael@0 56 enterFunc ('test');
michael@0 57 printBugNumber(BUGNUMBER);
michael@0 58 printStatus (summary);
michael@0 59
michael@0 60 reportCompare(expect, actual, status);
michael@0 61
michael@0 62 exitFunc ('test');
michael@0 63 }

mercurial