js/src/tests/ecma_3/Object/8.6.2.6-001.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  *
     8  * Date:    09 September 2002
     9  * SUMMARY: Test for TypeError on invalid default string value of object
    10  * See ECMA reference at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 167325;
    16 var summary = "Test for TypeError on invalid default string value of object";
    17 var TEST_PASSED = 'TypeError';
    18 var TEST_FAILED = 'Generated an error, but NOT a TypeError!';
    19 var TEST_FAILED_BADLY = 'Did not generate ANY error!!!';
    20 var status = '';
    21 var statusitems = [];
    22 var actual = '';
    23 var actualvalues = [];
    24 var expect= '';
    25 var expectedvalues = [];
    28 status = inSection(1);
    29 expect = TEST_PASSED;
    30 actual = TEST_FAILED_BADLY;
    31 /*
    32  * This should generate a TypeError. See ECMA reference
    33  * at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
    34  */
    35 try
    36 {
    37   var obj = {toString: function() {return new Object();}}
    38   obj == 'abc';
    39 }
    40 catch(e)
    41 {
    42   if (e instanceof TypeError)
    43     actual = TEST_PASSED;
    44   else
    45     actual = TEST_FAILED;
    46 }
    47 addThis();
    52 //-----------------------------------------------------------------------------
    53 test();
    54 //-----------------------------------------------------------------------------
    58 function addThis()
    59 {
    60   statusitems[UBound] = status;
    61   actualvalues[UBound] = actual;
    62   expectedvalues[UBound] = expect;
    63   UBound++;
    64 }
    67 function test()
    68 {
    69   enterFunc('test');
    70   printBugNumber(BUGNUMBER);
    71   printStatus(summary);
    73   for (var i=0; i<UBound; i++)
    74   {
    75     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    76   }
    78   exitFunc ('test');
    79 }

mercurial