js/src/tests/ecma_2/RegExp/regexp-enumerate-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/. */
     7 /**
     8    File Name:          regexp-enumerate-001.js
     9    ECMA V2 Section:
    10    Description:        Regression Test.
    12    If instance Native Object have properties that are enumerable,
    13    JavaScript enumerated through the properties twice. This only
    14    happened if objects had been instantiated, but their properties
    15    had not been enumerated.  ie, the object inherited properties
    16    from its prototype that are enumerated.
    18    In the core JavaScript, this is only a problem with RegExp
    19    objects, since the inherited properties of most core JavaScript
    20    objects are not enumerated.
    22    Author:             christine@netscape.com, pschwartau@netscape.com
    23    Date:               12 November 1997
    24    Modified:           14 July 2002
    25    Reason:             See http://bugzilla.mozilla.org/show_bug.cgi?id=155291
    26    ECMA-262 Ed.3  Sections 15.10.7.1 through 15.10.7.5
    27    RegExp properties should be DontEnum
    28    *
    29    */
    30 //    onerror = err;
    32 var SECTION = "regexp-enumerate-001";
    33 var VERSION = "ECMA_2";
    34 var TITLE   = "Regression Test for Enumerating Properties";
    36 var BUGNUMBER="339403";
    38 startTest();
    39 writeHeaderToLog( SECTION + " "+ TITLE);
    41 /*
    42  *  This test expects RegExp instances to have four enumerated properties:
    43  *  source, global, ignoreCase, and lastIndex
    44  *
    45  *  99.01.25:  now they also have a multiLine instance property.
    46  *
    47  */
    50 var r = new RegExp();
    52 var e = new Array();
    54 var t = new TestRegExp();
    56 for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) };
    58 new TestCase( SECTION,
    59 	      "r = new RegExp(); e = new Array(); "+
    60 	      "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length",
    61 	      0,
    62 	      e.length );
    64 test();
    66 function TestRegExp() {
    67   this.addProperty = addProperty;
    68 }
    69 function addProperty(name, value) {
    70   var pass = false;
    72   if ( eval("this."+name) != void 0 ) {
    73     pass = true;
    74   } else {
    75     eval( "this."+ name+" = "+ false );
    76   }
    78   new TestCase( SECTION,
    79 		"Property: " + name +" already enumerated?",
    80 		false,
    81 		pass );
    83   if ( gTestcases[ gTestcases.length-1].passed == false ) {
    84     gTestcases[gTestcases.length-1].reason = "property already enumerated";
    86   }
    88 }

mercurial