js/src/tests/js1_5/LexicalConventions/regress-177314.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  *
     8  * Date:    30 Oct 2002
     9  * SUMMARY: '\400' should lex as a 2-digit octal escape + '0'
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=177314
    11  *
    12  * Bug was that Rhino interpreted '\400' as a 3-digit octal escape. As such
    13  * it is invalid, since octal escapes may only run from '\0' to '\377'. But
    14  * the lexer should interpret this as '\40' + '0' instead, and throw no error.
    15  *
    16  */
    17 //-----------------------------------------------------------------------------
    18 var UBound = 0;
    19 var BUGNUMBER = 177314;
    20 var summary = "'\\" + "400' should lex as a 2-digit octal escape + '0'";
    21 var status = '';
    22 var statusitems = [];
    23 var actual = '';
    24 var actualvalues = [];
    25 var expect= '';
    26 var expectedvalues = [];
    29 // the last valid octal escape is '\377', which should equal hex escape '\xFF'
    30 status = inSection(1);
    31 actual = '\377';
    32 expect = '\xFF';
    33 addThis();
    35 // now exercise the lexer by going one higher in the last digit
    36 status = inSection(2);
    37 actual = '\378';
    38 expect = '\37' + '8';
    39 addThis();
    41 // trickier: 400 is a valid octal number, but '\400' isn't a valid octal escape
    42 status = inSection(3);
    43 actual = '\400';
    44 expect = '\40' + '0';
    45 addThis();
    49 //-----------------------------------------------------------------------------
    50 test();
    51 //-----------------------------------------------------------------------------
    55 function addThis()
    56 {
    57   statusitems[UBound] = status;
    58   actualvalues[UBound] = actual;
    59   expectedvalues[UBound] = expect;
    60   UBound++;
    61 }
    64 function test()
    65 {
    66   enterFunc('test');
    67   printBugNumber(BUGNUMBER);
    68   printStatus(summary);
    70   for (var i=0; i<UBound; i++)
    71   {
    72     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    73   }
    75   exitFunc ('test');
    76 }

mercurial