Changeset 13960 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Apr 18, 2006, 3:17:41 PM (19 years ago)
Author:
eseidel
Message:

2006-04-18 Eric Seidel <[email protected]>

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:
Location:
trunk/JavaScriptCore/kjs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function_object.cpp

    r13465 r13960  
    205205
    206206  ScopeChain scopeChain;
    207   scopeChain.push(exec->dynamicInterpreter()->globalObject());
     207  scopeChain.push(exec->lexicalInterpreter()->globalObject());
    208208  FunctionBodyNode *bodyNode = progNode.get();
    209209
  • trunk/JavaScriptCore/kjs/scope_chain.cpp

    r12949 r13960  
    2222#include "config.h"
    2323#include "scope_chain.h"
     24#include "reference_list.h"
    2425
    2526namespace KJS {
     
    3536}
    3637
     38#ifndef NDEBUG
     39
     40void ScopeChain::print(ExecState* exec)
     41{
     42    ScopeChainIterator scopeEnd = end();
     43    for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
     44        JSObject* o = *scopeIter;
     45        ReferenceList propList = o->propList(exec, false);
     46        ReferenceListIterator propEnd = propList.end();
     47
     48        fprintf(stderr, "----- [scope %p] -----\n", o);
     49        for (ReferenceListIterator propIter = propList.begin(); propIter != propEnd; propIter++) {
     50            Identifier name = propIter->getPropertyName(exec);
     51            fprintf(stderr, "%s, ", name.ascii());
     52        }
     53        fprintf(stderr, "\n");
     54    }
     55}
     56
     57#endif
     58
    3759} // namespace KJS
  • trunk/JavaScriptCore/kjs/scope_chain.h

    r12317 r13960  
    2828
    2929    class JSObject;
     30    class ExecState;
    3031   
    3132    class ScopeChainNode {
     
    8081       
    8182        void mark();
     83
     84#ifndef NDEBUG       
     85        void print(ExecState*);
     86#endif
    8287       
    8388    private:
Note: See TracChangeset for help on using the changeset viewer.