js/src/tests/js1_5/Scope/scope-002.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: 2001-07-02
     8  *
     9  * SUMMARY:  Testing visibility of outer function from inner function.
    10  *
    11  */
    12 //-----------------------------------------------------------------------------
    13 var UBound = 0;
    14 var BUGNUMBER = '(none)';
    15 var summary = 'Testing visibility of outer function from inner function';
    16 var cnCousin = 'Fred';
    17 var cnColor = 'red';
    18 var cnMake = 'Toyota';
    19 var status = '';
    20 var statusitems = [];
    21 var actual = '';
    22 var actualvalues = [];
    23 var expect= '';
    24 var expectedvalues = [];
    27 // TEST 1
    28 function Outer()
    29 {
    31   function inner()
    32   {
    33     Outer.cousin = cnCousin;
    34     return Outer.cousin;
    35   }
    37   status = 'Section 1 of test';
    38   actual = inner();
    39   expect = cnCousin;
    40   addThis();
    41 }
    44 Outer();
    45 status = 'Section 2 of test';
    46 actual = Outer.cousin;
    47 expect = cnCousin;
    48 addThis();
    52 // TEST 2
    53 function Car(make)
    54 {
    55   this.make = make;
    56   Car.prototype.paint = paint;
    58   function paint()
    59   {
    60     Car.color = cnColor;
    61     Car.prototype.color = Car.color;
    62   }
    63 }
    66 var myCar = new Car(cnMake);
    67 status = 'Section 3 of test';
    68 actual = myCar.make;
    69 expect = cnMake;
    70 addThis();
    73 myCar.paint();
    74 status = 'Section 4 of test';
    75 actual = myCar.color;
    76 expect = cnColor;
    77 addThis();
    81 //--------------------------------------------------
    82 test();
    83 //--------------------------------------------------
    87 function addThis()
    88 {
    89   statusitems[UBound] = status;
    90   actualvalues[UBound] = actual;
    91   expectedvalues[UBound] = expect;
    92   UBound++;
    93 }
    96 function test()
    97 {
    98   enterFunc ('test');
    99   printBugNumber(BUGNUMBER);
   100   printStatus (summary);
   102   for (var i=0; i<UBound; i++)
   103   {
   104     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
   105   }
   107   exitFunc ('test');
   108 }

mercurial