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.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /*
     7  * Date: 09 May 2001
     8  *
     9  * SUMMARY: Regression test: we shouldn't crash on this code
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=72773
    11  *
    12  * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
    13  *
    14  * Same as class-001.js - but testing user-defined types here, not
    15  * native types.  Therefore we expect the [[Class]] property to equal
    16  * 'Object' in each case -
    17  *
    18  * The getJSClass() function we use is in a utility file, e.g. "shell.js"
    19  */
    20 //-----------------------------------------------------------------------------
    21 var BUGNUMBER = 72773;
    22 var summary = "Regression test: we shouldn't crash on this code";
    23 var status = '';
    24 var actual = '';
    25 var expect = '';
    26 var sToEval = '';
    28 /*
    29  * This code should produce an error, but not a crash.
    30  *  'TypeError: Function.prototype.toString called on incompatible object'
    31  */
    32 sToEval += 'function Cow(name){this.name = name;}'
    33 sToEval += 'function Calf(str){this.name = str;}'
    34 sToEval += 'Calf.prototype = Cow;'
    35 sToEval += 'new Calf().toString();'
    37 status = 'Trying to catch an expected error';
    38 try
    39 {
    40   eval(sToEval);
    41 }
    42 catch(e)
    43 {
    44   actual = getJSClass(e);
    45   expect = 'Error';
    46 }
    49 //----------------------------------------------------------------------------------------------
    50 test();
    51 //----------------------------------------------------------------------------------------------
    54 function test()
    55 {
    56   enterFunc ('test');
    57   printBugNumber(BUGNUMBER);
    58   printStatus (summary);
    60   reportCompare(expect, actual, status);
    62   exitFunc ('test');
    63 }

mercurial