Bug 684489 - Fix a strict direct eval bug affecting Google Maps. r=Waldo.

--HG--
extra : rebase_source : 5e708cc26a923934a363f327696bcd2913038f21
This commit is contained in:
Jason Orendorff 2011-10-27 08:58:33 -05:00
Родитель 78176dbb9c
Коммит 32cc1c8be6
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -1510,7 +1510,17 @@ Parser::setFunctionKinds(FunctionBox *funbox, uint32 *tcflags)
if (funbox->tcflags & TCF_FUN_HEAVYWEIGHT) {
/* nothing to do */
} else if (funbox->inAnyDynamicScope()) {
} else if (callerFrame || funbox->inAnyDynamicScope()) {
/*
* Either we are in a with-block or a function scope that is
* subject to direct eval; or we are compiling strict direct eval
* code.
*
* In either case, fun may reference names that are not bound but
* are not necessarily global either. (In the strict direct eval
* case, we could bind them, but currently do not bother; see
* the comment about strict mode code in BindTopLevelVar.)
*/
JS_ASSERT(!fun->isNullClosure());
} else {
bool hasUpvars = false;

Просмотреть файл

@ -0,0 +1,2 @@
"use strict";
eval("var x = {}; ({p: function() { x.m; }}).p();");