js/src/tests/js1_3/extensions/script-001.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial