Changeset 6347 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Apr 9, 2004, 1:07:47 PM (21 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by John.

Changed things so that newly created objects get a prototype based
on the scope chain of the current function, rather than the
interpreter that started execution. This fixes the following bugs:

<rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
<rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)

  • JavaScriptCore.pbproj/project.pbxproj:
  • kjs/array_object.cpp: (CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments): (ArrayProtoFuncImp::ArrayProtoFuncImp): (ArrayProtoFuncImp::call): (ArrayObjectImp::construct):
  • kjs/bool_object.cpp: (BooleanObjectImp::construct):
  • kjs/date_object.cpp: (DateProtoFuncImp::DateProtoFuncImp): (DateProtoFuncImp::call): (DateObjectImp::construct):
  • kjs/error_object.cpp: (ErrorObjectImp::construct):
  • kjs/function.cpp: (FunctionImp::FunctionImp): (FunctionImp::call): (DeclaredFunctionImp::construct): (ArgumentsImp::ArgumentsImp): (GlobalFuncImp::call):
  • kjs/function_object.cpp: (FunctionProtoFuncImp::call): (FunctionObjectImp::construct):
  • kjs/internal.cpp: (BooleanImp::toObject): (StringImp::toObject): (NumberImp::toObject): (InterpreterImp::InterpreterImp): (InterpreterImp::clear): (InterpreterImp::interpreterWithGlobalObject):
  • kjs/internal.h:
  • kjs/interpreter.cpp: (ExecState::lexicalInterpreter):
  • kjs/interpreter.h: (KJS::ExecState::dynamicInterpreter): (KJS::ExecState::interpreter):
  • kjs/math_object.cpp: (MathFuncImp::MathFuncImp):
  • kjs/nodes.cpp: (StatementNode::hitStatement): (StatementNode::abortStatement): (RegExpNode::evaluate): (ElementNode::evaluate): (ArrayNode::evaluate): (ObjectLiteralNode::evaluate): (PropertyValueNode::evaluate): (FunctionCallNode::evaluate): (FuncDeclNode::processFuncDecl): (FuncExprNode::evaluate):
  • kjs/number_object.cpp: (NumberObjectImp::construct):
  • kjs/object.cpp: (KJS::ObjectImp::defaultValue): (KJS::Error::create):
  • kjs/object_object.cpp: (ObjectObjectImp::construct):
  • kjs/reference.cpp: (Reference::putValue):
  • kjs/regexp_object.cpp: (RegExpProtoFuncImp::call): (RegExpObjectImp::arrayOfMatches): (RegExpObjectImp::construct):
  • kjs/scope_chain.cpp: (KJS::ScopeChain::bottom):
  • kjs/scope_chain.h:
  • kjs/string_object.cpp: (StringProtoFuncImp::StringProtoFuncImp): (StringProtoFuncImp::call): (StringObjectImp::construct):

WebCore:

Reviewed by John.

Changed things so that newly created objects get a prototype based
on the scope chain of the current function, rather than the
interpreter that started execution. This fixes the following bugs:

<rdar://problem/3368523>: ARCH: wrong prototype used to create new objects (hang on lookup.atomica.com)
<rdar://problem/3559173>: ARCH: Cannot scan using a HP Jetdirect product (JS object prototypes bind incorrectly)

  • khtml/ecma/kjs_binding.h: (KJS::cacheDOMObject): (KJS::cacheGlobalObject):
  • khtml/ecma/kjs_css.cpp: (KJS::getDOMStyleSheet): (KJS::getDOMStyleSheetList): (KJS::getDOMCSSValue):
  • khtml/ecma/kjs_dom.cpp: (KJS::getDOMDocumentNode): (KJS::getDOMNode):
  • khtml/ecma/kjs_events.cpp: (KJS::getDOMEvent):
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::tryGet): (KJS::HTMLDocument::putValue): (KJS::getSelectHTMLCollection):
  • khtml/ecma/kjs_navigator.cpp: (Navigator::Navigator): (PluginBase::PluginBase):
  • khtml/ecma/kjs_window.cpp: (KJS::History::History): (KJS::FrameArray::FrameArray): (Screen::Screen): (Window::retrieveActive): (Window::put): (Window::isSafeScript): (WindowFunc::tryCall): (Location::put): (LocationFunc::tryCall):
File:
1 edited

Legend:

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

    r5645 r6347  
    5353
    5454#define KJS_ABORTPOINT \
    55   if (exec->interpreter()->imp()->debugger() && \
    56       exec->interpreter()->imp()->debugger()->imp()->aborted()) \
     55  if (exec->dynamicInterpreter()->imp()->debugger() && \
     56      exec->dynamicInterpreter()->imp()->debugger()->imp()->aborted()) \
    5757    return Completion(Normal);
    5858
     
    177177bool StatementNode::hitStatement(ExecState *exec)
    178178{
    179   Debugger *dbg = exec->interpreter()->imp()->debugger();
     179  Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
    180180  if (dbg)
    181181    return dbg->atStatement(exec,sid,l0,l1);
     
    187187bool StatementNode::abortStatement(ExecState *exec)
    188188{
    189   Debugger *dbg = exec->interpreter()->imp()->debugger();
     189  Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
    190190  if (dbg)
    191191    return dbg->imp()->aborted();
     
    236236  list.append(f);
    237237
    238   Object reg = exec->interpreter()->imp()->builtinRegExp();
     238  Object reg = exec->lexicalInterpreter()->imp()->builtinRegExp();
    239239  return reg.construct(exec,list);
    240240}
     
    329329Value ElementNode::evaluate(ExecState *exec)
    330330{
    331   Object array = exec->interpreter()->builtinArray().construct(exec, List::empty());
     331  Object array = exec->lexicalInterpreter()->builtinArray().construct(exec, List::empty());
    332332  int length = 0;
    333333  for (ElementNode *n = this; n; n = n->list) {
     
    367367    length = opt ? array.get(exec,lengthPropertyName).toInt32(exec) : 0;
    368368  } else {
    369     Value newArr = exec->interpreter()->builtinArray().construct(exec,List::empty());
     369    Value newArr = exec->lexicalInterpreter()->builtinArray().construct(exec,List::empty());
    370370    array = Object(static_cast<ObjectImp*>(newArr.imp()));
    371371    length = 0;
     
    400400    return list->evaluate(exec);
    401401
    402   return exec->interpreter()->builtinObject().construct(exec,List::empty());
     402  return exec->lexicalInterpreter()->builtinObject().construct(exec,List::empty());
    403403}
    404404
     
    434434Value PropertyValueNode::evaluate(ExecState *exec)
    435435{
    436   Object obj = exec->interpreter()->builtinObject().construct(exec, List::empty());
     436  Object obj = exec->lexicalInterpreter()->builtinObject().construct(exec, List::empty());
    437437 
    438438  for (PropertyValueNode *p = this; p; p = p->list) {
     
    717717    // that in host objects you always get a valid object for this.
    718718    // thisVal = Null();
    719     thisVal = exec->interpreter()->globalObject();
     719    thisVal = exec->dynamicInterpreter()->globalObject();
    720720  }
    721721
     
    27262726  Object func(fimp); // protect from GC
    27272727
    2728   //  Value proto = exec->interpreter()->builtinObject().construct(exec,List::empty());
     2728  //  Value proto = exec->lexicalInterpreter()->builtinObject().construct(exec,List::empty());
    27292729  List empty;
    2730   Object proto = exec->interpreter()->builtinObject().construct(exec,empty);
     2730  Object proto = exec->lexicalInterpreter()->builtinObject().construct(exec,empty);
    27312731  proto.put(exec, constructorPropertyName, func, ReadOnly|DontDelete|DontEnum);
    27322732  func.put(exec, prototypePropertyName, proto, Internal|DontDelete);
     
    27792779  Value ret(fimp);
    27802780  List empty;
    2781   Value proto = exec->interpreter()->builtinObject().construct(exec,empty);
     2781  Value proto = exec->lexicalInterpreter()->builtinObject().construct(exec,empty);
    27822782  fimp->put(exec, prototypePropertyName, proto, Internal|DontDelete);
    27832783
Note: See TracChangeset for help on using the changeset viewer.