js/src/tests/js1_5/Regress/regress-127557.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:    06 Mar 2002
     9  * SUMMARY: Testing cloned function objects
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=127557
    11  *
    12  * Before this bug was fixed, this testcase would error when run:
    13  *
    14  *             ReferenceError: h_peer is not defined
    15  *
    16  * The line |g.prototype = new Object| below is essential: this is
    17  * what was confusing the engine in its attempt to look up h_peer
    18  */
    19 //-----------------------------------------------------------------------------
    20 var UBound = 0;
    21 var BUGNUMBER = 127557;
    22 var summary = 'Testing cloned function objects';
    23 var cnCOMMA = ',';
    24 var status = '';
    25 var statusitems = [];
    26 var actual = '';
    27 var actualvalues = [];
    28 var expect= '';
    29 var expectedvalues = [];
    31 if (typeof clone == 'function')
    32 {
    33   status = inSection(1);
    34   var f = evaluate("(function(x, y) {\n" +
    35                    "    function h() { return h_peer(); }\n" +
    36                    "    function h_peer() { return (x + cnCOMMA + y); }\n" +
    37                    "    return h;\n" +
    38                    "})",
    39                    {compileAndGo: false});
    40   var g = clone(f);
    41   g.prototype = new Object;
    42   var h = g(5,6);
    43   actual = h();
    44   expect = '5,6';
    45   addThis();
    46 }
    47 else
    48 {
    49   reportCompare('Test not run', 'Test not run', 'shell only test requires clone()');
    50 }
    54 //-----------------------------------------------------------------------------
    55 test();
    56 //-----------------------------------------------------------------------------
    60 function addThis()
    61 {
    62   statusitems[UBound] = status;
    63   actualvalues[UBound] = actual;
    64   expectedvalues[UBound] = expect;
    65   UBound++;
    66 }
    69 function test()
    70 {
    71   enterFunc('test');
    72   printBugNumber(BUGNUMBER);
    73   printStatus(summary);
    75   for (var i=0; i<UBound; i++)
    76   {
    77     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    78   }
    80   exitFunc ('test');
    81 }

mercurial