js/src/tests/js1_5/extensions/regress-231518.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 = 231518;
     8 var summary = 'decompiler must quote keywords and non-identifier property names';
     9 var actual = '';
    10 var expect = 'no error';
    11 var status;
    12 var object;
    13 var result;
    15 printBugNumber(BUGNUMBER);
    16 printStatus (summary);
    19 if (typeof uneval != 'undefined')
    20 {
    21   status = inSection(1) + ' eval(uneval({"if": false}))';
    23   try
    24   {
    25     object = {'if': false };
    26     result = uneval(object);
    27     printStatus('uneval returns ' + result);
    28     eval(result);
    29     actual = 'no error';
    30   }
    31   catch(e)
    32   {
    33     actual = 'error';
    34   }
    36   reportCompare(expect, actual, status);
    38   status = inSection(2) + ' eval(uneval({"if": "then"}))';
    40   try
    41   {
    42     object = {'if': "then" };
    43     result = uneval(object);
    44     printStatus('uneval returns ' + result);
    45     eval(result);
    46     actual = 'no error';
    47   }
    48   catch(e)
    49   {
    50     actual = 'error';
    51   }
    53   reportCompare(expect, actual, status);
    55   status = inSection(3) + ' eval(uneval(f))';
    57   try
    58   {
    59     result = uneval(f);
    60     printStatus('uneval returns ' + result);
    61     eval(result);
    62     actual = 'no error';
    63   }
    64   catch(e)
    65   {
    66     actual = 'error';
    67   }
    69   reportCompare(expect, actual, status);
    71   status = inSection(2) + ' eval(uneval(g))';
    73   try
    74   {
    75     result = uneval(g);
    76     printStatus('uneval returns ' + result);
    77     eval(result);
    78     actual = 'no error';
    79   }
    80   catch(e)
    81   {
    82     actual = 'error';
    83   }
    85   reportCompare(expect, actual, status);
    86 }
    88 function f()
    89 {
    90   var obj = new Object();
    92   obj['name']      = 'Just a name';
    93   obj['if']        = false;
    94   obj['some text'] = 'correct';
    95 }
    97 function g()
    98 {
    99   return {'if': "then"};
   100 }

mercurial