js/src/tests/js1_5/GetSet/getset-002.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: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     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 var t = {   
     8   _y: "<initial y>",
    10   get y()
    11   {
    12     var rv;
    13     if (typeof this._y == "string")
    14       rv = "got " + this._y;
    15     else
    16       rv = this._y;
    18     return rv;
    19   },
    21   set y(newVal)
    22   {
    23     this._y = newVal;
    24   }
    25 }
    28   test(t);
    30 function test(t)
    31 {
    32   enterFunc ("test");
    34   printStatus ("Basic Getter/ Setter test (object literal notation)");
    36   reportCompare ("<initial y>", t._y, "y prototype check");
    38   reportCompare ("got <initial y>", t.y, "y getter, before set");
    40   t.y = "new y";
    41   reportCompare ("got new y", t.y, "y getter, after set");
    43   t.y = 2;
    44   reportCompare (2, t.y, "y getter, after numeric set");
    46   var d = new Date();
    47   t.y = d;
    48   reportCompare (d, t.y, "y getter, after date set");
    50 }       

mercurial