Ignore:
Timestamp:
Jan 26, 2009, 3:57:55 PM (16 years ago)
Author:
[email protected]
Message:

2009-01-26 Cameron Zwarich <[email protected]>

Reviewed by Gavin Barraclough.

Bug 23552: Dashcode evaluator no longer works after making ExecStates actual call frames
<https://bugs.webkit.org/show_bug.cgi?id=23552>
<rdar://problem/6398839>

Dashcode will crash when using the evaluator because it saves a global call
frame, even after global code has finished executing, and then uses this as
a launching pad to execute new JS in the evaluator. The fix is to detect
when Dashcode is attempting to do this and execute code from a global call
frame instead.

JavaScriptCore:

  • JavaScriptCore.exp:
  • debugger/Debugger.cpp: (JSC::evaluateInGlobalCallFrame): Added so that WebScriptCallFrame can evaluate JS starting from a global call frame.
  • debugger/Debugger.h:

WebKit/mac:

  • ForwardingHeaders/runtime/Protect.h: Added.
  • WebView/WebScriptDebugDelegate.mm: (-[WebScriptCallFrame _initWithGlobalObject:debugger:caller:debuggerCallFrame:]): Added debugger, a WebScriptDebugger* argument. (-[WebScriptCallFrame evaluateWebScript:]): Detect when Dashcode is using a stale WebScriptCallFrame to execute new JS and evaluate it starting from the global object's global call frame instead.
  • WebView/WebScriptDebugger.h: (WebScriptDebugger::globalObject): Added. (WebScriptDebugger::globalCallFrame): Added.
  • WebView/WebScriptDebugger.mm: (WebScriptDebugger::WebScriptDebugger): Initialize m_globalObject. (WebScriptDebugger::initGlobalCallFrame): Created as a clone of callEvent so that the global call frame can be saved immediately after being created. (WebScriptDebugger::callEvent): Pass 'this' as the debugger argument of WebScriptCallFrame's _initWithGlobalObject method.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/debugger/Debugger.cpp

    r38027 r40274  
    5252}
    5353
     54JSValuePtr evaluateInGlobalCallFrame(const UString& script, JSValuePtr& exception, JSGlobalObject* globalObject)
     55{
     56    CallFrame* globalCallFrame = globalObject->globalExec();
     57
     58    int errLine;
     59    UString errMsg;
     60    SourceCode source = makeSource(script);
     61    RefPtr<EvalNode> evalNode = globalObject->globalData()->parser->parse<EvalNode>(globalCallFrame, globalObject->debugger(), source, &errLine, &errMsg);
     62    if (!evalNode)
     63        return Error::create(globalCallFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
     64
     65    return globalObject->globalData()->interpreter->execute(evalNode.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
     66}
     67
    5468} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.