v8/test/inspector/runtime/regress-1078205-expected.txt
Issack John 718f743750 JSON.parse errors made user-friendly
Part of the improve error messages initiative.

Based on a resource of JSON.parse() errors found at
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/JSON_bad_parse

Previously JSON.parse(NaN) would output:
SyntaxError: Unexpected token N in JSON at position 0
Now the output is:
SyntaxError: "NaN" is not valid JSON

Previously JSON.parse("{a:1}") would output:
SyntaxError: Unexpected token a in JSON at position 1
Now the output is:
SyntaxError: Expected property name or '}' in JSON at position 1

Bug: v8:6551
Change-Id: Ic9fad1fdbd295e1302805b81e6603fc526121960
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3513684
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Issack John <issackjohn@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#80567}
2022-05-16 17:02:37 +00:00

157 lines
5.1 KiB
Plaintext

Test malformed sourceURL magic comment.
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//#" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//#" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# " is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# " is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# sourceURL" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# sourceURL" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# sourceURL=" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# sourceURL=" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
}
}
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# sourceURL="" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
exceptionId : <exceptionId>
lineNumber : 0
scriptId : <scriptId>
text : Uncaught
}
result : {
className : SyntaxError
description : SyntaxError: Unexpected token '/', "//# sourceURL="" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6
objectId : <objectId>
subtype : error
type : object
}
}
}