Migrate more tests from blink repository.

The stand-alone test driver is changed a bit:
- Don't use the errorMessage list. It is used differently in the embedded driver. There it collects parser errors - instead of failure messages.
- Remove html links in description texts. Some test descriptions print a web reference.

The migrated tests fall into 3 categories:
1. Tests outside fast/js
2. Tests that print FAIL messages (and also expect those) - these tests should be examined later if they make sense at all
3. Tests with html links in the test description

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/20280003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15889 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0826f85a
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test behaviour of JSON reviver function.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Ensure the holder for our array is indeed an array
PASS Array.isArray(currentHolder) is true
PASS currentHolder.length is 5
Ensure that the holder already has all the properties present at the start of filtering
PASS currentHolder[0] is "a value"
PASS currentHolder[1] is "another value"
PASS currentHolder[2] is "and another value"
PASS currentHolder[3] is "to delete"
PASS currentHolder[4] is "extra value"
Ensure the holder for our array is indeed an array
PASS Array.isArray(currentHolder) is true
PASS currentHolder.length is 5
Ensure that we always get the same holder
PASS currentHolder is lastHolder
Ensure that returning undefined has removed the property 0 from the holder during filtering.
FAIL currentHolder.hasOwnProperty(0) should be false. Was true.
Ensure the holder for our array is indeed an array
PASS Array.isArray(currentHolder) is true
PASS currentHolder.length is 5
Ensure that we always get the same holder
PASS currentHolder is lastHolder
Ensure that changing the value of a property is reflected while filtering.
PASS currentHolder[2] is "a replaced value"
Ensure that the changed value is reflected in the arguments passed to the reviver
PASS value is currentHolder[2]
Ensure the holder for our array is indeed an array
PASS Array.isArray(currentHolder) is true
PASS currentHolder.length is 5
Ensure that we always get the same holder
PASS currentHolder is lastHolder
Ensure that we visited a value that we have deleted, and that deletion is reflected while filtering.
PASS currentHolder.hasOwnProperty(3) is false
Ensure that when visiting a deleted property value is undefined
PASS value is undefined.
Ensure the holder for our array is indeed an array
PASS Array.isArray(currentHolder) is true
FAIL currentHolder.length should be 3. Was 4.
Ensure that we always get the same holder
PASS currentHolder is lastHolder
FAIL Did not call reviver for deleted property
Ensure that we created the root holder as specified in ES5
PASS '' in lastHolder is true
PASS result is lastHolder['']
Ensure that a deleted value is revived if the reviver function returns a value
FAIL result.hasOwnProperty(3) should be true. Was false.
Test behaviour of revivor used in conjunction with an object
PASS currentHolder != globalObject is true
Ensure that the holder already has all the properties present at the start of filtering
PASS currentHolder['a property'] is "a value"
PASS currentHolder['another property'] is "another value"
PASS currentHolder['and another property'] is "and another value"
PASS currentHolder['to delete'] is "will be deleted"
PASS currentHolder != globalObject is true
Ensure that we get the same holder object for each property
PASS currentHolder is lastHolder
Ensure that returning undefined has correctly removed the property 'a property' from the holder object
PASS currentHolder.hasOwnProperty('a property') is false
PASS currentHolder != globalObject is true
Ensure that we get the same holder object for each property
PASS currentHolder is lastHolder
Ensure that changing the value of a property is reflected while filtering.
PASS currentHolder['and another property'] is "a replaced value"
Ensure that the changed value is reflected in the arguments passed to the reviver
PASS value is "a replaced value"
Ensure that we created the root holder as specified in ES5
PASS lastHolder.hasOwnProperty('') is true
PASS result.hasOwnProperty('a property') is false
FAIL result.hasOwnProperty('to delete') should be true. Was false.
PASS result is lastHolder['']
Test behaviour of revivor that introduces a cycle
PASS JSON.parse("[0,1]", reviveAddsCycle) threw exception RangeError: Maximum call stack size exceeded.
Test behaviour of revivor that introduces a new array classed object (the result of a regex)
PASS JSON.stringify(JSON.parse("[0,1]", reviveIntroducesNewArrayLikeObject)) is '[0,["a","a"]]'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("Test behaviour of JSON reviver function.")
if (!Array.isArray)
Array.isArray = function(o) { return o.constructor === Array; }
function arrayReviver(i,v) {
if (i != "") {
currentHolder = this;
debug("");
debug("Ensure the holder for our array is indeed an array");
shouldBeTrue("Array.isArray(currentHolder)");
shouldBe("currentHolder.length", "" + expectedLength);
if (i > 0) {
debug("");
debug("Ensure that we always get the same holder");
shouldBe("currentHolder", "lastHolder");
}
switch (Number(i)) {
case 0:
v = undefined;
debug("");
debug("Ensure that the holder already has all the properties present at the start of filtering");
shouldBe("currentHolder[0]", '"a value"');
shouldBe("currentHolder[1]", '"another value"');
shouldBe("currentHolder[2]", '"and another value"');
shouldBe("currentHolder[3]", '"to delete"');
shouldBe("currentHolder[4]", '"extra value"');
break;
case 1:
debug("");
debug("Ensure that returning undefined has removed the property 0 from the holder during filtering.");
shouldBeFalse("currentHolder.hasOwnProperty(0)");
currentHolder[2] = "a replaced value";
break;
case 2:
debug("");
debug("Ensure that changing the value of a property is reflected while filtering.")
shouldBe("currentHolder[2]", '"a replaced value"');
value = v;
debug("");
debug("Ensure that the changed value is reflected in the arguments passed to the reviver");
shouldBe("value", "currentHolder[2]");
delete this[3];
break;
case 3:
debug("");
debug("Ensure that we visited a value that we have deleted, and that deletion is reflected while filtering.");
shouldBeFalse("currentHolder.hasOwnProperty(3)");
value = v;
debug("");
debug("Ensure that when visiting a deleted property value is undefined");
shouldBeUndefined("value");
v = "undelete the property";
expectedLength = this.length = 3;
break;
case 4:
if (this.length != 3) {
testFailed("Did not call reviver for deleted property");
expectedLength = this.length = 3;
break;
}
case 5:
testPassed("Ensured that property was visited despite Array length being reduced.");
value = v;
shouldBeUndefined("value");
this[10] = "fail";
break;
default:
testFailed("Visited unexpected property " + i + " with value " + v);
}
}
lastHolder = this;
return v;
}
expectedLength = 5;
var result = JSON.parse('["a value", "another value", "and another value", "to delete", "extra value"]', arrayReviver);
debug("");
debug("Ensure that we created the root holder as specified in ES5");
shouldBeTrue("'' in lastHolder");
shouldBe("result", "lastHolder['']");
debug("");
debug("Ensure that a deleted value is revived if the reviver function returns a value");
shouldBeTrue("result.hasOwnProperty(3)");
function objectReviver(i,v) {
if (i != "") {
currentHolder = this;
shouldBeTrue("currentHolder != globalObject");
if (seen) {
debug("");
debug("Ensure that we get the same holder object for each property");
shouldBe("currentHolder", "lastHolder");
}
seen = true;
switch (i) {
case "a property":
v = undefined;
debug("");
debug("Ensure that the holder already has all the properties present at the start of filtering");
shouldBe("currentHolder['a property']", '"a value"');
shouldBe("currentHolder['another property']", '"another value"');
shouldBe("currentHolder['and another property']", '"and another value"');
shouldBe("currentHolder['to delete']", '"will be deleted"');
break;
case "another property":
debug("");
debug("Ensure that returning undefined has correctly removed the property 'a property' from the holder object");
shouldBeFalse("currentHolder.hasOwnProperty('a property')");
currentHolder['and another property'] = "a replaced value";
break;
case "and another property":
debug("Ensure that changing the value of a property is reflected while filtering.");
shouldBe("currentHolder['and another property']", '"a replaced value"');
value = v;
debug("");
debug("Ensure that the changed value is reflected in the arguments passed to the reviver");
shouldBe("value", '"a replaced value"');
delete this["to delete"];
break;
case "to delete":
debug("");
debug("Ensure that we visited a value that we have deleted, and that deletion is reflected while filtering.");
shouldBeFalse("currentHolder.hasOwnProperty('to delete')");
value = v;
debug("");
debug("Ensure that when visiting a deleted property value is undefined");
shouldBeUndefined("value");
v = "undelete the property";
this["new property"] = "fail";
break;
default:
testFailed("Visited unexpected property " + i + " with value " + v);
}
}
lastHolder = this;
return v;
}
debug("");
debug("Test behaviour of revivor used in conjunction with an object");
var seen = false;
var globalObject = this;
var result = JSON.parse('{"a property" : "a value", "another property" : "another value", "and another property" : "and another value", "to delete" : "will be deleted"}', objectReviver);
debug("");
debug("Ensure that we created the root holder as specified in ES5");
shouldBeTrue("lastHolder.hasOwnProperty('')");
shouldBeFalse("result.hasOwnProperty('a property')");
shouldBeTrue("result.hasOwnProperty('to delete')");
shouldBe("result", "lastHolder['']");
debug("");
debug("Test behaviour of revivor that introduces a cycle");
function reviveAddsCycle(i, v) {
if (i == 0)
this[1] = this;
return v;
}
shouldThrow('JSON.parse("[0,1]", reviveAddsCycle)');
debug("");
debug("Test behaviour of revivor that introduces a new array classed object (the result of a regex)");
var createdBadness = false;
function reviveIntroducesNewArrayLikeObject(i, v) {
if (i == 0 && !createdBadness) {
this[1] = /(a)+/.exec("a");
createdBadness = true;
}
return v;
}
shouldBe('JSON.stringify(JSON.parse("[0,1]", reviveIntroducesNewArrayLikeObject))', '\'[0,["a","a"]]\'');
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("Test to ensure correct behaviour of Object.getOwnPropertyNames");
function argumentsObject() { return arguments; };
var expectedPropertyNamesSet = {
"{}": "[]",
"{a:null}": "['a']",
"{a:null, b:null}": "['a', 'b']",
"{b:null, a:null}": "['a', 'b']",
"{__proto__:{a:null}}": "[]",
"{__proto__:[1,2,3]}": "[]",
"Object.create({}, { 'a': { 'value': 1, 'enumerable': false } })": "['a']",
"Object.create([1,2,3], { 'a': { 'value': 1, 'enumerable': false } })": "['a']",
// Function objects
"new Function()": "['arguments', 'caller', 'length', 'name', 'prototype']",
"(function(){var x=new Function();x.__proto__=[1,2,3];return x;})()": "['arguments', 'caller', 'length', 'name', 'prototype']",
// String objects
"new String('')": "['length']",
"new String('a')": "['0', 'length']",
"new String('abc')": "['0', '1', '2', 'length']",
"(function(){var x=new String('');x.__proto__=[1,2,3];return x;})()": "['length']",
// Array objects
"[]": "['length']",
"[null]": "['0', 'length']",
"[null,null]": "['0','1', 'length']",
"[null,null,,,,null]": "['0','1','5', 'length']",
"(function(){var x=[];x.__proto__=[1,2,3];return x;})()": "['length']",
// Date objects
"new Date()": "[]",
"(function(){var x=new Date();x.__proto__=[1,2,3];return x;})()": "[]",
// RegExp objects
"new RegExp('foo')": "['global', 'ignoreCase', 'lastIndex', 'multiline', 'source']",
"(function(){var x=new RegExp();x.__proto__=[1,2,3];return x;})()": "['global', 'ignoreCase', 'lastIndex', 'multiline', 'source']",
// Arguments objects
"argumentsObject()": "['callee', 'length']",
"argumentsObject(1)": "['0', 'callee', 'length']",
"argumentsObject(1,2,3)": "['0', '1', '2', 'callee', 'length']",
"(function(){arguments.__proto__=[1,2,3];return arguments;})()": "['callee', 'length']",
// Built-in ECMA functions
"parseInt": "['length', 'name']",
"parseFloat": "['length', 'name']",
"isNaN": "['length', 'name']",
"isFinite": "['length', 'name']",
"escape": "['length', 'name']",
"unescape": "['length', 'name']",
"decodeURI": "['length', 'name']",
"decodeURIComponent": "['length', 'name']",
"encodeURI": "['length', 'name']",
"encodeURIComponent": "['length', 'name']",
// Built-in ECMA objects
"Object": "['create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getPrototypeOf', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']",
"Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', '__proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']",
"Function": "['length', 'name', 'prototype']",
"Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']",
"Array": "['isArray', 'length', 'name', 'prototype']",
"Array.prototype": "['concat', 'constructor', 'every', 'filter', 'forEach', 'indexOf', 'join', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']",
"String": "['fromCharCode', 'length', 'name', 'prototype']",
"String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']",
"Boolean": "['length', 'name', 'prototype']",
"Boolean.prototype": "['constructor', 'toString', 'valueOf']",
"Number": "['MAX_VALUE', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'length', 'name', 'prototype']",
"Number.prototype": "['constructor', 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString', 'valueOf']",
"Date": "['UTC', 'length', 'name', 'now', 'parse', 'prototype']",
"Date.prototype": "['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']",
"RegExp": "['$&', \"$'\", '$*', '$+', '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9', '$_', '$`', 'input', 'lastMatch', 'lastParen', 'leftContext', 'length', 'multiline', 'name', 'prototype', 'rightContext']",
"RegExp.prototype": "['compile', 'constructor', 'exec', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'test', 'toString']",
"Error": "['length', 'name', 'prototype']",
"Error.prototype": "['constructor', 'message', 'name', 'toString']",
"Math": "['E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2', 'abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'random', 'round', 'sin', 'sqrt', 'tan']",
"JSON": "['parse', 'stringify']"
};
function getSortedOwnPropertyNames(obj)
{
return Object.getOwnPropertyNames(obj).sort();
}
for (var expr in expectedPropertyNamesSet)
shouldBe("getSortedOwnPropertyNames(" + expr + ")", expectedPropertyNamesSet[expr]);
// Global Object
// Only check for ECMA properties here
var globalPropertyNames = Object.getOwnPropertyNames(this);
var expectedGlobalPropertyNames = [
"NaN",
"Infinity",
"undefined",
"parseInt",
"parseFloat",
"isNaN",
"isFinite",
"escape",
"unescape",
"decodeURI",
"decodeURIComponent",
"encodeURI",
"encodeURIComponent",
"Object",
"Function",
"Array",
"String",
"Boolean",
"Number",
"Date",
"RegExp",
"Error",
"Math",
"JSON"
];
for (var i = 0; i < expectedGlobalPropertyNames.length; ++i)
shouldBeTrue("globalPropertyNames.indexOf('" + expectedGlobalPropertyNames[i] + "') != -1");
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test thoroughly checks the behaviour of the 'arguments' object.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS access_1(1, 2, 3) is 1
PASS access_2(1, 2, 3) is 2
PASS access_3(1, 2, 3) is 3
PASS access_4(1, 2, 3) is undefined
PASS access_5(1, 2, 3) is undefined
PASS access_1(1) is 1
PASS access_2(1) is undefined
PASS access_3(1) is undefined
PASS access_4(1) is undefined
PASS access_5(1) is undefined
PASS access_1(1, 2, 3, 4, 5) is 1
PASS access_2(1, 2, 3, 4, 5) is 2
PASS access_3(1, 2, 3, 4, 5) is 3
PASS access_4(1, 2, 3, 4, 5) is 4
PASS access_5(1, 2, 3, 4, 5) is 5
PASS argumentLengthIs5() is 5
PASS argumentLengthIs5(1,2,3,4,5) is 5
PASS argumentLengthIs5(1,2,3,4,5,6,7,8,9,10) is 5
PASS duplicateArgumentAndReturnLast_call(1) is 1
PASS duplicateArgumentAndReturnFirst_call(1) is 1
PASS duplicateArgumentAndReturnLast_apply(1) is 1
PASS duplicateArgumentAndReturnFirst_apply(1) is 1
PASS tear_off_equal_access_1(1, 2, 3) is 1
PASS tear_off_equal_access_2(1, 2, 3) is 2
PASS tear_off_equal_access_3(1, 2, 3) is 3
PASS tear_off_equal_access_4(1, 2, 3) is undefined
PASS tear_off_equal_access_5(1, 2, 3) is undefined
PASS tear_off_too_few_access_1(1) is 1
PASS tear_off_too_few_access_2(1) is undefined
PASS tear_off_too_few_access_3(1) is undefined
PASS tear_off_too_few_access_4(1) is undefined
PASS tear_off_too_few_access_5(1) is undefined
PASS tear_off_too_many_access_1(1, 2, 3, 4, 5) is 1
PASS tear_off_too_many_access_2(1, 2, 3, 4, 5) is 2
PASS tear_off_too_many_access_3(1, 2, 3, 4, 5) is 3
PASS tear_off_too_many_access_4(1, 2, 3, 4, 5) is 4
PASS tear_off_too_many_access_5(1, 2, 3, 4, 5) is 5
PASS live_1(0, 2, 3) is 1
PASS live_2(1, 0, 3) is 2
PASS live_3(1, 2, 0) is 3
PASS live_1(0) is 1
PASS live_2(1) is undefined
PASS live_3(1) is undefined
PASS live_1(0, 2, 3, 4, 5) is 1
PASS live_2(1, 0, 3, 4, 5) is 2
PASS live_3(1, 2, 0, 4, 5) is 3
PASS extra_args_modify_4(1, 2, 3, 0, 5) is 4
PASS extra_args_modify_5(1, 2, 3, 4, 0) is 5
PASS tear_off_live_1(0, 2, 3)() is 1
PASS tear_off_live_2(1, 0, 3)() is 2
PASS tear_off_live_3(1, 2, 0)() is 3
PASS tear_off_live_1(0)() is 1
PASS tear_off_live_2(1)() is undefined
PASS tear_off_live_3(1)() is undefined
PASS tear_off_live_1(0, 2, 3, 4, 5)() is 1
PASS tear_off_live_2(1, 0, 3, 4, 5)() is 2
PASS tear_off_live_3(1, 2, 0, 4, 5)() is 3
PASS tear_off_extra_args_modify_4(1, 2, 3, 0, 5)() is 4
PASS tear_off_extra_args_modify_5(1, 2, 3, 4, 0)() is 5
PASS delete_1(1, 2, 3) is undefined
PASS delete_2(1, 2, 3) is undefined
PASS delete_3(1, 2, 3) is undefined
PASS delete_4(1, 2, 3) is undefined
PASS delete_5(1, 2, 3) is undefined
PASS delete_1(1) is undefined
PASS delete_2(1) is undefined
PASS delete_3(1) is undefined
PASS delete_4(1) is undefined
PASS delete_5(1) is undefined
PASS delete_1(1, 2, 3, 4, 5) is undefined
PASS delete_2(1, 2, 3, 4, 5) is undefined
PASS delete_3(1, 2, 3, 4, 5) is undefined
PASS delete_4(1, 2, 3, 4, 5) is undefined
PASS delete_5(1, 2, 3, 4, 5) is undefined
PASS tear_off_delete_1(1, 2, 3)() is undefined
PASS tear_off_delete_2(1, 2, 3)() is undefined
PASS tear_off_delete_3(1, 2, 3)() is undefined
PASS tear_off_delete_4(1, 2, 3)() is undefined
PASS tear_off_delete_5(1, 2, 3)() is undefined
PASS tear_off_delete_1(1)() is undefined
PASS tear_off_delete_2(1)() is undefined
PASS tear_off_delete_3(1)() is undefined
PASS tear_off_delete_4(1)() is undefined
PASS tear_off_delete_5(1)() is undefined
PASS tear_off_delete_1(1, 2, 3, 4, 5)() is undefined
PASS tear_off_delete_2(1, 2, 3, 4, 5)() is undefined
PASS tear_off_delete_3(1, 2, 3, 4, 5)() is undefined
PASS tear_off_delete_4(1, 2, 3, 4, 5)() is undefined
PASS tear_off_delete_5(1, 2, 3, 4, 5)() is undefined
PASS delete_not_live_1(1, 2, 3) is 1
PASS delete_not_live_2(1, 2, 3) is 2
PASS delete_not_live_3(1, 2, 3) is 3
PASS delete_not_live_1(1) is 1
PASS delete_not_live_2(1) is undefined
PASS delete_not_live_3(1) is undefined
PASS delete_not_live_1(1, 2, 3, 4, 5) is 1
PASS delete_not_live_2(1, 2, 3, 4, 5) is 2
PASS delete_not_live_3(1, 2, 3, 4, 5) is 3
PASS tear_off_delete_not_live_1(1, 2, 3)() is 1
PASS tear_off_delete_not_live_2(1, 2, 3)() is 2
PASS tear_off_delete_not_live_3(1, 2, 3)() is 3
PASS tear_off_delete_not_live_1(1)() is 1
PASS tear_off_delete_not_live_2(1)() is undefined
PASS tear_off_delete_not_live_3(1)() is undefined
PASS tear_off_delete_not_live_1(1, 2, 3, 4, 5)() is 1
PASS tear_off_delete_not_live_2(1, 2, 3, 4, 5)() is 2
PASS tear_off_delete_not_live_3(1, 2, 3, 4, 5)() is 3
PASS access_after_delete_named_2(1, 2, 3) is 2
PASS access_after_delete_named_3(1, 2, 3) is 3
PASS access_after_delete_named_4(1, 2, 3) is undefined
PASS access_after_delete_named_2(1) is undefined
PASS access_after_delete_named_3(1) is undefined
PASS access_after_delete_named_4(1) is undefined
PASS access_after_delete_named_2(1, 2, 3, 4) is 2
PASS access_after_delete_named_3(1, 2, 3, 4) is 3
PASS access_after_delete_named_4(1, 2, 3, 4) is 4
PASS access_after_delete_extra_1(1, 2, 3) is 1
PASS access_after_delete_extra_2(1, 2, 3) is 2
PASS access_after_delete_extra_3(1, 2, 3) is 3
PASS access_after_delete_extra_5(1, 2, 3) is undefined
PASS access_after_delete_extra_1(1) is 1
PASS access_after_delete_extra_2(1) is undefined
PASS access_after_delete_extra_3(1) is undefined
PASS access_after_delete_extra_5(1) is undefined
PASS access_after_delete_extra_1(1, 2, 3, 4, 5) is 1
PASS access_after_delete_extra_2(1, 2, 3, 4, 5) is 2
PASS access_after_delete_extra_3(1, 2, 3, 4, 5) is 3
PASS access_after_delete_extra_5(1, 2, 3, 4, 5) is 5
PASS argumentsParam(true) is true
PASS argumentsFunctionConstructorParam(true) is true
PASS argumentsVarUndefined() is '[object Arguments]'
FAIL argumentsConstUndefined() should be [object Arguments]. Threw exception TypeError: Variable 'arguments' has already been declared
PASS argumentCalleeInException() is argumentCalleeInException
PASS shadowedArgumentsApply([true]) is true
PASS shadowedArgumentsLength([]) is 0
PASS shadowedArgumentsLength() threw exception TypeError: Cannot read property 'length' of undefined.
PASS shadowedArgumentsCallee([]) is undefined.
PASS shadowedArgumentsIndex([true]) is true
PASS descriptor.value is "one"
PASS descriptor.writable is true
PASS descriptor.enumerable is true
PASS descriptor.configurable is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS true is true
PASS false is false
PASS true is true
PASS false is false
PASS false is false
PASS undefined is undefined.
PASS true is true
PASS false is false
PASS successfullyParsed is true
TEST COMPLETE
This diff is collapsed.
This diff is collapsed.
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"Tests that defining a setter on the Array prototype works even if it is done after arrays are allocated."
);
var ouches = 0;
function foo(haveABadTime) {
var result = [];
result.length = 5;
for (var i = 0; i < result.length; ++i) {
if (i == haveABadTime) {
debug("Henceforth I will have a bad time.");
Array.prototype.__defineSetter__("3", function() { debug("Ouch!"); ouches++; });
}
result[i] = i;
}
return result;
}
var expected = "\"0,1,2,3,4\"";
for (var i = 0; i < 1000; ++i) {
var haveABadTime;
if (i == 950) {
haveABadTime = 2;
expected = "\"0,1,2,,4\"";
} else
haveABadTime = -1;
shouldBe("\"" + foo(haveABadTime).join(",") + "\"", expected);
}
shouldBe("ouches", "50");
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks for regression against 6234: Can delete array index property incorrectly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS a[1] is "before"
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This test checks for regression against <a href="https://bugs.webkit.org/show_bug.cgi?id=6234">6234: Can delete array index property incorrectly.</a>'
);
var a = new Array();
a[1] = "before";
a['1.0'] = "after";
delete a['1.0'];
shouldBe("a[1]", '"before"');
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test some array functions on non-array objects.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS properties(['b', 'a']) is '0:b, 1:a, length:2(DontDelete, DontEnum)'
PASS properties({ length:2, 0:'b', 1:'a' }) is '0:b, 1:a, length:2'
PASS properties(new OneItemConstructor) is '0:a(FromPrototype), length:1(FromPrototype)'
PASS properties(new TwoItemConstructor) is '0:b(FromPrototype), 1:a(FromPrototype), length:2(FromPrototype)'
PASS Array.prototype.toString.call({}) is "[object Object]"
PASS Array.prototype.toString.call(new Date) is "[object Date]"
PASS Array.prototype.toString.call({sort: function() { return 'sort' }}) is "[object Object]"
PASS Array.prototype.toString.call({join: function() { return 'join' }}) is "join"
PASS Array.prototype.toString.call({__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3}) is "a,b,c"
PASS ({__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3}).toString() is "a,b,c"
PASS Array.prototype.toString.call({__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3, join: function() { return 'join' }}) is "join"
PASS ({__proto__: Array.prototype, 0: 'a', 1: 'b', 2: 'c', length: 3, join: function() { return 'join' }}).toString() is "join"
PASS Array.prototype.toString.call(42) is "Number.prototype.join:42"
PASS [0, 1, 2].toString() is "array-join"
FAIL Array.prototype.toLocaleString.call({}) should throw an exception. Was .
PASS Array.prototype.concat.call(x = { length:2, 0:'b', 1:'a' }) is [x]
PASS Array.prototype.join.call({}) is ''
PASS Array.prototype.join.call(['b', 'a']) is 'b,a'
PASS Array.prototype.join.call({ length:2, 0:'b', 1:'a' }) is 'b,a'
PASS Array.prototype.join.call(new TwoItemConstructor) is 'b,a'
PASS Array.prototype.pop.call({}) is undefined
PASS Array.prototype.pop.call({ length:2, 0:'b', 1:'a' }) is 'a'
PASS Array.prototype.pop.call({ length:2, 0:'b', 1:'a' }) is 'a'
PASS Array.prototype.pop.call(new TwoItemConstructor) is 'a'
PASS Array.prototype.pop.call(x = {}); properties(x) is 'length:0'
PASS Array.prototype.pop.call(x = ['b', 'a']); properties(x) is '0:b, length:1(DontDelete, DontEnum)'
PASS Array.prototype.pop.call(x = { length:2, 0:'b', 1:'a' }); properties(x) is '0:b, length:1'
PASS Array.prototype.pop.call(x = new TwoItemConstructor); properties(x) is '0:b(FromPrototype), 1:a(FromPrototype), length:1'
PASS Array.prototype.push.call({}) is 0
PASS Array.prototype.push.call(['b', 'a']) is 2
PASS Array.prototype.push.call({ length:2, 0:'b', 1:'a' }) is 2
PASS Array.prototype.push.call(new TwoItemConstructor) is 2
PASS Array.prototype.push.call(x = {}); properties(x) is 'length:0'
PASS Array.prototype.push.call(x = ['b', 'a']); properties(x) is '0:b, 1:a, length:2(DontDelete, DontEnum)'
PASS Array.prototype.push.call(x = { length:2, 0:'b', 1:'a' }); properties(x) is '0:b, 1:a, length:2'
PASS Array.prototype.push.call(x = new TwoItemConstructor); properties(x) is '0:b(FromPrototype), 1:a(FromPrototype), length:2'
PASS Array.prototype.push.call({}, 'c') is 1
PASS Array.prototype.push.call(['b', 'a'], 'c') is 3
PASS Array.prototype.push.call({ length:2, 0:'b', 1:'a' }, 'c') is 3
PASS Array.prototype.push.call(new TwoItemConstructor, 'c') is 3
PASS Array.prototype.push.call(x = {}, 'c'); properties(x) is '0:c, length:1'
PASS Array.prototype.push.call(x = ['b', 'a'], 'c'); properties(x) is '0:b, 1:a, 2:c, length:3(DontDelete, DontEnum)'
PASS Array.prototype.push.call(x = { length:2, 0:'b', 1:'a' }, 'c'); properties(x) is '0:b, 1:a, 2:c, length:3'
PASS Array.prototype.push.call(x = new TwoItemConstructor, 'c'); properties(x) is '0:b(FromPrototype), 1:a(FromPrototype), 2:c, length:3'
PASS properties(Array.prototype.reverse.call({})) is ''
PASS properties(Array.prototype.reverse.call(['b', 'a'])) is '0:a, 1:b, length:2(DontDelete, DontEnum)'
PASS properties(Array.prototype.reverse.call({ length:2, 0:'b', 1:'a' })) is '0:a, 1:b, length:2'
PASS properties(Array.prototype.reverse.call(new OneItemConstructor)) is '0:a(FromPrototype), length:1(FromPrototype)'
PASS properties(Array.prototype.reverse.call(new TwoItemConstructor)) is '0:a, 1:b, length:2(FromPrototype)'
PASS Array.prototype.shift.call({}) is undefined
PASS Array.prototype.shift.call(['b', 'a']) is 'b'
PASS Array.prototype.shift.call({ length:2, 0:'b', 1:'a' }) is 'b'
PASS Array.prototype.shift.call(new TwoItemConstructor) is 'b'
PASS Array.prototype.shift.call(x = {}); properties(x) is 'length:0'
PASS Array.prototype.shift.call(x = ['b', 'a']); properties(x) is '0:a, length:1(DontDelete, DontEnum)'
PASS Array.prototype.shift.call(x = { length:2, 0:'b', 1:'a' }); properties(x) is '0:a, length:1'
PASS Array.prototype.shift.call(x = new TwoItemConstructor); properties(x) is '0:a, 1:a(FromPrototype), length:1'
PASS Array.prototype.slice.call({}, 0, 1) is []
PASS Array.prototype.slice.call(['b', 'a'], 0, 1) is ['b']
PASS Array.prototype.slice.call({ length:2, 0:'b', 1:'a' }, 0, 1) is ['b']
PASS Array.prototype.slice.call(new TwoItemConstructor, 0, 1) is ['b']
PASS properties(Array.prototype.sort.call({})) is ''
PASS properties(Array.prototype.sort.call(['b', 'a'])) is '0:a, 1:b, length:2(DontDelete, DontEnum)'
PASS properties(Array.prototype.sort.call({ length:2, 0:'b', 1:'a' })) is '0:a, 1:b, length:2'
PASS properties(Array.prototype.sort.call(new OneItemConstructor)) is '0:a(FromPrototype), length:1(FromPrototype)'
PASS properties(Array.prototype.sort.call(new TwoItemConstructor)) is '0:a, 1:b, length:2(FromPrototype)'
PASS Array.prototype.splice.call({}, 0, 1) is []
PASS Array.prototype.splice.call(['b', 'a'], 0, 1) is ['b']
PASS Array.prototype.splice.call({ length:2, 0:'b', 1:'a' }, 0, 1) is ['b']
PASS Array.prototype.splice.call(new TwoItemConstructor, 0, 1) is ['b']
PASS Array.prototype.splice.call(x = {}, 0, 1); properties(x) is 'length:0'
PASS Array.prototype.splice.call(x = ['b', 'a'], 0, 1); properties(x) is '0:a, length:1(DontDelete, DontEnum)'
PASS Array.prototype.splice.call(x = { length:2, 0:'b', 1:'a' }, 0, 1); properties(x) is '0:a, length:1'
PASS Array.prototype.splice.call(x = new TwoItemConstructor, 0, 1); properties(x) is '0:a, 1:a(FromPrototype), length:1'
PASS Array.prototype.unshift.call({}) is 0
PASS Array.prototype.unshift.call(['b', 'a']) is 2
PASS Array.prototype.unshift.call({ length:2, 0:'b', 1:'a' }) is 2
PASS Array.prototype.unshift.call(new TwoItemConstructor) is 2
PASS Array.prototype.unshift.call(x = {}); properties(x) is 'length:0'
PASS Array.prototype.unshift.call(x = ['b', 'a']); properties(x) is '0:b, 1:a, length:2(DontDelete, DontEnum)'
PASS Array.prototype.unshift.call(x = { length:2, 0:'b', 1:'a' }); properties(x) is '0:b, 1:a, length:2'
PASS Array.prototype.unshift.call(x = new TwoItemConstructor); properties(x) is '0:b(FromPrototype), 1:a(FromPrototype), length:2'
PASS Array.prototype.unshift.call({}, 'c') is 1
PASS Array.prototype.unshift.call(['b', 'a'], 'c') is 3
PASS Array.prototype.unshift.call({ length:2, 0:'b', 1:'a' }, 'c') is 3
PASS Array.prototype.unshift.call(new TwoItemConstructor, 'c') is 3
PASS Array.prototype.unshift.call(x = {}, 'c'); properties(x) is '0:c, length:1'
PASS Array.prototype.unshift.call(x = ['b', 'a'], 'c'); properties(x) is '0:c, 1:b, 2:a, length:3(DontDelete, DontEnum)'
PASS Array.prototype.unshift.call(x = { length:2, 0:'b', 1:'a' }, 'c'); properties(x) is '0:c, 1:b, 2:a, length:3'
PASS Array.prototype.unshift.call(x = new TwoItemConstructor, 'c'); properties(x) is '0:c, 1:b, 2:a, length:3'
PASS successfullyParsed is true
TEST COMPLETE
This diff is collapsed.
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is a test case for bug 64679.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Array.prototype.toString.call(undefined) threw exception TypeError: Cannot convert undefined or null to object.
PASS Array.prototype.toLocaleString.call(undefined) threw exception TypeError: Cannot convert undefined or null to object.
PASS Array.prototype.concat.call(undefined, []) threw exception TypeError: Array.prototype.concat called on null or undefined.
PASS Array.prototype.join.call(undefined, []) threw exception TypeError: Array.prototype.join called on null or undefined.
PASS Array.prototype.pop.call(undefined) threw exception TypeError: Array.prototype.pop called on null or undefined.
PASS Array.prototype.push.call(undefined, {}) threw exception TypeError: Array.prototype.push called on null or undefined.
PASS Array.prototype.reverse.call(undefined) threw exception TypeError: Array.prototype.reverse called on null or undefined.
PASS Array.prototype.shift.call(undefined) threw exception TypeError: Array.prototype.shift called on null or undefined.
PASS Array.prototype.slice.call(undefined, 0, 1) threw exception TypeError: Array.prototype.slice called on null or undefined.
PASS Array.prototype.sort.call(undefined) threw exception TypeError: Array.prototype.sort called on null or undefined.
PASS Array.prototype.splice.call(undefined, 0, 1) threw exception TypeError: Array.prototype.splice called on null or undefined.
PASS Array.prototype.unshift.call(undefined, {}) threw exception TypeError: Array.prototype.unshift called on null or undefined.
PASS Array.prototype.every.call(undefined, toString) threw exception TypeError: Array.prototype.every called on null or undefined.
PASS Array.prototype.forEach.call(undefined, toString) threw exception TypeError: Array.prototype.forEach called on null or undefined.
PASS Array.prototype.some.call(undefined, toString) threw exception TypeError: Array.prototype.some called on null or undefined.
PASS Array.prototype.indexOf.call(undefined, 0) threw exception TypeError: Array.prototype.indexOf called on null or undefined.
PASS Array.prototype.indlastIndexOfexOf.call(undefined, 0) threw exception TypeError: Cannot call method 'call' of undefined.
PASS Array.prototype.filter.call(undefined, toString) threw exception TypeError: Array.prototype.filter called on null or undefined.
PASS Array.prototype.reduce.call(undefined, toString) threw exception TypeError: Array.prototype.reduce called on null or undefined.
PASS Array.prototype.reduceRight.call(undefined, toString) threw exception TypeError: Array.prototype.reduceRight called on null or undefined.
PASS Array.prototype.map.call(undefined, toString) threw exception TypeError: Array.prototype.map called on null or undefined.
PASS [{toLocaleString:function(){throw 1}},{toLocaleString:function(){throw 2}}].toLocaleString() threw exception 1.
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This is a test case for <a https://bugs.webkit.org/show_bug.cgi?id=64679">bug 64679</a>.'
);
// These calls pass undefined as this value, and as such should throw in toObject.
shouldThrow("Array.prototype.toString.call(undefined)");
shouldThrow("Array.prototype.toLocaleString.call(undefined)");
shouldThrow("Array.prototype.concat.call(undefined, [])");
shouldThrow("Array.prototype.join.call(undefined, [])");
shouldThrow("Array.prototype.pop.call(undefined)");
shouldThrow("Array.prototype.push.call(undefined, {})");
shouldThrow("Array.prototype.reverse.call(undefined)");
shouldThrow("Array.prototype.shift.call(undefined)");
shouldThrow("Array.prototype.slice.call(undefined, 0, 1)");
shouldThrow("Array.prototype.sort.call(undefined)");
shouldThrow("Array.prototype.splice.call(undefined, 0, 1)");
shouldThrow("Array.prototype.unshift.call(undefined, {})");
shouldThrow("Array.prototype.every.call(undefined, toString)");
shouldThrow("Array.prototype.forEach.call(undefined, toString)");
shouldThrow("Array.prototype.some.call(undefined, toString)");
shouldThrow("Array.prototype.indexOf.call(undefined, 0)");
shouldThrow("Array.prototype.indlastIndexOfexOf.call(undefined, 0)");
shouldThrow("Array.prototype.filter.call(undefined, toString)");
shouldThrow("Array.prototype.reduce.call(undefined, toString)");
shouldThrow("Array.prototype.reduceRight.call(undefined, toString)");
shouldThrow("Array.prototype.map.call(undefined, toString)");
// Test exception ordering in Array.prototype.toLocaleString ( https://bugs.webkit.org/show_bug.cgi?id=80663 )
shouldThrow("[{toLocaleString:function(){throw 1}},{toLocaleString:function(){throw 2}}].toLocaleString()", '1');
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Tests that defining a setter on the Array prototype works.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL "0,1,2,3,4" should be 0,1,2,,4. Was 0,1,2,3,4.
FAIL ouches should be 100. Was 0.
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"Tests that defining a setter on the Array prototype works."
);
var ouches = 0;
Array.prototype.__defineSetter__("3", function() { debug("Ouch!"); ouches++; });
function foo() {
var result = [];
result.length = 5;
for (var i = 0; i < result.length; ++i)
result[i] = i;
return result;
}
for (var i = 0; i < 100; ++i)
shouldBe("\"" + foo().join(",") + "\"", "\"0,1,2,,4\"");
shouldBe("ouches", "100");
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks for regressions against 6261:Do not use a separator argument when doing toString/toLocalString.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS a.toString('!') is '5,3'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This test checks for regressions against <a href="https://bugs.webkit.org/show_bug.cgi?id=6261">6261:Do not use a separator argument when doing toString/toLocalString.</a>'
);
var a = new Array;
a[0] = 5;
a[1] = 3;
//Shouldn't use argument for toString
shouldBe("a.toString('!')", "'5,3'");
This diff is collapsed.
This diff is collapsed.
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This tests for caller property in functions. Only functions that are called from inside of other functions and have a parent should have this property set. Tests return true when caller is found and false when the caller is null.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS childHasCallerWhenExecutingGlobalCode is false
PASS childHasCallerWhenCalledWithoutParent is false
PASS childHasCallerWhenCalledFromWithinParent is true
PASS nonStrictCaller(nonStrictCallee) is nonStrictCaller
FAIL nonStrictCaller(strictCallee) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
FAIL strictCaller(nonStrictCallee) should throw TypeError: Function.caller used to retrieve strict caller. Was null.
FAIL strictCaller(strictCallee) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
PASS nonStrictCaller(boundNonStrictCallee) is nonStrictCaller
FAIL nonStrictCaller(boundStrictCallee) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
FAIL strictCaller(boundNonStrictCallee) should throw TypeError: Function.caller used to retrieve strict caller. Was null.
FAIL strictCaller(boundStrictCallee) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
PASS nonStrictGetter(nonStrictAccessor) is nonStrictGetter
PASS nonStrictSetter(nonStrictAccessor) is true
FAIL nonStrictGetter(strictAccessor) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
FAIL nonStrictSetter(strictAccessor) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
FAIL strictGetter(nonStrictAccessor) should throw TypeError: Function.caller used to retrieve strict caller. Was null.
FAIL strictSetter(nonStrictAccessor) should throw TypeError: Function.caller used to retrieve strict caller. Was undefined.
FAIL strictGetter(strictAccessor) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
FAIL strictSetter(strictAccessor) should throw TypeError: Type error. Threw exception TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them.
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This tests for caller property in functions. Only functions that are called from inside of other functions and have a parent should have this property set. Tests return true when caller is found and false when the caller is null.'
)
function child()
{
return (child.caller !== null);
}
function parent()
{
return child();
}
var childHasCallerWhenExecutingGlobalCode = (child.caller !== null);
var childHasCallerWhenCalledWithoutParent = child();
var childHasCallerWhenCalledFromWithinParent = parent();
shouldBe('childHasCallerWhenExecutingGlobalCode', 'false');
shouldBe('childHasCallerWhenCalledWithoutParent', 'false');
shouldBe('childHasCallerWhenCalledFromWithinParent', 'true')
// The caller property should throw in strict mode, and a non-strict function cannot use caller to reach a strict caller (see ES5.1 15.3.5.4).
function nonStrictCallee() { return nonStrictCallee.caller; }
function strictCallee() { "use strict"; return strictCallee.caller; }
function nonStrictCaller(x) { return x(); }
function strictCaller(x) { "use strict"; return x(); }
shouldBe("nonStrictCaller(nonStrictCallee)", "nonStrictCaller");
shouldThrow("nonStrictCaller(strictCallee)", '"TypeError: Type error"');
shouldThrow("strictCaller(nonStrictCallee)", '"TypeError: Function.caller used to retrieve strict caller"');
shouldThrow("strictCaller(strictCallee)", '"TypeError: Type error"');
// .caller within a bound function reaches the caller, ignoring the binding.
var boundNonStrictCallee = nonStrictCallee.bind();
var boundStrictCallee = strictCallee.bind();
shouldBe("nonStrictCaller(boundNonStrictCallee)", "nonStrictCaller");
shouldThrow("nonStrictCaller(boundStrictCallee)", '"TypeError: Type error"');
shouldThrow("strictCaller(boundNonStrictCallee)", '"TypeError: Function.caller used to retrieve strict caller"');
shouldThrow("strictCaller(boundStrictCallee)", '"TypeError: Type error"');
// Check that .caller works (or throws) as expected, over an accessor call.
function getFooGetter(x) { return Object.getOwnPropertyDescriptor(x, 'foo').get; }
function getFooSetter(x) { return Object.getOwnPropertyDescriptor(x, 'foo').set; }
var nonStrictAccessor = {
get foo() { return getFooGetter(nonStrictAccessor).caller; },
set foo(x) { if (getFooSetter(nonStrictAccessor).caller !==x) throw false; }
};
var strictAccessor = {
get foo() { "use strict"; return getFooGetter(strictAccessor).caller; },
set foo(x) { "use strict"; if (getFooSetter(strictAccessor).caller !==x) throw false; }
};
function nonStrictGetter(x) { return x.foo; }
function nonStrictSetter(x) { x.foo = nonStrictSetter; return true; }
function strictGetter(x) { "use strict"; return x.foo; }
function strictSetter(x) { "use strict"; x.foo = nonStrictSetter; return true; }
shouldBe("nonStrictGetter(nonStrictAccessor)", "nonStrictGetter");
shouldBeTrue("nonStrictSetter(nonStrictAccessor)");
shouldThrow("nonStrictGetter(strictAccessor)", '"TypeError: Type error"');
shouldThrow("nonStrictSetter(strictAccessor)", '"TypeError: Type error"');
shouldThrow("strictGetter(nonStrictAccessor)", '"TypeError: Function.caller used to retrieve strict caller"');
shouldThrow("strictSetter(nonStrictAccessor)", '"TypeError: Function.caller used to retrieve strict caller"');
shouldThrow("strictGetter(strictAccessor)", '"TypeError: Type error"');
shouldThrow("strictSetter(strictAccessor)", '"TypeError: Type error"');
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks for a regression against Date.setMonth fails with big values due to overflow.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS d.valueOf() is new Date(1980, 8, 1).valueOf()
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This test checks for a regression against <a href="https://bugs.webkit.org/show_bug.cgi?id=4781">Date.setMonth fails with big values due to overflow</a>.'
);
var d = new Date(1970, 0, 1);
d.setMonth(128);
shouldBe("d.valueOf()", "new Date(1980, 8, 1).valueOf()");
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks for a regression against Date.setMonth fails with negative values.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS d.valueOf() is new Date(2004, 9, 15).valueOf()
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This test checks for a regression against <a href="https://bugs.webkit.org/show_bug.cgi?id=5280">Date.setMonth fails with negative values</a>.'
);
var d = new Date(2005, 6, 15);
d.setMonth(-3);
shouldBe("d.valueOf()", "new Date(2004, 9, 15).valueOf()");
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The following test checks if an existing milliseconds value gets preserved if a call to setHours(), setMinutes() or setSeconds() does not specify the milliseconds. See https://bugs.webkit.org/show_bug.cgi?id=3759
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS d.getMilliseconds() is 1
PASS d.getMilliseconds() is 1
PASS d.getMilliseconds() is 1
PASS d.getMilliseconds() is 1
PASS d.getMilliseconds() is 1
PASS d.getMilliseconds() is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'The following test checks if an existing milliseconds value gets preserved if a call to setHours(), setMinutes() or setSeconds() does not specify the milliseconds. See <a href="https://bugs.webkit.org/show_bug.cgi?id=3759">https://bugs.webkit.org/show_bug.cgi?id=3759</a>'
);
var d = new Date(0);
d.setMilliseconds(1);
var oldValue = d.getMilliseconds();
d.setHours(8);
shouldBe("d.getMilliseconds()", oldValue.toString());
d.setHours(8, 30);
shouldBe("d.getMilliseconds()", oldValue.toString());
d.setHours(8, 30, 40);
shouldBe("d.getMilliseconds()", oldValue.toString());
d.setMinutes(45);
shouldBe("d.getMilliseconds()", oldValue.toString());
d.setMinutes(45, 40);
shouldBe("d.getMilliseconds()", oldValue.toString());
d.setSeconds(50);
shouldBe("d.getMilliseconds()", oldValue.toString());
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Tests for Date.toISOString
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Date.toISOString.call({}) threw exception TypeError: Cannot call method 'call' of undefined.
PASS Date.toISOString.call(0) threw exception TypeError: Cannot call method 'call' of undefined.
PASS new Date(-400).toISOString() is '1969-12-31T23:59:59.600Z'
PASS new Date(0).toISOString() is '1970-01-01T00:00:00.000Z'
PASS new Date('1 January 1500 UTC').toISOString() is '1500-01-01T00:00:00.000Z'
PASS new Date('1 January 2000 UTC').toISOString() is '2000-01-01T00:00:00.000Z'
PASS new Date('1 January 4000 UTC').toISOString() is '4000-01-01T00:00:00.000Z'
PASS new Date('1 January 100000 UTC').toISOString() is '+100000-01-01T00:00:00.000Z'
FAIL new Date('1 January -1 UTC').toISOString() should be -000001-01-01T00:00:00.000Z. Threw exception RangeError: Invalid time value
PASS new Date('10 March 2000 UTC').toISOString() is '2000-03-10T00:00:00.000Z'
PASS throwsRangeError("new Date(NaN).toISOString()") is true
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("Tests for Date.toISOString");
function throwsRangeError(str)
{
try {
eval(str);
} catch (e) {
return e instanceof RangeError;
}
return false;
}
shouldThrow("Date.toISOString.call({})");
shouldThrow("Date.toISOString.call(0)");
shouldBe("new Date(-400).toISOString()", "'1969-12-31T23:59:59.600Z'");
shouldBe("new Date(0).toISOString()", "'1970-01-01T00:00:00.000Z'");
shouldBe("new Date('1 January 1500 UTC').toISOString()", "'1500-01-01T00:00:00.000Z'");
shouldBe("new Date('1 January 2000 UTC').toISOString()", "'2000-01-01T00:00:00.000Z'");
shouldBe("new Date('1 January 4000 UTC').toISOString()", "'4000-01-01T00:00:00.000Z'");
shouldBe("new Date('1 January 100000 UTC').toISOString()", "'+100000-01-01T00:00:00.000Z'");
shouldBe("new Date('1 January -1 UTC').toISOString()", "'-000001-01-01T00:00:00.000Z'");
shouldBe("new Date('10 March 2000 UTC').toISOString()", "'2000-03-10T00:00:00.000Z'");
shouldBeTrue('throwsRangeError("new Date(NaN).toISOString()")');
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test for bug 33641: Assertion failure in Lexer.cpp if input stream ends while in string escape.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Passed if no assertion failure.
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description('Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=33641">bug 33641</a>: Assertion failure in Lexer.cpp if input stream ends while in string escape.');
debug("Passed if no assertion failure.");
try {
eval('"\\');
} catch (ex) {
}
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test for correct properties on Error objects.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS enumerableProperties(error) is []
FAIL enumerableProperties(nativeError) should be stack,line,sourceURL. Was .
PASS Object.getPrototypeOf(nativeError).name is "RangeError"
PASS Object.getPrototypeOf(nativeError).message is ""
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("Test for correct properties on Error objects.");
function enumerableProperties(object)
{
var result = [];
for (var i in object)
result.push(i);
return result;
}
try {
// generate a RangeError.
[].length = -1;
} catch (rangeError) {
var nativeError = rangeError;
var error = new Error("message");
shouldBe('enumerableProperties(error)', '[]');
shouldBe('enumerableProperties(nativeError)', '["stack", "line", "sourceURL"]');
shouldBe('Object.getPrototypeOf(nativeError).name', '"RangeError"');
shouldBe('Object.getPrototypeOf(nativeError).message', '""');
}
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test for REGRESSION(r60392): Registerfile can be unwound too far following an exception. If the test doesn't crash, you pass.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
"Test for <a href='https://bugs.webkit.org/show_bug.cgi?id=41948'>REGRESSION(r60392): Registerfile can be unwound too far following an exception</a>. If the test doesn't crash, you pass."
);
eval('try { throw 0; } catch(e) {}');
var x = new String();
'' + escape(x.substring(0, 1));
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test that we can handle excessively large initializer lists
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS new Function(initializerTestString)() is true
PASS new Function(declarationTestString)() is true
FAIL new Function(commaExpressionTestString)() should be true. Threw exception RangeError: Maximum call stack size exceeded
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("Test that we can handle excessively large initializer lists");
var initializerTestString = "var a=0";
for (var i = 0; i < 50000; i++)
initializerTestString += ",a"+i+"="+i;
initializerTestString += ";return true;";
var declarationTestString = "var a";
for (var i = 0; i < 50000; i++)
declarationTestString += ",a"+i;
declarationTestString += ";return true;";
var commaExpressionTestString = "1";
for (var i = 0; i < 50000; i++)
commaExpressionTestString += ",1";
commaExpressionTestString += ";return true;";
shouldBeTrue("new Function(initializerTestString)()");
shouldBeTrue("new Function(declarationTestString)()");
shouldBeTrue("new Function(commaExpressionTestString)()");
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Tests to ensure that Function.apply works correctly for Arrays, arguments and array-like objects.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS argumentsApply1(1, 2, 3) is 1
PASS argumentsApply2(1, 2, 3) is 2
PASS argumentsApply3(1, 2, 3) is 3
PASS argumentsApplyLength(1, 2, 3) is 3
PASS argumentsApplyExcessArguments(1, 2, 3) is 3
PASS executedAdditionalArgument is true
PASS arrayApply1([1, 2, 3]) is 1
PASS arrayApply2([1, 2, 3]) is 2
PASS arrayApply3([1, 2, 3]) is 3
PASS arrayApplyLength([1, 2, 3]) is 3
PASS argumentsApplyDelete1(1, 2, 3) is 1
PASS argumentsApplyDelete2(1, 2, 3) is undefined
PASS argumentsApplyDelete3(1, 2, 3) is 3
PASS argumentsApplyDeleteLength(1, 2, 3) is 3
PASS arrayApplyDelete1([1, 2, 3]) is 1
PASS arrayApplyDelete2([1, 2, 3]) is undefined
PASS arrayApplyDelete3([1, 2, 3]) is 3
PASS arrayApplyDeleteLength([1, 2, 3]) is 3
PASS argumentsApplyChangeLength1(1) is 2
PASS argumentsApplyChangeLength2(1) is 2
PASS argumentsApplyChangeLength3(1) is 2
PASS argumentsApplyChangeLength4(1) is 0
PASS argumentsApplyChangeLength5(1) is 0
PASS arrayApplyChangeLength1() is 2
PASS arrayApplyChangeLength2() is 2
PASS arrayApplyChangeLength3() is 2
PASS arrayApplyChangeLength4() is 0
PASS var a = []; a.length = 0xFFFE; [].constructor.apply('', a).length is 0xFFFE
PASS var a = []; a.length = 0xFFFF; [].constructor.apply('', a).length is 0xFFFF
PASS var a = []; a.length = 0x10000; [].constructor.apply('', a).length is 0x10000
FAIL var a = []; a.length = 0x10001; [].constructor.apply('', a).length should throw an exception. Was 65537.
PASS var a = []; a.length = 0xFFFFFFFE; [].constructor.apply('', a).length threw exception RangeError: Maximum call stack size exceeded.
PASS var a = []; a.length = 0xFFFFFFFF; [].constructor.apply('', a).length threw exception RangeError: Maximum call stack size exceeded.
PASS (function(a,b,c,d){ return d ? -1 : (a+b+c); }).apply(undefined, {length:3, 0:100, 1:20, 2:3}) is 123
PASS successfullyParsed is true
TEST COMPLETE
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment