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
|
|
|
We overload valueOf method so it return non Primitive value
|
|
|
|
Thus [[DefaultValue]] must return Object.toString() value
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 8.12.8_A3
|
2014-07-22 01:09:02 +02:00
|
|
|
description: >
|
|
|
|
Try to overload toString method, that returned Primitive, and
|
|
|
|
valueOf method, that returned new Object
|
|
|
|
---*/
|
2011-09-07 08:35:18 +02:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2018-02-15 21:11:50 +01:00
|
|
|
var __obj = {
|
|
|
|
toString: function() {
|
|
|
|
return "1"
|
|
|
|
},
|
|
|
|
valueOf: function() {
|
|
|
|
return new Object();
|
|
|
|
}
|
|
|
|
}
|
2011-09-07 08:35:18 +02:00
|
|
|
if (Number(__obj) !== 1) {
|
|
|
|
$ERROR('#1.1: var __obj = {toNumber: function() {return "1"}, valueOf: function() {return new Object();}}; Number(__obj) === 1. Actual: ' + (Number(__obj)));
|
|
|
|
}
|
|
|
|
}
|
2018-02-15 21:11:50 +01:00
|
|
|
catch (e)
|
2011-09-07 08:35:18 +02:00
|
|
|
{
|
|
|
|
$ERROR('#1.2: var __obj = {toNumber: function() {return "1"}, valueOf: function() {return new Object();}}; Number(__obj) === 1. Actual: ' + (e));
|
2014-07-22 01:09:02 +02:00
|
|
|
}
|