зеркало из https://github.com/mozilla/gecko-dev.git
Hello Norris
The following test case case leads to a compilation error in Rhino. In this script alert is an user defined function in the global object and it shows the value of the specified parameter in a popup window. Save the script as a html file and run it under Netscape and IE. The output via their JS engines is that alert(1) executes but the execution of line fails as blks variable is undefined. The Fix bug: Rhino engine fails at compilation time itself and cannot excute the script. It doesn't like the syntax of line. Steven /// **************** test case ************** /// <script> alert(1); blks[ 10 << 2 ] |= true; alert(2); </script> /// ********************** Error Message ************************** //// evaluating script: null java.lang.NullPointerException at org.mozilla.javascript.Interpreter.generateICode(Compiled Code) at org.mozilla.javascript.Interpreter.generateICode(Compiled Code) at org.mozilla.javascript.Interpreter.generateICode(Compiled Code) at org.mozilla.javascript.Interpreter.generateICode(Compiled Code) at org.mozilla.javascript.Interpreter.generateICode(Compiled Code) at org.mozilla.javascript.Interpreter.generateICodeFromTree(Compiled Code) at org.mozilla.javascript.Interpreter.generateScriptICode(Interpreter.java) at org.mozilla.javascript.Interpreter.compile(Interpreter.java) at org.mozilla.javascript.Context.compile(Context.java) at org.mozilla.javascript.Context.compile(Context.java)
This commit is contained in:
Родитель
db43fadc93
Коммит
787b93699a
|
@ -801,15 +801,6 @@ public class IRFactory {
|
|||
// OPT: could optimize to GETPROP iff string can't be a number
|
||||
nodeType = TokenStream.GETELEM;
|
||||
break;
|
||||
/*
|
||||
case TokenStream.AND:
|
||||
temp = createNewTemp((Node) left);
|
||||
return createTernary(temp, right, createUseTemp(temp));
|
||||
|
||||
case TokenStream.OR:
|
||||
temp = createNewTemp((Node) left);
|
||||
return createTernary(temp, createUseTemp(temp), right);
|
||||
*/
|
||||
}
|
||||
return new Node(nodeType, (Node)left, (Node)right);
|
||||
}
|
||||
|
@ -989,9 +980,9 @@ public class IRFactory {
|
|||
*
|
||||
*/
|
||||
Node tmp1, tmp2, opLeft;
|
||||
if (hasSideEffects(expr)
|
||||
|| hasSideEffects(id)
|
||||
|| (obj.getType() != TokenStream.NAME)) {
|
||||
if (obj.getType() != TokenStream.NAME || id.hasChildren() ||
|
||||
hasSideEffects(expr) || hasSideEffects(id))
|
||||
{
|
||||
tmp1 = createNewTemp(obj);
|
||||
Node useTmp1 = createUseTemp(tmp1);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче