js/src/tests/js1_3/extensions/script-001.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.

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: script-001.js
michael@0 9 Section:
michael@0 10 Description: new NativeScript object
michael@0 11
michael@0 12
michael@0 13 js> parseInt(123,"hi")
michael@0 14 123
michael@0 15 js> parseInt(123, "blah")
michael@0 16 123
michael@0 17 js> s
michael@0 18 js: s is not defined
michael@0 19 js> s = new Script
michael@0 20
michael@0 21 undefined;
michael@0 22
michael@0 23
michael@0 24 js> s = new Script()
michael@0 25
michael@0 26 undefined;
michael@0 27
michael@0 28
michael@0 29 js> s.getJSClass
michael@0 30 js> s.getJSClass = Object.prototype.toString
michael@0 31 function toString() {
michael@0 32 [native code]
michael@0 33 }
michael@0 34
michael@0 35 js> s.getJSClass()
michael@0 36 [object Script]
michael@0 37 js> s.compile( "return 3+4" )
michael@0 38 js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr
michael@0 39 js> s.compile( "3+4" )
michael@0 40
michael@0 41 3 + 4;
michael@0 42
michael@0 43
michael@0 44 js> typeof s
michael@0 45 function
michael@0 46 js> s()
michael@0 47 Jit failure!
michael@0 48 invalid opcode: 1
michael@0 49 Jit Pass1 Failure!
michael@0 50 javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V
michael@0 51 An internal JIT error has occurred. Please report this with .class
michael@0 52 jit-bugs@itools.symantec.com
michael@0 53
michael@0 54 7
michael@0 55 js> s.compile("3+4")
michael@0 56
michael@0 57 3 + 4;
michael@0 58
michael@0 59
michael@0 60 js> s()
michael@0 61 Jit failure!
michael@0 62 invalid opcode: 1
michael@0 63 Jit Pass1 Failure!
michael@0 64 javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V
michael@0 65 An internal JIT error has occurred. Please report this with .class
michael@0 66 jit-bugs@itools.symantec.com
michael@0 67
michael@0 68 7
michael@0 69 js> quit()
michael@0 70
michael@0 71 C:\src\ns_priv\js\tests\ecma>shell
michael@0 72
michael@0 73 C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope;
michael@0 74 :\src\ns_priv\js\tests javax.javascript.examples.Shell
michael@0 75 Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2
michael@0 76 Copyright (C) 1996-97 Symantec Corporation
michael@0 77
michael@0 78 js> s = new Script("3+4")
michael@0 79
michael@0 80 3 + 4;
michael@0 81
michael@0 82
michael@0 83 js> s()
michael@0 84 7
michael@0 85 js> s2 = new Script();
michael@0 86
michael@0 87 undefined;
michael@0 88
michael@0 89
michael@0 90 js> s.compile( "3+4")
michael@0 91
michael@0 92 3 + 4;
michael@0 93
michael@0 94
michael@0 95 js> s()
michael@0 96 Jit failure!
michael@0 97 invalid opcode: 1
michael@0 98 Jit Pass1 Failure!
michael@0 99 javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V
michael@0 100 An internal JIT error has occurred. Please report this with .class
michael@0 101 jit-bugs@itools.symantec.com
michael@0 102
michael@0 103 7
michael@0 104 js> quit()
michael@0 105 Author: christine@netscape.com
michael@0 106 Date: 12 november 1997
michael@0 107 */
michael@0 108
michael@0 109 var SECTION = "script-001";
michael@0 110 var VERSION = "JS1_3";
michael@0 111 var TITLE = "NativeScript";
michael@0 112
michael@0 113 startTest();
michael@0 114 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 115
michael@0 116 if (typeof Script == 'undefined')
michael@0 117 {
michael@0 118 print('Test skipped. Script not defined.');
michael@0 119 new TestCase( SECTION,
michael@0 120 "var s = new Script(); typeof s",
michael@0 121 "Script not supported, test skipped.",
michael@0 122 "Script not supported, test skipped." );
michael@0 123 }
michael@0 124 else
michael@0 125 {
michael@0 126 var s = new Script();
michael@0 127 s.getJSClass = Object.prototype.toString;
michael@0 128
michael@0 129 new TestCase( SECTION,
michael@0 130 "var s = new Script(); typeof s",
michael@0 131 "function",
michael@0 132 typeof s );
michael@0 133
michael@0 134 new TestCase( SECTION,
michael@0 135 "s.getJSClass()",
michael@0 136 "[object Script]",
michael@0 137 s.getJSClass() );
michael@0 138 }
michael@0 139
michael@0 140 test();

mercurial