Bug 697279 - Properly disable some E4X opcodes in strict mode. r=brendan

This commit is contained in:
Tom Schuster 2011-11-14 20:43:33 +01:00
parent d2d3e17c2f
commit d2e73d550b
2 changed files with 25 additions and 0 deletions

View File

@ -6930,12 +6930,20 @@ Parser::primaryExpr(TokenKind tt, JSBool afterDot)
#if JS_HAS_XML_SUPPORT
case TOK_STAR:
if (tc->inStrictMode()) {
reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
return NULL;
}
pn = qualifiedIdentifier();
if (!pn)
return NULL;
break;
case TOK_AT:
if (tc->inStrictMode()) {
reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
return NULL;
}
pn = attributeIdentifier();
if (!pn)
return NULL;

View File

@ -0,0 +1,17 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
function checkSyntaxError(code) {
var error;
try {
eval(code);
} catch (e) {
error = e;
}
assertEq(error.name, 'SyntaxError');
}
checkSyntaxError('"use strict"; *');
checkSyntaxError('"use strict"; @7');