js/src/tests/ecma_3/Operators/order-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 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 433672;
     8 var summary = 'operator evaluation order';
     9 var actual = '';
    10 var expect = '';
    12 function makeObject(label) 
    13 {
    14   var o = (function (){});
    16   o.label    = label;
    17   o.valueOf  = (function() { actual += this.label + ' valueOf, ';  return Object.prototype.valueOf.call(this); });
    18   o.toString = (function() { actual += this.label + ' toString, '; return Object.prototype.toString.call(this); });
    20   return o;
    21 }
    23 operators = [
    24   {section: '11.5.1', operator: '*'},
    25   {section: '11.5.2', operator: '/'},
    26   {section: '11.5.3', operator: '%'},
    27   {section: '11.6.1', operator: '+'},
    28   {section: '11.6.2', operator: '-'},
    29   {section: '11.7.1', operator: '<<'},
    30   {section: '11.7.2', operator: '>>'},
    31   {section: '11.7.3', operator: '>>>'},
    32   {section: '11.8.1', operator: '<'},
    33   {section: '11.8.2', operator: '>'},
    34   {section: '11.8.3', operator: '<='},
    35   {section: '11.8.4', operator: '>='},
    36   {section: '11.10', operator: '&'},
    37   {section: '11.10', operator: '^'},
    38   {section: '11.10', operator: '|'},
    39   {section: '11.13.2', operator: '*='},
    40   {section: '11.13.2', operator: '/='},
    41   {section: '11.13.2', operator: '%='},
    42   {section: '11.13.2', operator: '+='},
    43   {section: '11.13.2', operator: '<<='},
    44   {section: '11.13.2', operator: '>>='},
    45   {section: '11.13.2', operator: '>>>='},
    46   {section: '11.13.2', operator: '&='},
    47   {section: '11.13.2', operator: '^='},
    48   {section: '11.13.2', operator: '|='},
    49   ];
    51 //-----------------------------------------------------------------------------
    52 test();
    53 //-----------------------------------------------------------------------------
    55 function test()
    56 {
    57   enterFunc ('test');
    58   printBugNumber(BUGNUMBER);
    59   printStatus (summary);
    61   for (var i = 0; i < operators.length; i++)
    62   {
    63     expect = 'left valueOf, left toString, right valueOf, right toString, ';
    64     actual = '';
    66     var left  = makeObject('left');
    67     var right = makeObject('right');
    69     eval('left ' + operators[i].operator + ' right');
    71     reportCompare(expect, actual, summary + ': ' + operators[i].section + ' ' + operators[i].operator);
    72   }
    74   exitFunc ('test');
    75 }

mercurial