js/src/tests/ecma_3/Object/8.6.1-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 /* 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/. */
     6 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 315436;
     9 var summary = 'In strict mode, setting a read-only property should generate a warning';
    11 printBugNumber(BUGNUMBER);
    12 printStatus (summary);
    14 enterFunc (String (BUGNUMBER));
    16 // should throw an error in strict mode
    17 var actual = '';
    18 var expect = '"length" is read-only';
    19 var status = summary + ': Throw if STRICT and WERROR is enabled';
    21 if (!options().match(/strict/))
    22 {
    23   options('strict');
    24 }
    25 if (!options().match(/werror/))
    26 {
    27   options('werror');
    28 }
    30 try
    31 {
    32   var s = new String ('abc');
    33   s.length = 0;
    34 }
    35 catch (e)
    36 {
    37   actual = e.message;
    38 }
    40 reportCompare(expect, actual, status);
    42 // should not throw an error if in strict mode and WERROR is false
    44 actual = 'did not throw';
    45 expect = 'did not throw';
    46 var status = summary + ': Do not throw if STRICT is enabled and WERROR is disabled';
    48 // toggle werror off
    49 options('werror');
    51 try
    52 {
    53   s.length = 0;
    54 }
    55 catch (e)
    56 {
    57   actual = e.message;
    58 }
    60 reportCompare(expect, actual, status);
    62 // should not throw an error if not in strict mode
    64 actual = 'did not throw';
    65 expect = 'did not throw';
    66 var status = summary + ': Do not throw if not in strict mode';
    68 // toggle strict off
    69 options('strict');
    71 try
    72 {
    73   s.length = 0;
    74 }
    75 catch (e)
    76 {
    77   actual = e.message;
    78 }
    80 reportCompare(expect, actual, status);

mercurial