js/src/tests/js1_5/extensions/regress-365869.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 = 365869;
     8 var summary = 'strict warning for object literal with duplicate propery names';
     9 var actual = '';
    10 var expect = '';
    13 //-----------------------------------------------------------------------------
    14 test();
    15 //-----------------------------------------------------------------------------
    17 function test()
    18 {
    19   enterFunc ('test');
    20   printBugNumber(BUGNUMBER);
    21   printStatus (summary);
    23   if (!options().match(/strict/))
    24   {
    25     options('strict');
    26   }
    27   if (!options().match(/werror/))
    28   {
    29     options('werror');
    30   }
    32   try
    33   {
    34     expect = 'SyntaxError: property name a appears more than once in object literal';
    35     eval('({a:4, a:5})');
    36     // syntax warning, need to eval to catch
    37     actual = 'No warning';
    38   }
    39   catch(ex)
    40   {
    41     actual = ex + '';
    42   }
    44   reportCompare(expect, actual, summary);
    46   print('test crash from bug 371292 Comment 3');
    48   try
    49   {
    50     expect = 'SyntaxError: property name 1 appears more than once in object literal';
    51     eval('({1:1, 1:2})');
    52     // syntax warning, need to eval to catch
    53     actual = 'No warning';
    54   }
    55   catch(ex)
    56   {
    57     actual = ex + '';
    58   }
    60   reportCompare(expect, actual, summary);
    63   print('test crash from bug 371292 Comment 9');
    65   try
    66   {
    67     expect = "TypeError: can't redefine non-configurable property '5'";
    68     "012345".__defineSetter__(5, function(){});
    69   }
    70   catch(ex)
    71   {
    72     actual = ex + '';
    73   }
    75   reportCompare(expect, actual, summary);
    78   exitFunc ('test');
    79 }

mercurial