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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | File Name: 15.5.4.js |
michael@0 | 9 | ECMA Section: 15.5.4 Properties of the String prototype object |
michael@0 | 10 | |
michael@0 | 11 | Description: |
michael@0 | 12 | Author: christine@netscape.com |
michael@0 | 13 | Date: 28 october 1997 |
michael@0 | 14 | |
michael@0 | 15 | */ |
michael@0 | 16 | var SECTION = "15.5.4"; |
michael@0 | 17 | var VERSION = "ECMA_1"; |
michael@0 | 18 | startTest(); |
michael@0 | 19 | var TITLE = "Properties of the String Prototype objecta"; |
michael@0 | 20 | |
michael@0 | 21 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | new TestCase( SECTION, |
michael@0 | 25 | "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()", |
michael@0 | 26 | "[object String]", |
michael@0 | 27 | eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") ); |
michael@0 | 28 | |
michael@0 | 29 | delete String.prototype.getClass; |
michael@0 | 30 | |
michael@0 | 31 | new TestCase( SECTION, |
michael@0 | 32 | "typeof String.prototype", |
michael@0 | 33 | "object", |
michael@0 | 34 | typeof String.prototype ); |
michael@0 | 35 | |
michael@0 | 36 | new TestCase( SECTION, |
michael@0 | 37 | "String.prototype.valueOf()", |
michael@0 | 38 | "", |
michael@0 | 39 | String.prototype.valueOf() ); |
michael@0 | 40 | |
michael@0 | 41 | new TestCase( SECTION, |
michael@0 | 42 | "String.prototype +''", |
michael@0 | 43 | "", |
michael@0 | 44 | String.prototype + '' ); |
michael@0 | 45 | |
michael@0 | 46 | new TestCase( SECTION, |
michael@0 | 47 | "String.prototype.length", |
michael@0 | 48 | 0, |
michael@0 | 49 | String.prototype.length ); |
michael@0 | 50 | |
michael@0 | 51 | var prop; |
michael@0 | 52 | var value; |
michael@0 | 53 | |
michael@0 | 54 | value = ''; |
michael@0 | 55 | for (prop in "") |
michael@0 | 56 | { |
michael@0 | 57 | value += prop; |
michael@0 | 58 | } |
michael@0 | 59 | new TestCase( SECTION, |
michael@0 | 60 | 'String "" has no enumerable properties', |
michael@0 | 61 | '', |
michael@0 | 62 | value ); |
michael@0 | 63 | |
michael@0 | 64 | value = ''; |
michael@0 | 65 | for (prop in String.prototype) |
michael@0 | 66 | { |
michael@0 | 67 | value += prop; |
michael@0 | 68 | } |
michael@0 | 69 | new TestCase( SECTION, |
michael@0 | 70 | 'String.prototype has no enumerable properties', |
michael@0 | 71 | '', |
michael@0 | 72 | value ); |
michael@0 | 73 | |
michael@0 | 74 | test(); |