js/src/tests/js1_5/Object/regress-338709.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 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 338709;
     8 var summary = 'ReadOnly properties should not be overwritten by using ' +
     9   'Object and try..throw..catch';
    10 var actual = '';
    11 var expect = '';
    13 printBugNumber(BUGNUMBER);
    14 printStatus (summary);
    16 Object = function () { return Math };
    17 expect = Math.LN2;
    18 try
    19 {
    20   throw 1990;
    21 }
    22 catch (LN2)
    23 {
    24 }
    25 actual = Math.LN2;
    26 print("Math.LN2 = " + Math.LN2)
    27   reportCompare(expect, actual, summary);
    29 var s = new String("abc");
    30 Object = function () { return s };
    31 expect = s.length;
    32 try
    33 {
    34   throw -8
    35     }
    36 catch (length)
    37 {
    38 }
    39 actual = s.length;
    40 print("length of '" + s + "' = " + s.length)
    41   reportCompare(expect, actual, summary);
    43 var re = /xy/m;
    44 Object = function () { return re };
    45 expect = re.multiline;
    46 try
    47 {
    48   throw false
    49     }
    50 catch (multiline)
    51 {
    52 }
    53 actual = re.multiline;
    54 print("re.multiline = " + re.multiline)
    55   reportCompare(expect, actual, summary);
    57 if ("document" in this) {
    58   // Let the document be its own documentElement.
    59   Object = function () { return document }
    60   expect = document.documentElement + '';
    61   try
    62   {
    63     throw document;
    64   }
    65   catch (documentElement)
    66   {
    67   }
    68   actual = document.documentElement + '';
    69   print("document.documentElement = " + document.documentElement)
    70     }
    71 else
    72   Object = this.constructor
    74     reportCompare(expect, actual, summary);

mercurial