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/function.cpp

    r5671 r6347  
    5757FunctionImp::FunctionImp(ExecState *exec, const Identifier &n)
    5858  : InternalFunctionImp(
    59       static_cast<FunctionPrototypeImp*>(exec->interpreter()->builtinFunctionPrototype().imp())
     59      static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype().imp())
    6060      ), param(0L), ident(n)
    6161{
     
    7474Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
    7575{
    76   Object &globalObj = exec->interpreter()->globalObject();
    77 
    78   Debugger *dbg = exec->interpreter()->imp()->debugger();
     76  Object &globalObj = exec->dynamicInterpreter()->globalObject();
     77
     78  Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
    7979  int sid = -1;
    8080  int lineno = -1;
     
    9494
    9595  // enter a new execution context
    96   ContextImp ctx(globalObj, exec->interpreter()->imp(), thisObj, codeType(),
     96  ContextImp ctx(globalObj, exec->dynamicInterpreter()->imp(), thisObj, codeType(),
    9797                 exec->context().imp(), this, &args);
    98   ExecState newExec(exec->interpreter(), &ctx);
     98  ExecState newExec(exec->dynamicInterpreter(), &ctx);
    9999  newExec.setException(exec->exception()); // could be null
    100100
     
    283283    proto = Object(static_cast<ObjectImp*>(p.imp()));
    284284  else
    285     proto = exec->interpreter()->builtinObjectPrototype();
     285    proto = exec->lexicalInterpreter()->builtinObjectPrototype();
    286286
    287287  Object obj(new ObjectImp(proto));
     
    315315// ECMA 10.1.8
    316316ArgumentsImp::ArgumentsImp(ExecState *exec, FunctionImp *func)
    317   : ArrayInstanceImp(exec->interpreter()->builtinObjectPrototype().imp(), 0)
     317  : ArrayInstanceImp(exec->lexicalInterpreter()->builtinObjectPrototype().imp(), 0)
    318318{
    319319  Value protect(this);
     
    322322
    323323ArgumentsImp::ArgumentsImp(ExecState *exec, FunctionImp *func, const List &args)
    324   : ArrayInstanceImp(exec->interpreter()->builtinObjectPrototype().imp(), args)
     324  : ArrayInstanceImp(exec->lexicalInterpreter()->builtinObjectPrototype().imp(), args)
    325325{
    326326  Value protect(this);
     
    541541      // enter a new execution context
    542542      Object thisVal(Object::dynamicCast(exec->context().thisValue()));
    543       ContextImp ctx(exec->interpreter()->globalObject(),
    544                      exec->interpreter()->imp(),
     543      ContextImp ctx(exec->dynamicInterpreter()->globalObject(),
     544                     exec->dynamicInterpreter()->imp(),
    545545                     thisVal,
    546546                     EvalCode,
    547547                     exec->context().imp());
    548548
    549       ExecState newExec(exec->interpreter(), &ctx);
     549      ExecState newExec(exec->dynamicInterpreter(), &ctx);
    550550      newExec.setException(exec->exception()); // could be null
    551551
Note: See TracChangeset for help on using the changeset viewer.