2011-09-07 08:35:18 +02:00
|
|
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2014-07-22 01:09:02 +02:00
|
|
|
This should generate a TypeError,
|
|
|
|
Cause we overload toString method so it return non Primitive value
|
|
|
|
See ECMA reference at http://bugzilla.mozilla.org/show_bug.cgi?id=167325
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 8.12.8_A1
|
2014-07-22 01:09:02 +02:00
|
|
|
description: Try to overload toString method
|
|
|
|
---*/
|
2011-09-07 08:35:18 +02:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2018-02-15 21:39:13 +01:00
|
|
|
var __obj = {
|
|
|
|
toString: function() {
|
|
|
|
return new Object();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String(__obj);
|
2021-07-21 22:36:17 +02:00
|
|
|
throw new Test262Error('#1.1: var __obj = {toString: function() {return new Object();}}; String(__obj) throw TypeError. Actual: ' + (String(__obj)));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
2018-02-15 21:39:13 +01:00
|
|
|
catch (e)
|
2011-09-07 08:35:18 +02:00
|
|
|
{
|
2018-02-15 21:39:13 +01:00
|
|
|
if ((e instanceof TypeError) !== true) {
|
2021-07-21 22:36:17 +02:00
|
|
|
throw new Test262Error('#1.2: var __obj = {toString: function() {return new Object();}}; String(__obj) throw TypeError. Actual: ' + (e));
|
2018-02-15 21:39:13 +01:00
|
|
|
}
|
2014-07-22 01:09:02 +02:00
|
|
|
}
|