js/src/tests/ecma_5/extensions/8.12.5-01.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 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  * Contributor:
     6  *   Jason Orendorff
     7  *   Jeff Walden <jwalden+code@mit.edu>
     8  */
    10 //-----------------------------------------------------------------------------
    11 var BUGNUMBER = 523846;
    12 var summary =
    13   "Assignments to a property that has a getter but not a setter should not " +
    14   "throw a TypeError per ES5 (at least not until strict mode is supported)";
    15 var actual = "Early failure";
    16 var expect = "No errors";
    19 printBugNumber(BUGNUMBER);
    20 printStatus(summary);
    22 var o = { get p() { return "a"; } };
    24 function test1()
    25 {
    26   o.p = "b"; // strict-mode violation here
    27   assertEq(o.p, "a");
    28 }
    30 function test2()
    31 {
    32   function T() {}
    33   T.prototype = o;
    34   y = new T();
    35   y.p = "b";  // strict-mode violation here
    36   assertEq(y.p, "a");
    37 }
    40 var errors = [];
    41 try
    42 {
    43   try
    44   {
    45     test1();
    46   }
    47   catch (e)
    48   {
    49     errors.push(e);
    50   }
    52   try
    53   {
    54     test2();
    55   }
    56   catch (e)
    57   {
    58     errors.push(e);
    59   }
    61   options("strict");
    62   options("werror");
    63   try
    64   {
    65     test1();
    66     errors.push("strict+werror didn't make test1 fail");
    67   }
    68   catch (e)
    69   {
    70     if (!(e instanceof TypeError))
    71       errors.push("test1 with strict+werror failed without a TypeError: " + e);
    72   }
    74   try
    75   {
    76     test2();
    77     errors.push("strict+werror didn't make test2 fail");
    78   }
    79   catch (e)
    80   {
    81     if (!(e instanceof TypeError))
    82       errors.push("test2 with strict+werror failed without a TypeError: " + e);
    83   }
    85   options("strict");
    86   options("werror");
    87 }
    88 catch (e)
    89 {
    90   errors.push("Unexpected error: " + e);
    91 }
    92 finally
    93 {
    94   actual = errors.length > 0 ? errors.join(", ") : "No errors";
    95 }
    97 reportCompare(expect, actual, summary);

mercurial