js/src/tests/js1_5/extensions/scope-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 var BUGNUMBER = '53268';
     8 var status = 'Testing scope after changing obj.__proto__';
     9 var expect= '';
    10 var actual = '';
    11 var obj = {};
    12 const five = 5;
    15 //-----------------------------------------------------------------------------
    16 test();
    17 //-----------------------------------------------------------------------------
    20 function test()
    21 {
    22   enterFunc ("test");
    23   printBugNumber(BUGNUMBER);
    24   printStatus (status);
    27   status= 'Step 1:  setting obj.__proto__ = global object';
    28   obj.__proto__ = this;
    30   actual = obj.five;
    31   expect=5;
    32   reportCompare (expect, actual, status);
    34   obj.five=1;
    35   actual = obj.five;
    36   expect=5;
    37   reportCompare (expect, actual, status);
    41   status= 'Step 2:  setting obj.__proto__ = null';
    42   obj.__proto__ = null;
    44   actual = obj.five;
    45   expect=undefined;
    46   reportCompare (expect, actual, status);
    48   obj.five=2;
    49   actual = obj.five;
    50   expect=2;
    51   reportCompare (expect, actual, status);
    55   status= 'Step 3:  setting obj.__proto__  to global object again';
    56   obj.__proto__ = this;
    58   actual = obj.five;
    59   expect=2;  //<--- (FROM STEP 2 ABOVE)
    60   reportCompare (expect, actual, status);
    62   obj.five=3;
    63   actual = obj.five;
    64   expect=3;
    65   reportCompare (expect, actual, status);
    69   status= 'Step 4:  setting obj.__proto__   to  null again';
    70   obj.__proto__ = null;
    72   actual = obj.five;
    73   expect=3;  //<--- (FROM STEP 3 ABOVE)
    74   reportCompare (expect, actual, status);
    76   obj.five=4;
    77   actual = obj.five;
    78   expect=4;
    79   reportCompare (expect, actual, status);
    82   exitFunc ("test");
    83 }

mercurial