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_object.cpp

    r5618 r6347  
    122122    Object applyThis;
    123123    if (thisArg.isA(NullType) || thisArg.isA(UndefinedType))
    124       applyThis = exec->interpreter()->globalObject();
     124      applyThis = exec->dynamicInterpreter()->globalObject();
    125125    else
    126126      applyThis = thisArg.toObject(exec);
     
    158158    Object callThis;
    159159    if (thisArg.isA(NullType) || thisArg.isA(UndefinedType))
    160       callThis = exec->interpreter()->globalObject();
     160      callThis = exec->dynamicInterpreter()->globalObject();
    161161    else
    162162      callThis = thisArg.toObject(exec);
     
    215215
    216216  // notify debugger that source has been parsed
    217   Debugger *dbg = exec->interpreter()->imp()->debugger();
     217  Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
    218218  if (dbg) {
    219219    bool cont = dbg->sourceParsed(exec,sid,body,errLine);
     
    234234
    235235  ScopeChain scopeChain;
    236   scopeChain.push(exec->interpreter()->globalObject().imp());
     236  scopeChain.push(exec->dynamicInterpreter()->globalObject().imp());
    237237  FunctionBodyNode *bodyNode = progNode;
    238238
     
    279279  List consArgs;
    280280
    281   Object objCons = exec->interpreter()->builtinObject();
     281  Object objCons = exec->lexicalInterpreter()->builtinObject();
    282282  Object prototype = objCons.construct(exec,List::empty());
    283283  prototype.put(exec, constructorPropertyName, Value(fimp), DontEnum|DontDelete|ReadOnly);
Note: See TracChangeset for help on using the changeset viewer.