js/src/tests/js1_5/Regress/regress-172699.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  *
     8  * Date:    07 Oct 2002
     9  * SUMMARY: UTF-8 decoder should not accept overlong sequences
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=172699
    11  *
    12  */
    13 //-----------------------------------------------------------------------------
    14 var UBound = 0;
    15 var BUGNUMBER = 172699;
    16 var summary = 'UTF-8 decoder should not accept overlong sequences';
    17 var status = '';
    18 var statusitems = [];
    19 var actual = '';
    20 var actualvalues = [];
    21 var expect= '';
    22 var expectedvalues = [];
    25 status = inSection(1);
    26 expect = "URIError thrown";
    27 try
    28 {
    29   decodeURI("%C0%AF");
    30   actual = "no error thrown";
    31 }
    32 catch (e)
    33 {
    34   if (e instanceof URIError)
    35     actual = "URIError thrown";
    36   else if (e instanceof Error)
    37     actual = "wrong error thrown: " + e.name;
    38   else
    39     actual = "non-error thrown: " + e;
    40 }
    41 addThis();
    45 //-----------------------------------------------------------------------------
    46 test();
    47 //-----------------------------------------------------------------------------
    51 function addThis()
    52 {
    53   statusitems[UBound] = status;
    54   actualvalues[UBound] = actual;
    55   expectedvalues[UBound] = expect;
    56   UBound++;
    57 }
    60 function test()
    61 {
    62   enterFunc('test');
    63   printBugNumber(BUGNUMBER);
    64   printStatus(summary);
    66   for (var i=0; i<UBound; i++)
    67   {
    68     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    69   }
    71   exitFunc ('test');
    72 }

mercurial