Ignore:
Timestamp:
Mar 19, 2008, 6:00:15 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-03-19 Sam Weinig <[email protected]>

Reviewed by Anders Carlsson.

Fix for <rdar://problem/5785694>
Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file

Make the activeExecStates stack per JSGlobalObject instead of static to ensure
thread safety.

  • JavaScriptCore.exp:
  • kjs/ExecState.cpp: (KJS::InterpreterExecState::InterpreterExecState): (KJS::InterpreterExecState::~InterpreterExecState): (KJS::EvalExecState::EvalExecState): (KJS::EvalExecState::~EvalExecState): (KJS::FunctionExecState::FunctionExecState): (KJS::FunctionExecState::~FunctionExecState):
  • kjs/ExecState.h: (KJS::):
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::mark):
  • kjs/JSGlobalObject.h: (KJS::JSGlobalObject::activeExecStates):
  • kjs/collector.cpp: (KJS::Collector::collect): (KJS::Collector::reportOutOfMemoryToAllExecStates): Iterate all JSGlobalObjects and report the OutOfMemory condition to all the ExecStates in each.

WebCore:

2008-03-19 Sam Weinig <[email protected]>

Reviewed by Anders Carlsson.

Fix for <rdar://problem/5785694>
Crash occurs at KJS::Collector::collect() when loading web clip widgets with a PAC file

Make the activeExecStates stack per JSGlobalObject instead of static to ensure
thread safety.

  • bindings/objc/WebScriptObject.mm: (+[WebScriptObject throwException:]): Change to throw an exception on the current GlobalObject instead of the top of the static activeExecStates stack. (-[WebScriptObject setException:]): Change to use the top of the rootObjects GlobalObject instead of the top of the static activeExecStates stack.
  • bridge/c/c_instance.cpp:
  • bridge/c/c_instance.h:
  • bridge/jni/jni_instance.cpp: (JavaInstance::virtualBegin): (JavaInstance::virtualEnd):
  • bridge/jni/jni_instance.h:
  • bridge/objc/objc_instance.h:
  • bridge/objc/objc_instance.mm: (ObjcInstance::~ObjcInstance): (ObjcInstance::virtualBegin): (ObjcInstance::virtualEnd):
  • bridge/runtime.cpp: (KJS::Bindings::Instance::setDidExecuteFunction): (KJS::Bindings::Instance::didExecuteFunction): (KJS::Bindings::Instance::setCurrentGlobalObject): Added. (KJS::Bindings::Instance::currentGlobalObject): Added. (KJS::Bindings::Instance::begin): (KJS::Bindings::Instance::end):
  • bridge/runtime.h: (KJS::Bindings::Instance::virtualBegin): Renamed from begin(). (KJS::Bindings::Instance::virtualEnd): Renamed from end(). We now store the currently active globalObject everytime we cross the runtime object boundary. To do this, we take advantage of the existing begin/end methods that are called when crossing this boundary, making begin set the current globalObject and then call the old begin, now called virtualBegin.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ExecState.h

    r30871 r31167  
    4646   
    4747    enum CodeType { GlobalCode, EvalCode, FunctionCode };
    48    
    49     typedef Vector<ExecState*, 16> ExecStateStack;
    5048
    5149    // Represents the current state of script execution.
    5250    // Passed as the first argument to most functions.
    5351    class ExecState : Noncopyable {
     52        friend class JSGlobalObject;
    5453    public:
    5554        // Global object that was in scope when the current script started executing.
     
    165164        }
    166165
    167         static void markActiveExecStates();
    168         static ExecStateStack& activeExecStates();
    169 
    170166    protected:
    171167        ExecState(JSGlobalObject*);
Note: See TracChangeset for help on using the changeset viewer.