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

    r4612 r6347  
    355355void Interpreter::virtual_hook( int, void* )
    356356{ /*BASE::virtual_hook( id, data );*/ }
     357
     358
     359Interpreter *ExecState::lexicalInterpreter() const
     360{
     361  if (!_context) {
     362    return dynamicInterpreter();
     363  }
     364
     365  InterpreterImp *result = InterpreterImp::interpreterWithGlobalObject(_context->scopeChain().bottom());
     366
     367  if (!result) {
     368    return dynamicInterpreter();
     369  }
     370
     371  return result->interpreter();
     372}
Note: See TracChangeset for help on using the changeset viewer.