forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrorPrototypetoString.js
More file actions
34 lines (28 loc) · 1.09 KB
/
errorPrototypetoString.js
File metadata and controls
34 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
// Test the fix for https://github.com/microsoft/ChakraCore/issues/6372
function checkObject(object)
{
if (object.prototype.hasOwnProperty('toString'))
{
throw new Error(`${object.name}.prototype should not have own property 'toString'`);
}
if(object.prototype.toString !== Error.prototype.toString)
{
throw new Error(`${object.name}.prototype.toString should === Error.prototype.toString`);
}
}
checkObject(EvalError);
checkObject(RangeError);
checkObject(ReferenceError);
checkObject(SyntaxError);
checkObject(URIError);
if (typeof WebAssembly !== 'undefined')
{
checkObject(WebAssembly.CompileError);
checkObject(WebAssembly.LinkError);
checkObject(WebAssembly.RuntimeError);
}
print('pass');