Wed, 31 Dec 2014 06:09:35 +0100
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/. */
7 /**
8 File Name: regexparg-1.js
9 Description:
11 Regression test for
12 http://scopus/bugsplat/show_bug.cgi?id=122787
13 Passing a regular expression as the first constructor argument fails
15 Author: christine@netscape.com
16 Date: 15 June 1998
17 */
19 var SECTION = "JS_1.2";
20 var VERSION = "JS_1.2";
21 startTest();
22 var TITLE = "The variable statement";
24 writeHeaderToLog( SECTION + " "+ TITLE);
26 print("Note: Bug 61911 changed the behavior of typeof regexp in Gecko 1.9.");
27 print("Prior to Gecko 1.9, typeof regexp returned 'function'.");
28 print("However in Gecko 1.9 and later, typeof regexp will return 'object'.");
30 function f(x) {return x;}
32 x = f(/abc/);
34 new TestCase( SECTION,
35 "function f(x) {return x;}; f()",
36 void 0,
37 f() );
39 new TestCase( SECTION,
40 "f(\"hi\")",
41 "hi",
42 f("hi") );
44 new TestCase( SECTION,
45 "new f(/abc/) +''",
46 "/abc/",
47 new f(/abc/) +"" );
49 new TestCase( SECTION,
50 "f(/abc/)+'')",
51 "/abc/",
52 f(/abc/) +'');
54 new TestCase( SECTION,
55 "typeof f(/abc/)",
56 "object",
57 typeof f(/abc/) );
59 new TestCase( SECTION,
60 "typeof new f(/abc/)",
61 "object",
62 typeof new f(/abc/) );
64 new TestCase( SECTION,
65 "x = new f(/abc/); x.exec(\"hi\")",
66 null,
67 x.exec("hi") );
70 // js> x()
71 test();