JavaScript Test - Skip test if Script object not defined, bug 355820

This commit is contained in:
bclary%bclary.com 2007-02-15 08:38:15 +00:00
Родитель 2c29f8d36d
Коммит 6a2bc1186a
16 изменённых файлов: 4 добавлений и 1191 удалений

Просмотреть файл

@ -1,161 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
File Name: script-001.js
Section:
Description: new NativeScript object
js> parseInt(123,"hi")
123
js> parseInt(123, "blah")
123
js> s
js: s is not defined
js> s = new Script
undefined;
js> s = new Script()
undefined;
js> s.getJSClass
js> s.getJSClass = Object.prototype.toString
function toString() {
[native code]
}
js> s.getJSClass()
[object Script]
js> s.compile( "return 3+4" )
js: JavaScript exception: javax.javascript.EvaluatorException: "<Scr
js> s.compile( "3+4" )
3 + 4;
js> typeof s
function
js> s()
Jit failure!
invalid opcode: 1
Jit Pass1 Failure!
javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V
An internal JIT error has occurred. Please report this with .class
jit-bugs@itools.symantec.com
7
js> s.compile("3+4")
3 + 4;
js> s()
Jit failure!
invalid opcode: 1
Jit Pass1 Failure!
javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V
An internal JIT error has occurred. Please report this with .class
jit-bugs@itools.symantec.com
7
js> quit()
C:\src\ns_priv\js\tests\ecma>shell
C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope;
:\src\ns_priv\js\tests javax.javascript.examples.Shell
Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2
Copyright (C) 1996-97 Symantec Corporation
js> s = new Script("3+4")
3 + 4;
js> s()
7
js> s2 = new Script();
undefined;
js> s.compile( "3+4")
3 + 4;
js> s()
Jit failure!
invalid opcode: 1
Jit Pass1 Failure!
javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V
An internal JIT error has occurred. Please report this with .class
jit-bugs@itools.symantec.com
7
js> quit()
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "script-001";
var VERSION = "JS1_3";
var TITLE = "NativeScript";
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
var s = new Script();
s.getJSClass = Object.prototype.toString;
new TestCase( SECTION,
"var s = new Script(); typeof s",
"function",
typeof s );
new TestCase( SECTION,
"s.getJSClass()",
"[object Script]",
s.getJSClass() );
test();

Просмотреть файл

@ -1,165 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corp.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* igor@fastmail.fm, PhilSchwartau@aol.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****
*
*
* Date: 15 Nov 2003
* SUMMARY: Stressing the byte code generator
*
* See http://bugzilla.mozilla.org/show_bug.cgi?id=225831
*
*/
//-----------------------------------------------------------------------------
var UBound = 0;
var bug = 225831;
var summary = 'Stressing the byte code generator';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
function f() { return {x: 0}; }
var N = 300;
var a = new Array(N + 1);
a[N] = 10;
a[0] = 100;
status = inSection(1);
// build string of the form ++(a[++f().x + ++f().x + ... + ++f().x]) which
// gives ++a[N]
var str = "".concat("++(a[", repeat_str("++f().x + ", (N - 1)), "++f().x])");
// Use Script constructor instead of simple eval to test Rhino optimizer mode
// because in Rhino, eval always uses interpreted mode.
var script = new Script(str);
script();
actual = a[N];
expect = 11;
addThis();
status = inSection(2);
// build string of the form (a[f().x-- + f().x-- + ... + f().x--])--
// which should give (a[0])--
str = "".concat("(a[", repeat_str("f().x-- + ", (N - 1)), "f().x--])--");
script = new Script(str);
script();
actual = a[0];
expect = 99;
addThis();
status = inSection(3);
// build string of the form [[1], [1], ..., [1]]
str = "".concat("[", repeat_str("[1], ", (N - 1)), "[1]]");
script = new Script(str);
script();
actual = uneval(script());
expect = str;
addThis();
status = inSection(4);
// build string of the form ({1:{a:1}, 2:{a:1}, ... N:{a:1}})
str = function() {
var arr = new Array(N+1);
arr[0] = "({";
for (var i = 1; i < N; ++i) {
arr[i] = i+":{a:1}, ";
}
arr[N] = N+":{a:1}})";
return "".concat.apply("", arr);
}();
script = new Script(str);
script();
actual = uneval(script());
expect = str;
addThis();
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function repeat_str(str, repeat_count)
{
var arr = new Array(--repeat_count);
while (repeat_count != 0)
arr[--repeat_count] = str;
return str.concat.apply(str, arr);
}
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc('test');
printBugNumber(bug);
printStatus(summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -1,170 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corp.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* igor@fastmail.fm, PhilSchwartau@aol.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****
*
*
* Date: 24 Nov 2003
* SUMMARY: Testing for recursion check in js_EmitTree
*
* See http://bugzilla.mozilla.org/show_bug.cgi?id=226507
* Igor's comments:
*
* "For example, with N in the test set to 35, I got on my RedHat
* Linux 10 box a segmentation fault from js after setting the stack limit
* to 100K. When I set the stack limit to 20K I still got the segmentation fault.
* Only after -s was changed to 15K, too-deep recursion was detected:
*
~/w/js/x> ulimit -s
100
~/w/js/x> js fintest.js
Segmentation fault
~/w/js/x> js -S $((20*1024)) fintest.js
Segmentation fault
~/w/js/x> js -S $((15*1024)) fintest.js
fintest.js:19: InternalError: too much recursion
*
* After playing with numbers it seems that while processing try/finally the
* recursion in js_Emit takes 10 times more space the corresponding recursion
* in the parser."
*
*
* Note the use of the new -S option to the JS shell to limit stack size.
* See http://bugzilla.mozilla.org/show_bug.cgi?id=225061. This in turn
* can be passed to the JS shell by the test driver's -o option, as in:
*
* perl jsDriver.pl -e smdebug -fTEST.html -o "-S 100" -l js1_5/Regress
*
*/
//-----------------------------------------------------------------------------
var UBound = 0;
var bug = 226507;
var summary = 'Testing for recursion check in js_EmitTree';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
/*
* With stack limit 100K on Linux debug build even N=30 already can cause
* stack overflow; use 35 to trigger it for sure.
*/
var N = 350;
var counter = 0;
function f()
{
++counter;
}
/*
* Example: if N were 3, this is what |source|
* would end up looking like:
*
* try { f(); } finally {
* try { f(); } finally {
* try { f(); } finally {
* f(1,1,1,1);
* }}}
*
*/
var source = "".concat(
repeat_str("try { f(); } finally {\n", N),
"f(",
repeat_str("1,", N),
"1);\n",
repeat_str("}", N));
// Repeat it for additional stress testing
source += source;
/*
* In Rhino, eval() always uses interpreted mode.
* To use compiled mode, use Script.exec() instead.
*/
var script = Script(source);
script();
status = inSection(1);
actual = counter;
expect = (N + 1) * 2;
addThis();
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function repeat_str(str, repeat_count)
{
var arr = new Array(--repeat_count);
while (repeat_count != 0)
arr[--repeat_count] = str;
return str.concat.apply(str, arr);
}
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc('test');
printBugNumber(bug);
printStatus(summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Aleksey Chernoraenko <archer@meta-comm.com>
* Bob Clary <bob@bclary.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 237461;
var summary = 'don\'t crash with nested function collides with var';
var actual = 'Crash';
var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
function g()
{
var core = {};
core.js = {};
core.js.init = function()
{
var loader = null;
function loader() {}
};
return core;
}
var s = new Script(""+g.toString());
try
{
var frozen = s.freeze(); // crash.
printStatus("len:" + frozen.length);
}
catch(e)
{
}
actual = 'No Crash';
reportCompare(expect, actual, summary);

Просмотреть файл

@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): David Baron <dbaron@mozillafoundation.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 291213;
var summary = 'Do not crash in args_resolve enumerating |arguments|';
var actual = 'No Crash';
var expect = 'No Crash';
var scriptCode = "var result = \"\" + arguments; " +
"for (i in arguments) " +
"result += \"\\\n \" + i + \" \" + arguments[i]; result;";
var scripts = {};
scripts["A"] = new Script(scriptCode);
scripts["B"] = (function() {
return new Script(scriptCode);
})();
scripts["C"] = (function() {
function x() { "a"; }
return new Script(scriptCode);
})();
// any Object (window, document, new Array(), ...)
var anyObj = new Object();
scripts["D"] = (function() {
function x() { anyObj; }
return new Script(scriptCode);
})();
var result;
for (var i in scripts) {
try { result = scripts[i].exec(); }
catch (e) { result = e; }
printStatus(i + ") " + result);
}
reportCompare(expect, actual, summary);

Просмотреть файл

@ -1,67 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): shutdown
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 355982;
var summary = 'Script("") should not fail';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
expect = 'No Error';
actual = 'No Error';
try
{
Script('');
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -1,134 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corp.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* igor@fastmail.fm, pschwartau@netscape.com
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK *****
*
*
* Date: 29 Sep 2003
* SUMMARY: Testing __parent__ and __proto__ of Script object
*
* See http://bugzilla.mozilla.org/show_bug.cgi?id=220584
*/
//-----------------------------------------------------------------------------
var UBound = 0;
var bug = 220584;
var summary = 'Testing __parent__ and __proto__ of Script object';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
var s;
// invoke |Script| as a function
s = Script('1;');
status = inSection(1);
actual = s instanceof Object;
expect = true;
addThis();
status = inSection(2);
actual = (s.__parent__ == undefined) || (s.__parent__ == null);
expect = false;
addThis();
status = inSection(3);
actual = (s.__proto__ == undefined) || (s.__proto__ == null);
expect = false;
addThis();
status = inSection(4);
actual = (s + '').length > 0;
expect = true;
addThis();
// invoke |Script| as a constructor
s = new Script('1;');
status = inSection(5);
actual = s instanceof Object;
expect = true;
addThis();
status = inSection(6);
actual = (s.__parent__ == undefined) || (s.__parent__ == null);
expect = false;
addThis();
status = inSection(7);
actual = (s.__proto__ == undefined) || (s.__proto__ == null);
expect = false;
addThis();
status = inSection(8);
actual = (s + '').length > 0;
expect = true;
addThis();
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc('test');
printBugNumber(bug);
printStatus(summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}

Просмотреть файл

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Reto Laemmler
* Brendan Eich
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 354541;
var summary = 'Regression to standard class constructors in case labels';
var actual = '';
var expect = '';
printBugNumber (bug);
printStatus (summary + ': top level');
String.prototype.trim = function() { print('hallo'); };
const S = String;
const Sp = String.prototype;
expect = 'No Error';
actual = 'No Error';
var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; print(String === S); print(String.prototype === Sp); "".trim();');
s();
reportCompare(expect, actual, summary);

Просмотреть файл

@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Reto Laemmler
* Brendan Eich
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 354541;
var summary = 'Regression to standard class constructors in case labels';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary + ': in function');
String.prototype.trim = function() { print('hallo'); };
const S = String;
const Sp = String.prototype;
expect = 'No Error';
actual = 'No Error';
var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; print(String === S); print(String.prototype === Sp); "".trim();');
s();
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Reto Laemmler
* Brendan Eich
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 354541;
var summary = 'Regression to standard class constructors in case labels';
var actual = '';
var expect = '';
printBugNumber (bug);
printStatus (summary + ': top level');
String.prototype.trim = function() { print('hallo'); };
String.prototype.trim = function() { return 'hallo'; };
const S = String;
const Sp = String.prototype;
expect = 'hallo';
var expectStringInvariant = true
var actualStringInvariant;
var expectStringPrototypeInvariant = true;
var actualStringPrototypeInvariant;
var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();');
try
{
s();
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, 'trim() returned');
reportCompare(expectStringInvariant, actualStringInvariant,
'String invariant');
reportCompare(expectStringPrototypeInvariant,
actualStringPrototypeInvariant,
'String.prototype invariant');

Просмотреть файл

@ -1,82 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Reto Laemmler
* Brendan Eich
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 354541;
var summary = 'Regression to standard class constructors in case labels';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary + ': in function');
String.prototype.trim = function() { return 'hallo'; };
const S = String;
const Sp = String.prototype;
expect = 'hallo';
var expectStringInvariant = true;
var actualStringInvariant;
var expectStringPrototypeInvariant = true;
var actualStringPrototypeInvariant;
s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();');
try
{
s();
}
catch(ex)
{
actual = ex + '';
}
reportCompare(expect, actual, 'trim() returned');
reportCompare(expectStringInvariant, actualStringInvariant, 'String invariant');
reportCompare(expectStringPrototypeInvariant,
actualStringPrototypeInvariant,
'String.prototype invariant');
exitFunc ('test');
}

Просмотреть файл

@ -64,7 +64,7 @@ if(typeof(setTimeout) != "undefined") {
function exploit() {
if (typeof Script == 'undefined')
{
print('test skipped. Script not defined');
print('Test skipped. Script not defined.');
}
else
{

Просмотреть файл

@ -65,7 +65,7 @@ if(typeof(setTimeout) != "undefined") {
function exploit() {
if (typeof Script == 'undefined')
{
print('test skipped. Script not defined');
print('Test skipped. Script not defined.');
}
else
{

Просмотреть файл

@ -45,7 +45,7 @@ printStatus (summary);
if (typeof Script == 'undefined')
{
print('Test skipped. Script not defined');
print('Test skipped. Script not defined.');
}
else
{

Просмотреть файл

@ -47,7 +47,7 @@ expect = actual = 'No Crash';
if (typeof Script == 'undefined')
{
print('Test skipped. Script not defined');
print('Test skipped. Script not defined.');
}
else
{

Просмотреть файл

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 352797;
var summary = 'Assertion: OBJ_GET_CLASS(cx, obj) == &js_BlockClass';
var actual = 'No Crash';
var expect = 'No Crash';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber (bug);
printStatus (summary);
(function(){let x = 'fafafa'.replace(/a/g, new Script(''))})();
reportCompare(expect, actual, summary);
exitFunc ('test');
}