diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/js1_5/Object | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_5/Object')
-rw-r--r-- | js/src/tests/js1_5/Object/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-137000.js | 206 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-192105.js | 149 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-308806-01.js | 20 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-338709.js | 74 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-362872-01.js | 41 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-362872-02.js | 24 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-382503.js | 29 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-382532.js | 36 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-465476.js | 63 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/regress-90596-003.js | 278 | ||||
-rw-r--r-- | js/src/tests/js1_5/Object/shell.js | 0 |
12 files changed, 920 insertions, 0 deletions
diff --git a/js/src/tests/js1_5/Object/browser.js b/js/src/tests/js1_5/Object/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_5/Object/browser.js diff --git a/js/src/tests/js1_5/Object/regress-137000.js b/js/src/tests/js1_5/Object/regress-137000.js new file mode 100644 index 000000000..8598a264d --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-137000.js @@ -0,0 +1,206 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 03 June 2002 + * SUMMARY: Function param or local var with same name as a function property + * + * See http://bugzilla.mozilla.org/show_bug.cgi?id=137000 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=138708 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=150032 + * See http://bugzilla.mozilla.org/show_bug.cgi?id=150859 + * + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 137000; +var summary = 'Function param or local var with same name as a function prop'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * Note use of 'x' both for the parameter to f, + * and as a property name for |f| as an object + */ +function f(x) +{ +} + +status = inSection(1); +f.x = 12; +actual = f.x; +expect = 12; +addThis(); + + + +/* + * A more elaborate example, using the call() method + * to chain constructors from child to parent. + * + * The key point is the use of the same name 'p' for both + * the parameter to the constructor, and as a property name + */ +function parentObject(p) +{ + this.p = 1; +} + +function childObject() +{ + parentObject.call(this); +} +childObject.prototype = parentObject; + +status = inSection(2); +var objParent = new parentObject(); +actual = objParent.p; +expect = 1; +addThis(); + +status = inSection(3); +var objChild = new childObject(); +actual = objChild.p; +expect = 1; +addThis(); + + + +/* + * A similar set-up. Here the same name is being used for + * the parameter to both the Base and Child constructors, + */ +function Base(id) +{ +} + +function Child(id) +{ + this.prop = id; +} +Child.prototype=Base; + +status = inSection(4); +var c1 = new Child('child1'); +actual = c1.prop; +expect = 'child1'; +addThis(); + + + +/* + * Use same identifier as a property name, too - + */ +function BaseX(id) +{ +} + +function ChildX(id) +{ + this.id = id; +} +ChildX.prototype=BaseX; + +status = inSection(5); +c1 = new ChildX('child1'); +actual = c1.id; +expect = 'child1'; +addThis(); + + + +/* + * From http://bugzilla.mozilla.org/show_bug.cgi?id=150032 + * + * Here the same name is being used both for a local variable + * declared in g(), and as a property name for |g| as an object + */ +function g() +{ + var propA = g.propA; + var propB = g.propC; + + this.getVarA = function() {return propA;} + this.getVarB = function() {return propB;} +} +g.propA = 'A'; +g.propB = 'B'; +g.propC = 'C'; +var obj = new g(); + +status = inSection(6); +actual = obj.getVarA(); // this one was returning 'undefined' +expect = 'A'; +addThis(); + +status = inSection(7); +actual = obj.getVarB(); // this one is easy; it never failed +expect = 'C'; +addThis(); + + + +/* + * By martin.honnen@gmx.de + * From http://bugzilla.mozilla.org/show_bug.cgi?id=150859 + * + * Here the same name is being used for a local var in F + * and as a property name for |F| as an object + * + * Twist: the property is added via another function. + */ +function setFProperty(val) +{ + F.propA = val; +} + +function F() +{ + var propA = 'Local variable in F'; +} + +status = inSection(8); +setFProperty('Hello'); +actual = F.propA; // this was returning 'undefined' +expect = 'Hello'; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Object/regress-192105.js b/js/src/tests/js1_5/Object/regress-192105.js new file mode 100644 index 000000000..3673b256d --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-192105.js @@ -0,0 +1,149 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 06 February 2003 + * SUMMARY: Using |instanceof| to check if function is called as a constructor + * + * See http://bugzilla.mozilla.org/show_bug.cgi?id=192105 + * + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 192105; +var summary = 'Using |instanceof| to check if f() is called as constructor'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +/* + * This function is the heart of the test. It sets the result + * variable |actual|, which we will compare against |expect|. + * + * Note |actual| will be set to |true| or |false| according + * to whether or not this function is called as a constructor; + * i.e. whether it is called via the |new| keyword or not - + */ +function f() +{ + actual = (this instanceof f); +} + + +/* + * Call f as a constructor from global scope + */ +status = inSection(1); +new f(); // sets |actual| +expect = true; +addThis(); + +/* + * Now, not as a constructor + */ +status = inSection(2); +f(); // sets |actual| +expect = false; +addThis(); + + +/* + * Call f as a constructor from function scope + */ +function F() +{ + new f(); +} +status = inSection(3); +F(); // sets |actual| +expect = true; +addThis(); + +/* + * Now, not as a constructor + */ +function G() +{ + f(); +} +status = inSection(4); +G(); // sets |actual| +expect = false; +addThis(); + + +/* + * Now make F() and G() methods of an object + */ +var obj = {F:F, G:G}; +status = inSection(5); +obj.F(); // sets |actual| +expect = true; +addThis(); + +status = inSection(6); +obj.G(); // sets |actual| +expect = false; +addThis(); + + +/* + * Now call F() and G() from yet other functions, and use eval() + */ +function A() +{ + eval('F();'); +} +status = inSection(7); +A(); // sets |actual| +expect = true; +addThis(); + + +function B() +{ + eval('G();'); +} +status = inSection(8); +B(); // sets |actual| +expect = false; +addThis(); + + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Object/regress-308806-01.js b/js/src/tests/js1_5/Object/regress-308806-01.js new file mode 100644 index 000000000..8e0a66839 --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-308806-01.js @@ -0,0 +1,20 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 308806; +var summary = 'Object.prototype.toLocaleString() should track Object.prototype.toString() '; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +var o = {toString: function() { return 'foo'; }}; + +expect = o.toString(); +actual = o.toLocaleString(); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_5/Object/regress-338709.js b/js/src/tests/js1_5/Object/regress-338709.js new file mode 100644 index 000000000..ca82e7fbc --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-338709.js @@ -0,0 +1,74 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 338709; +var summary = 'ReadOnly properties should not be overwritten by using ' + + 'Object and try..throw..catch'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +Object = function () { return Math }; +expect = Math.LN2; +try +{ + throw 1990; +} +catch (LN2) +{ +} +actual = Math.LN2; +print("Math.LN2 = " + Math.LN2) + reportCompare(expect, actual, summary); + +var s = new String("abc"); +Object = function () { return s }; +expect = s.length; +try +{ + throw -8 + } +catch (length) +{ +} +actual = s.length; +print("length of '" + s + "' = " + s.length) + reportCompare(expect, actual, summary); + +var re = /xy/m; +Object = function () { return re }; +expect = re.multiline; +try +{ + throw false + } +catch (multiline) +{ +} +actual = re.multiline; +print("re.multiline = " + re.multiline) + reportCompare(expect, actual, summary); + +if ("document" in this) { + // Let the document be its own documentElement. + Object = function () { return document } + expect = document.documentElement + ''; + try + { + throw document; + } + catch (documentElement) + { + } + actual = document.documentElement + ''; + print("document.documentElement = " + document.documentElement) + } +else + Object = this.constructor + + reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_5/Object/regress-362872-01.js b/js/src/tests/js1_5/Object/regress-362872-01.js new file mode 100644 index 000000000..0808ee82b --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-362872-01.js @@ -0,0 +1,41 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 362872; +var summary = 'script should not drop watchpoint that is in use'; +var actual = 'No Crash'; +var expect = 'No Crash'; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + function exploit() { + var rooter = {}, object = {}, filler1 = "", filler2 = "\u5555"; + for(var i = 0; i < 32/2-2; i++) { filler1 += "\u5050"; } + object.watch("foo", function(){ + object.unwatch("foo"); + object.unwatch("foo"); + for(var i = 0; i < 8 * 1024; i++) { + rooter[i] = filler1 + filler2; + } + }); + object.foo = "bar"; + } + exploit(); + + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Object/regress-362872-02.js b/js/src/tests/js1_5/Object/regress-362872-02.js new file mode 100644 index 000000000..edee43a4a --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-362872-02.js @@ -0,0 +1,24 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + * Contributor: Blake Kaplan + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 362872; +var summary = 'script should not drop watchpoint that is in use'; +var actual = 'No Crash'; +var expect = 'No Crash'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +this.watch('x', function f() { + print("before"); + x = 3; + print("after"); + }); +x = 3; + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_5/Object/regress-382503.js b/js/src/tests/js1_5/Object/regress-382503.js new file mode 100644 index 000000000..373b45f6e --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-382503.js @@ -0,0 +1,29 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 382503; +var summary = 'Do not assert: with prototype=regexp'; +var actual = ''; +var expect = ''; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +function f(x) +{ + prototype = /a/; + + if (x) { + return /b/; + return /c/; + } else { + return /d/; + } +} + +void f(false); + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_5/Object/regress-382532.js b/js/src/tests/js1_5/Object/regress-382532.js new file mode 100644 index 000000000..10e43f385 --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-382532.js @@ -0,0 +1,36 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 382532; +var summary = 'instanceof,... broken by use of |prototype| in heavyweight constructor'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var prototype; + + function Bug() { + var func = function () { x; }; + prototype; + } + + expect = true; + actual = (new Bug instanceof Bug); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Object/regress-465476.js b/js/src/tests/js1_5/Object/regress-465476.js new file mode 100644 index 000000000..f089f5ac0 --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-465476.js @@ -0,0 +1,63 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 465476; +var summary = '"-0" and "0" are distinct properties.'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + var x = { "0": 3, "-0": 7 }; + + expect = actual = 'No Exception'; + + try + { + if (!("0" in x)) + throw "0 not in x"; + if (!("-0" in x)) + throw "-0 not in x"; + delete x[0]; + if ("0" in x) + throw "0 in x after delete"; + if (!("-0" in x)) + throw "-0 removed from x after unassociated delete"; + delete x["-0"]; + if ("-0" in x) + throw "-0 in x after delete"; + x[0] = 3; + if (!("0" in x)) + throw "0 not in x after insertion of 0 property"; + if ("-0" in x) + throw "-0 in x after insertion of 0 property"; + x["-0"] = 7; + if (!("-0" in x)) + throw "-0 not in x after reinsertion"; + + var props = []; + for (var i in x) + props.push(i); + if (props.length !== 2) + throw "not all props found!"; + } + catch(ex) + { + actual = ex + ''; + } + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Object/regress-90596-003.js b/js/src/tests/js1_5/Object/regress-90596-003.js new file mode 100644 index 000000000..9404a8b1b --- /dev/null +++ b/js/src/tests/js1_5/Object/regress-90596-003.js @@ -0,0 +1,278 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Date: 28 August 2001 + * + * SUMMARY: A [DontEnum] prop, if overridden, should appear in for-in loops. + * See http://bugzilla.mozilla.org/show_bug.cgi?id=90596 + * + * NOTE: some inefficiencies in the test are made for the sake of readability. + * For example, we quote string values like "Hi" in lines like this: + * + * actual = enumerateThis(obj); + * expect = '{prop:"Hi"}'; + * + * But enumerateThis(obj) gets literal value Hi for obj.prop, not + * literal "Hi". We take care of all these details in the + * compactThis(), sortThis() functions. Sorting properties + * alphabetically is necessary for the test to work in Rhino. + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 90596; +var summary = '[DontEnum] props (if overridden) should appear in for-in loops'; +var cnCOMMA = ','; +var cnCOLON = ':'; +var cnLBRACE = '{'; +var cnRBRACE = '}'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; +var obj = {}; + + +status = inSection(1); +obj = {toString:9}; +actual = enumerateThis(obj); +expect = '{toString:9}'; +addThis(); + +status = inSection(2); +obj = {hasOwnProperty:"Hi"}; +actual = enumerateThis(obj); +expect = '{hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(3); +obj = {toString:9, hasOwnProperty:"Hi"}; +actual = enumerateThis(obj); +expect = '{toString:9, hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(4); +obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}; +actual = enumerateThis(obj); +expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}'; +addThis(); + + +// TRY THE SAME THING IN EVAL CODE +var s = ''; + +status = inSection(5); +s = 'obj = {toString:9}'; +eval(s); +actual = enumerateThis(obj); +expect = '{toString:9}'; +addThis(); + +status = inSection(6); +s = 'obj = {hasOwnProperty:"Hi"}'; +eval(s); +actual = enumerateThis(obj); +expect = '{hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(7); +s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = enumerateThis(obj); +expect = '{toString:9, hasOwnProperty:"Hi"}'; +addThis(); + +status = inSection(8); +s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; +eval(s); +actual = enumerateThis(obj); +expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}'; +addThis(); + + +// TRY THE SAME THING IN FUNCTION CODE +function A() +{ + status = inSection(9); + var s = 'obj = {toString:9}'; + eval(s); + actual = enumerateThis(obj); + expect = '{toString:9}'; + addThis(); +} +A(); + +function B() +{ + status = inSection(10); + var s = 'obj = {hasOwnProperty:"Hi"}'; + eval(s); + actual = enumerateThis(obj); + expect = '{hasOwnProperty:"Hi"}'; + addThis(); +} +B(); + +function C() +{ + status = inSection(11); + var s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = enumerateThis(obj); + expect = '{toString:9, hasOwnProperty:"Hi"}'; + addThis(); +} +C(); + +function D() +{ + status = inSection(12); + var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; + eval(s); + actual = enumerateThis(obj); + expect = '{prop1:1, toString:9, hasOwnProperty:"Hi"}'; + addThis(); +} +D(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function enumerateThis(obj) +{ + var arr = new Array(); + + for (var prop in obj) + { + arr.push(prop + cnCOLON + obj[prop]); + } + + var ret = addBraces(String(arr)); + return ret; +} + + +function addBraces(text) +{ + return cnLBRACE + text + cnRBRACE; +} + + +/* + * Sort properties alphabetically so the test will work in Rhino + */ +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = sortThis(actual); + expectedvalues[UBound] = sortThis(expect); + UBound++; +} + + +/* + * Takes a string of the form '{"c", "b", "a", 2}' and returns '{2,a,b,c}' + */ +function sortThis(sList) +{ + sList = compactThis(sList); + sList = stripBraces(sList); + var arr = sList.split(cnCOMMA); + arr = arr.sort(); + var ret = String(arr); + ret = addBraces(ret); + return ret; +} + + +/* + * Strips out any whitespace or quotes from the text - + */ +function compactThis(text) +{ + var charCode = 0; + var ret = ''; + + for (var i=0; i<text.length; i++) + { + charCode = text.charCodeAt(i); + + if (!isWhiteSpace(charCode) && !isQuote(charCode)) + ret += text.charAt(i); + } + + return ret; +} + + +function isWhiteSpace(charCode) +{ + switch (charCode) + { + case (0x0009): + case (0x000B): + case (0x000C): + case (0x0020): + case (0x000A): // '\n' + case (0x000D): // '\r' + return true; + break; + + default: + return false; + } +} + + +function isQuote(charCode) +{ + switch (charCode) + { + case (0x0027): // single quote + case (0x0022): // double quote + return true; + break; + + default: + return false; + } +} + + +/* + * strips off braces at beginning and end of text - + */ +function stripBraces(text) +{ + // remember to escape the braces... + var arr = text.match(/^\{(.*)\}$/); + + // defend against a null match... + if (arr != null && arr[1] != null) + return arr[1]; + return text; +} + + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Object/shell.js b/js/src/tests/js1_5/Object/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_5/Object/shell.js |