js/src/tests/js1_5/extensions/regress-435345-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 // |reftest| fails
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 435345;
     9 var summary = 'Watch the length property of arrays';
    10 var actual = '';
    11 var expect = '';
    13 // see http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Object:watch
    15 //-----------------------------------------------------------------------------
    16 test();
    17 //-----------------------------------------------------------------------------
    19 function test()
    20 {
    21   enterFunc ('test');
    22   printBugNumber(BUGNUMBER);
    23   printStatus (summary);
    25   var arr;
    27   try
    28   {
    29     expect = 'watcher: propname=length, oldval=0, newval=1; ';
    30     actual = '';
    31     arr = [];
    32     arr.watch('length', watcher);
    33     arr[0] = '0';
    34   }
    35   catch(ex)
    36   {
    37     actual = ex + '';
    38   }
    39   reportCompare(expect, actual, summary + ': 1');
    41   try
    42   {
    43     expect = 'watcher: propname=length, oldval=1, newval=2; ' + 
    44       'watcher: propname=length, oldval=2, newval=2; ';
    45     actual = '';
    46     arr.push(5);
    47   }
    48   catch(ex)
    49   {
    50     actual = ex + '';
    51   }
    52   reportCompare(expect, actual, summary + ': 2');
    54   try
    55   {
    56     expect = 'watcher: propname=length, oldval=2, newval=1; ';
    57     actual = '';
    58     arr.pop();
    59   }
    60   catch(ex)
    61   {
    62     actual = ex + '';
    63   }
    64   reportCompare(expect, actual, summary + ': 3');
    66   try
    67   {
    68     expect = 'watcher: propname=length, oldval=1, newval=2; ';
    69     actual = '';
    70     arr.length++;
    71   }
    72   catch(ex)
    73   {
    74     actual = ex + '';
    75   }
    76   reportCompare(expect, actual, summary + ': 4');
    78   try
    79   {
    80     expect = 'watcher: propname=length, oldval=2, newval=5; ';
    81     actual = '';
    82     arr.length = 5;
    83   }
    84   catch(ex)
    85   {
    86     actual = ex + '';
    87   }
    88   reportCompare(expect, actual, summary + ': 5');
    90   exitFunc ('test');
    91 }
    93 function watcher(propname, oldval, newval)
    94 {
    95   actual += 'watcher: propname=' + propname + ', oldval=' + oldval + 
    96     ', newval=' + newval + '; ';
    98   return newval;
    99 }

mercurial