Reviewed by ggaren.
Fix "new Function()" to correctly use lexical scoping.
Add ScopeChain::print() function for debugging.
<rdar://problem/
4067864> REGRESSION (125-407): JavaScript failure on PeopleSoft REN Server
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/scope_chain.cpp:
(KJS::ScopeChain::print):
* kjs/scope_chain.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13960
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-04-18 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ Fix "new Function()" to correctly use lexical scoping.
+ Add ScopeChain::print() function for debugging.
+ <rdar://problem/4067864> REGRESSION (125-407): JavaScript failure on PeopleSoft REN Server
+
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/scope_chain.cpp:
+ (KJS::ScopeChain::print):
+ * kjs/scope_chain.h:
+
2006-04-14 James G. Speth <speth@end.com>
Reviewed by Timothy.
return throwError(exec, SyntaxError, errMsg, errLine, sid, &sourceURL);
ScopeChain scopeChain;
- scopeChain.push(exec->dynamicInterpreter()->globalObject());
+ scopeChain.push(exec->lexicalInterpreter()->globalObject());
FunctionBodyNode *bodyNode = progNode.get();
FunctionImp* fimp = new DeclaredFunctionImp(exec, functionName, bodyNode, scopeChain);
#include "config.h"
#include "scope_chain.h"
+#include "reference_list.h"
namespace KJS {
}
}
+#ifndef NDEBUG
+
+void ScopeChain::print(ExecState* exec)
+{
+ ScopeChainIterator scopeEnd = end();
+ for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
+ JSObject* o = *scopeIter;
+ ReferenceList propList = o->propList(exec, false);
+ ReferenceListIterator propEnd = propList.end();
+
+ fprintf(stderr, "----- [scope %p] -----\n", o);
+ for (ReferenceListIterator propIter = propList.begin(); propIter != propEnd; propIter++) {
+ Identifier name = propIter->getPropertyName(exec);
+ fprintf(stderr, "%s, ", name.ascii());
+ }
+ fprintf(stderr, "\n");
+ }
+}
+
+#endif
+
} // namespace KJS
namespace KJS {
class JSObject;
+ class ExecState;
class ScopeChainNode {
public:
void pop();
void mark();
+
+#ifndef NDEBUG
+ void print(ExecState*);
+#endif
private:
ScopeChainNode *_node;
+2006-04-18 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by ggaren.
+
+ <rdar://problem/4067864> REGRESSION (125-407): JavaScript failure on PeopleSoft REN Server
+
+ * fast/js/lexical-lookup-in-function-constructor.html: Added.
+ * fast/js/resources/lexical-lookup-in-function-constructor-child.html: Added.
+ * fast/js/lexical-lookup-in-function-constructor-expected.txt: Added.
+
2006-04-18 Beth Dakin <bdakin@apple.com>
Reviewed by Hyatt
--- /dev/null
+SUCCESS
+
+
--- /dev/null
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+message = "FAILURE (Bad lookup)";
+function doTest() {
+ var para = document.getElementById("test");
+ frames[0].doTest(para);
+}
+</script>
+<body onLoad="doTest()">
+<p id="test">FAILURE (Didn't execute)</p>
+<iframe src="resources/lexical-lookup-in-function-constructor-child.html"></iframe>
+</body>
--- /dev/null
+<script>
+message = "SUCCESS";
+function doTest(para) {
+ var f = new Function('para', 'para.innerHTML = message;');
+ f(para);
+}
+</script>
+<body>
+</body>
+