js/src/tests/ecma_3/Function/regress-193555.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:    17 February 2003
     9  * SUMMARY: Testing access to function name from inside function
    10  *
    11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=193555
    12  *
    13  */
    14 //-----------------------------------------------------------------------------
    15 var UBound = 0;
    16 var BUGNUMBER = 193555;
    17 var summary = 'Testing access to function name from inside function';
    18 var status = '';
    19 var statusitems = [];
    20 var actual = '';
    21 var actualvalues = [];
    22 var expect= '';
    23 var expectedvalues = [];
    26 // test via function statement
    27 status = inSection(1);
    28 function f() {return f.toString();};
    29 actual = f();
    30 expect = f.toString();
    31 addThis();
    33 // test via function expression
    34 status = inSection(2);
    35 var x = function g() {return g.toString();};
    36 actual = x();
    37 expect = x.toString();
    38 addThis();
    40 // test via eval() outside function
    41 status = inSection(3);
    42 eval ('function a() {return a.toString();}');
    43 actual = a();
    44 expect = a.toString();
    45 addThis();
    47 status = inSection(4);
    48 eval ('var y = function b() {return b.toString();}');
    49 actual = y();
    50 expect = y.toString();
    51 addThis();
    53 // test via eval() inside function
    54 status = inSection(5);
    55 function c() {return eval('c').toString();};
    56 actual = c();
    57 expect = c.toString();
    58 addThis();
    60 status = inSection(6);
    61 var z = function d() {return eval('d').toString();};
    62 actual = z();
    63 expect = z.toString();
    64 addThis();
    66 // test via two evals!
    67 status = inSection(7);
    68 eval('var w = function e() {return eval("e").toString();}');
    69 actual = w();
    70 expect = w.toString();
    71 addThis();
    75 //-----------------------------------------------------------------------------
    76 test();
    77 //-----------------------------------------------------------------------------
    81 function addThis()
    82 {
    83   statusitems[UBound] = status;
    84   actualvalues[UBound] = actual;
    85   expectedvalues[UBound] = expect;
    86   UBound++;
    87 }
    90 function test()
    91 {
    92   enterFunc('test');
    93   printBugNumber(BUGNUMBER);
    94   printStatus(summary);
    96   for (var i=0; i<UBound; i++)
    97   {
    98     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    99   }
   101   exitFunc ('test');
   102 }

mercurial