js/src/tests/ecma_2/Statements/try-010.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:          try-010.js
     9  *  ECMA Section:
    10  *  Description:        The try statement
    11  *
    12  *  This has a try block nested in the try block.  Verify that the
    13  *  exception is caught by the right try block, and all finally blocks
    14  *  are executed.
    15  *
    16  *  Author:             christine@netscape.com
    17  *  Date:               11 August 1998
    18  */
    19 var SECTION = "try-010";
    20 var VERSION = "ECMA_2";
    21 var TITLE   = "The try statement: try in a tryblock";
    23 startTest();
    24 writeHeaderToLog( SECTION + " "+ TITLE);
    26 var EXCEPTION_STRING = "Exception thrown: ";
    27 var NO_EXCEPTION_STRING = "No exception thrown:  ";
    30 NestedTry( new TryObject( "No Exceptions Thrown",  NoException, NoException, 43 ) );
    31 NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 ));
    32 NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 ));
    33 NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 ));
    35 test();
    37 function TryObject( description, tryOne, tryTwo, result ) {
    38   this.description = description;
    39   this.tryOne = tryOne;
    40   this.tryTwo = tryTwo;
    41   this.result = result;
    42 }
    43 function ThrowException() {
    44   throw EXCEPTION_STRING + this.value;
    45 }
    46 function NoException() {
    47   return NO_EXCEPTION_STRING + this.value;
    48 }
    49 function NestedTry( object ) {
    50   result = 0;
    51   try {
    52     object.tryOne();
    53     result += 1;
    54     try {
    55       object.tryTwo();
    56       result += 2;
    57     } catch ( e ) {
    58       result +=4;
    59     } finally {
    60       result += 8;
    61     }
    62   } catch ( e ) {
    63     result += 16;
    64   } finally {
    65     result += 32;
    66   }
    68   new TestCase(
    69     SECTION,
    70     object.description,
    71     object.result,
    72     result );
    73 }

mercurial