js/src/jit-test/lib/asserts.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 load(libdir + "../../tests/ecma_6/shell.js");
     8 if (typeof assertWarning === 'undefined') {
     9     var assertWarning = function assertWarning(f, errorClass, msg) {
    10         var hadWerror = options().split(",").indexOf("werror") !== -1;
    12         // Ensure the "werror" option is disabled.
    13         if (hadWerror)
    14             options("werror");
    16         try {
    17             f();
    18         } catch (exc) {
    19             if (hadWerror)
    20                 options("werror");
    22             // print() rather than throw a different exception value, in case
    23             // the caller wants exc.stack.
    24             if (msg)
    25                 print("assertWarning: " + msg);
    26             print("assertWarning: Unexpected exception calling " + f +
    27                   " with warnings-as-errors disabled");
    28             throw exc;
    29         }
    31         // Enable the "werror" option.
    32         options("werror");
    34         try {
    35             assertThrowsInstanceOf(f, errorClass, msg);
    36         } catch (exc) {
    37             if (msg)
    38                 print("assertWarning: " + msg);
    39             throw exc;
    40         } finally {
    41             if (!hadWerror)
    42                 options("werror");
    43         }
    44     };
    45 }
    47 if (typeof assertNoWarning === 'undefined') {
    48     var assertNoWarning = function assertWarning(f, msg) {
    49         // Ensure the "werror" option is enabled.
    50         var hadWerror = options().split(",").indexOf("werror") !== -1;
    51         if (!hadWerror)
    52             options("werror");
    54         try {
    55             f();
    56         } catch (exc) {
    57             if (msg)
    58                 print("assertNoWarning: " + msg);
    59             print("assertNoWarning: Unexpected exception calling " + f +
    60                   "with warnings-as-errors enabled");
    61             throw exc;
    62         } finally {
    63             if (!hadWerror)
    64                 options("werror");
    65         }
    66     };
    67 }

mercurial