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: boolean-001.js
9 Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js
11 15.6.4.3 Boolean.prototype.valueOf()
12 Returns this boolean value.
14 The valueOf function is not generic; it generates
15 a runtime error if its this value is not a Boolean
16 object. Therefore it cannot be transferred to other
17 kinds of objects for use as a method.
19 Author: christine@netscape.com
20 Date: 09 september 1998
21 */
22 var SECTION = "boolean-002.js";
23 var VERSION = "JS1_4";
24 var TITLE = "Boolean.prototype.valueOf()";
25 startTest();
26 writeHeaderToLog( SECTION +" "+ TITLE );
29 var exception = "No exception thrown";
30 var result = "Failed";
32 var VALUE_OF = Boolean.prototype.valueOf;
34 try {
35 var s = new String("Not a Boolean");
36 s.valueOf = VALUE_0F;
37 s.valueOf();
38 } catch ( e ) {
39 result = "Passed!";
40 exception = e.toString();
41 }
43 new TestCase(
44 SECTION,
45 "Assigning Boolean.prototype.valueOf to a String object "+
46 "(threw " +exception +")",
47 "Passed!",
48 result );
50 test();