js/src/tests/js1_6/String/regress-306591.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 = 306591;
     8 var summary = 'String static methods';
     9 var actual = '';
    10 var expect = '';
    12 printBugNumber(BUGNUMBER);
    13 printStatus (summary);
    14 printStatus ('See https://bugzilla.mozilla.org/show_bug.cgi?id=304828');
    16 expect = ['a', 'b', 'c'].toString();
    17 actual = String.split(new String('abc'), '').toString();
    18 reportCompare(expect, actual, summary +
    19               " String.split(new String('abc'), '')");
    21 expect = '2';
    22 actual = String.substring(new Number(123), 1, 2);
    23 reportCompare(expect, actual, summary +
    24               " String.substring(new Number(123), 1, 2)");
    26 expect = 'TRUE';
    27 actual = String.toUpperCase(new Boolean(true)); 
    28 reportCompare(expect, actual, summary +
    29               " String.toUpperCase(new Boolean(true))");
    31 try
    32 {
    33   String.indexOf(null, 'l');
    34   throw new Error("should have thrown a TypeError");
    35 }
    36 catch (e)
    37 {
    38   assertEq(e instanceof TypeError, true,
    39            "String.indexOf(null [, ...]) didn't work correctly");
    40 }
    42 expect = 2;
    43 actual = String.indexOf(String(null), 'l');             
    44 reportCompare(expect, actual, summary +
    45               " String.indexOf(String(null), 'l')");
    47 expect = ['a', 'b', 'c'].toString();
    48 actual = String.split('abc', '').toString();
    49 reportCompare(expect, actual, summary +
    50               " String.split('abc', '')");
    52 expect = '2';
    53 actual = String.substring(123, 1, 2);
    54 reportCompare(expect, actual, summary +
    55               " String.substring(123, 1, 2)");
    57 expect = 'TRUE';
    58 actual = String.toUpperCase(true);
    59 reportCompare(expect, actual, summary +
    60               " String.toUpperCase(true)");
    62 try
    63 {
    64   String.indexOf(undefined, 'd');
    65   throw new Error("should have thrown a TypeError");
    66 }
    67 catch (e)
    68 {
    69   assertEq(e instanceof TypeError, true,
    70            "String.indexOf(undefined [, ...]) didn't work correctly");
    71 }
    73 expect = 2;
    74 actual = String.indexOf(String(undefined), 'd');
    75 reportCompare(expect, actual, summary +
    76               " String.indexOf(String(undefined), 'd')");

mercurial