js/src/tests/ecma/ExecutionContexts/10.2.2-1.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.

michael@0 1 // |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android
michael@0 2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7
michael@0 8 /**
michael@0 9 File Name: 10.2.2-1.js
michael@0 10 ECMA Section: 10.2.2 Eval Code
michael@0 11 Description:
michael@0 12
michael@0 13 When control enters an execution context for eval code, the previous
michael@0 14 active execution context, referred to as the calling context, is used to
michael@0 15 determine the scope chain, the variable object, and the this value. If
michael@0 16 there is no calling context, then initializing the scope chain, variable
michael@0 17 instantiation, and determination of the this value are performed just as
michael@0 18 for global code.
michael@0 19
michael@0 20 The scope chain is initialized to contain the same objects, in the same
michael@0 21 order, as the calling context's scope chain. This includes objects added
michael@0 22 to the calling context's scope chain by WithStatement.
michael@0 23
michael@0 24 Variable instantiation is performed using the calling context's variable
michael@0 25 object and using empty property attributes.
michael@0 26
michael@0 27 The this value is the same as the this value of the calling context.
michael@0 28
michael@0 29 Author: christine@netscape.com
michael@0 30 Date: 12 november 1997
michael@0 31 */
michael@0 32
michael@0 33 var SECTION = "10.2.2-1";
michael@0 34 var VERSION = "ECMA_1";
michael@0 35 startTest();
michael@0 36 var TITLE = "Eval Code";
michael@0 37
michael@0 38 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 39
michael@0 40 var THIS = eval("this");
michael@0 41
michael@0 42 new TestCase( SECTION,
michael@0 43 "this +''",
michael@0 44 GLOBAL,
michael@0 45 THIS + "" );
michael@0 46
michael@0 47 var GLOBAL_PROPERTIES = new Array();
michael@0 48 var i = 0;
michael@0 49
michael@0 50 for ( p in THIS ) {
michael@0 51 GLOBAL_PROPERTIES[i++] = p;
michael@0 52 }
michael@0 53
michael@0 54 for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
michael@0 55 new TestCase( SECTION,
michael@0 56 GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]",
michael@0 57 true,
michael@0 58 eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
michael@0 59 }
michael@0 60
michael@0 61 // this in eval statements is the same as this value of the calling context
michael@0 62
michael@0 63 var RESULT = THIS == this;
michael@0 64
michael@0 65 new TestCase( SECTION,
michael@0 66 "eval( 'this == THIS' )",
michael@0 67 true,
michael@0 68 RESULT );
michael@0 69
michael@0 70 var RESULT = THIS +'';
michael@0 71
michael@0 72 new TestCase( SECTION,
michael@0 73 "eval( 'this + \"\"' )",
michael@0 74 GLOBAL,
michael@0 75 RESULT );
michael@0 76
michael@0 77
michael@0 78 new TestCase( SECTION,
michael@0 79 "eval( 'this == THIS' )",
michael@0 80 true,
michael@0 81 eval( "this == THIS" ) );
michael@0 82
michael@0 83 new TestCase( SECTION,
michael@0 84 "eval( 'this + \"\"' )",
michael@0 85 GLOBAL,
michael@0 86 eval( "this +''") );
michael@0 87
michael@0 88
michael@0 89 test();

mercurial