js/src/tests/ecma_2/Statements/try-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.

     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-003.js
     9  *  ECMA Section:
    10  *  Description:        The try statement
    11  *
    12  *  This test has a try with no catch, and a finally.
    13  *
    14  *  Author:             christine@netscape.com
    15  *  Date:               11 August 1998
    16  */
    17 var SECTION = "try-003";
    18 var VERSION = "ECMA_2";
    19 var TITLE   = "The try statement";
    20 var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585";
    22 startTest();
    23 writeHeaderToLog( SECTION + " "+ TITLE);
    25 // Tests start here.
    27 TrySomething( "x = \"hi\"", false );
    28 TrySomething( "throw \"boo\"", true );
    29 TrySomething( "throw 3", true );
    31 test();
    33 /**
    34  *  This function contains a try block with no catch block,
    35  *  but it does have a finally block.  Try to evaluate expressions
    36  *  that do and do not throw exceptions.
    37  */
    39 function TrySomething( expression, throwing ) {
    40   innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
    41   if (throwing) {
    42     outerCatch = "FAILED: NO EXCEPTION CAUGHT";
    43   } else {
    44     outerCatch = "PASS";
    45   }
    46   outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
    48   try {
    49     try {
    50       eval( expression );
    51     } finally {
    52       innerFinally = "PASS";
    53     }
    54   } catch ( e  ) {
    55     if (throwing) {
    56       outerCatch = "PASS";
    57     } else {
    58       outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
    59     }
    60   } finally {
    61     outerFinally = "PASS";
    62   }
    65   new TestCase(
    66     SECTION,
    67     "eval( " + expression +" )",
    68     "PASS",
    69     innerFinally );
    70   new TestCase(
    71     SECTION,
    72     "eval( " + expression +" )",
    73     "PASS",
    74     outerCatch );
    75   new TestCase(
    76     SECTION,
    77     "eval( " + expression +" )",
    78     "PASS",
    79     outerFinally );
    82 }

mercurial