js/src/tests/js1_5/extensions/regress-434837-01.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 var BUGNUMBER = 434837;
     8 var summary = '|this| in accessors in prototype chain of array';
     9 var actual = '';
    10 var expect = '';
    13 //-----------------------------------------------------------------------------
    14 test();
    15 //-----------------------------------------------------------------------------
    17 function test()
    18 {
    19   enterFunc ('test');
    20   printBugNumber(BUGNUMBER);
    21   printStatus (summary);
    23   try
    24   {
    25     expect = true;
    26     actual = null;
    27     x = [ "one", "two" ];
    28     Array.prototype.__defineGetter__('test1', function() { actual = (this === x); });
    29     x.test1;
    30   }
    31   catch(ex)
    32   {
    33     actual = ex + '';
    34   }
    35   reportCompare(expect, actual, summary + ': x.test1');
    37   try
    38   {
    39     expect = false;
    40     actual = null;
    41     Array.prototype.__defineGetter__('test2', function() { actual = (this === Array.prototype) });
    42     x.test2;
    43   }
    44   catch(ex)
    45   {
    46     actual = ex + '';
    47   }
    48   reportCompare(expect, actual, summary + ': x.test2');
    50   Array.prototype.__defineGetter__('test3', function() { actual = (this === x) });
    51   Array.prototype.__defineSetter__('test3', function() { actual = (this === x) });
    53   try
    54   {
    55     expect = true;
    56     actual = null;
    57     x.test3;
    58   }
    59   catch(ex)
    60   {
    61     actual = ex + '';
    62   }
    63   reportCompare(expect, actual, summary + ': x.test3 (1)');
    65   try
    66   {
    67     expect = true;
    68     actual = null;
    69     x.test3 = 5;
    70   }
    71   catch(ex)
    72   {
    73     actual = ex + '';
    74   }
    75   reportCompare(expect, actual, summary + ': x.test3 = 5');
    77   try
    78   {
    79     expect = true;
    80     actual = null;
    81     x.test3;
    82   }
    83   catch(ex)
    84   {
    85     actual = ex + '';
    86   }
    87   reportCompare(expect, actual, summary + ': x.test3 (2)');
    89   exitFunc ('test');
    90 }

mercurial