js/src/tests/ecma_2/Exceptions/statement-003.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: statement-003
michael@0 9 Corresponds To: 12.6.3-7-n.js
michael@0 10 ECMA Section: 12.6.3 The for...in Statement
michael@0 11 Description:
michael@0 12 The production IterationStatement : for ( LeftHandSideExpression in Expression )
michael@0 13 Statement is evaluated as follows:
michael@0 14
michael@0 15 1. Evaluate the Expression.
michael@0 16 2. Call GetValue(Result(1)).
michael@0 17 3. Call ToObject(Result(2)).
michael@0 18 4. Let C be "normal completion".
michael@0 19 5. Get the name of the next property of Result(3) that doesn't have the
michael@0 20 DontEnum attribute. If there is no such property, go to step 14.
michael@0 21 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
michael@0 22 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
michael@0 23 1. If Type(V) is not Reference, generate a runtime error.
michael@0 24 2. Call GetBase(V).
michael@0 25 3. If Result(2) is null, go to step 6.
michael@0 26 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
michael@0 27 for the property name and W for the value.
michael@0 28 5. Return.
michael@0 29 6. Call the [[Put]] method for the global object, passing
michael@0 30 GetPropertyName(V) for the property name and W for the value.
michael@0 31 7. Return.
michael@0 32 8. Evaluate Statement.
michael@0 33 9. If Result(8) is a value completion, change C to be "normal completion
michael@0 34 after value V" where V is the value carried by Result(8).
michael@0 35 10. If Result(8) is a break completion, go to step 14.
michael@0 36 11. If Result(8) is a continue completion, go to step 5.
michael@0 37 12. If Result(8) is a return completion, return Result(8).
michael@0 38 13. Go to step 5.
michael@0 39 14. Return C.
michael@0 40
michael@0 41 Author: christine@netscape.com
michael@0 42 Date: 11 september 1997
michael@0 43 */
michael@0 44 var SECTION = "statement-003";
michael@0 45 var VERSION = "JS1_4";
michael@0 46 var TITLE = "The for..in statement";
michael@0 47
michael@0 48 startTest();
michael@0 49 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 50
michael@0 51 var result = "Failed";
michael@0 52 var exception = "No exception thrown";
michael@0 53 var expect = "Passed";
michael@0 54
michael@0 55 try {
michael@0 56 var o = new MyObject();
michael@0 57 var result = 0;
michael@0 58
michael@0 59 eval("for ( this in o) {\n"
michael@0 60 + "result += this[p];\n"
michael@0 61 + "}\n");
michael@0 62 } catch ( e ) {
michael@0 63 result = expect;
michael@0 64 exception = e.toString();
michael@0 65 }
michael@0 66
michael@0 67 new TestCase(
michael@0 68 SECTION,
michael@0 69 "bad left-hand side expression" +
michael@0 70 " (threw " + exception +")",
michael@0 71 expect,
michael@0 72 result );
michael@0 73
michael@0 74 test();
michael@0 75
michael@0 76 function MyObject() {
michael@0 77 this.value = 2;
michael@0 78 this[0] = 4;
michael@0 79 return this;
michael@0 80 }

mercurial