mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 672854 - Crash when a syntax error is encountered immediately after the |in| in a for-in loop header. NOT REVIEWED YET
--HG-- extra : rebase_source : 875a214b0d0b140649b0845fb649c5c4926e4804
This commit is contained in:
parent
55a0fe3577
commit
252a1b2636
@ -5242,6 +5242,8 @@ Parser::forStatement()
|
||||
tc->topStmt = save->down;
|
||||
#endif
|
||||
pn3 = expr();
|
||||
if (!pn3)
|
||||
return NULL;
|
||||
#if JS_HAS_BLOCK_SCOPE
|
||||
if (let)
|
||||
tc->topStmt = save;
|
||||
|
@ -2,6 +2,7 @@ url-prefix ../../jsreftest.html?test=ecma_5/misc/
|
||||
script global-numeric-properties.js
|
||||
script line-paragraph-separator-parse-as-lineterminator.js
|
||||
script redeclare-var-non-writable-property.js
|
||||
script syntax-error-end-of-for-head-part.js
|
||||
script enumerate-undefined.js
|
||||
script unwrapped-no-such-method.js
|
||||
script explicit-undefined-optional-argument.js
|
||||
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/licenses/publicdomain/
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 672854;
|
||||
var summary =
|
||||
"Syntax errors at the end of |for| statement header parts shouldn't cause " +
|
||||
"crashes";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
function checkSyntaxError(str)
|
||||
{
|
||||
try
|
||||
{
|
||||
var f = Function("for(w in\\");
|
||||
throw new Error("didn't throw, returned " + f);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
assertEq(e instanceof SyntaxError, true,
|
||||
"expected SyntaxError, got " + e);
|
||||
}
|
||||
}
|
||||
|
||||
checkSyntaxError("for(var w in \\");
|
||||
checkSyntaxError("for(w in \\");
|
||||
checkSyntaxError("for(var w\\");
|
||||
checkSyntaxError("for(w\\");
|
||||
checkSyntaxError("for(var w;\\");
|
||||
checkSyntaxError("for(w;\\");
|
||||
checkSyntaxError("for(var w; w >\\");
|
||||
checkSyntaxError("for(w; w >\\");
|
||||
checkSyntaxError("for(var w; w > 3;\\");
|
||||
checkSyntaxError("for(w; w > 3;\\");
|
||||
checkSyntaxError("for(var w; w > 3; 5\\");
|
||||
checkSyntaxError("for(w; w > 3; 5\\");
|
||||
checkSyntaxError("for(var w; w > 3; 5foo");
|
||||
checkSyntaxError("for(w; w > 3; 5foo");
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete!");
|
Loading…
Reference in New Issue
Block a user