Ignore:
Timestamp:
Sep 8, 2011, 3:38:44 PM (14 years ago)
Author:
[email protected]
Message:

Remove the Completion object from JSC, I have never liked it
https://bugs.webkit.org/show_bug.cgi?id=67755

Reviewed by Gavin Barraclough.

../JavaScriptCore:

  • Removes the Completion object and replaces its use with out parameter exceptions.
  • Remove ComplType and virtual exceptionType() function on JSObject. Replace with ClassInfo for InterruptedExecutionError and TerminatedExecutionError.
  • API/JSBase.cpp:

(JSEvaluateScript):
(JSCheckScriptSyntax):

(JSC::Interpreter::throwException):

  • jsc.cpp:

(functionLoad):
(functionCheckSyntax):
(runWithScripts):
(runInteractive):

  • runtime/Completion.cpp:

(JSC::checkSyntax):
(JSC::evaluate):

  • runtime/Completion.h:
  • runtime/ExceptionHelpers.cpp:

(JSC::InterruptedExecutionError::toString):
(JSC::TerminatedExecutionError::toString):
(JSC::createInterruptedExecutionException):

  • runtime/ExceptionHelpers.h:

(JSC::InterruptedExecutionError::InterruptedExecutionError):
(JSC::InterruptedExecutionError::create):
(JSC::InterruptedExecutionError::createStructure):
(JSC::TerminatedExecutionError::TerminatedExecutionError):
(JSC::TerminatedExecutionError::create):
(JSC::TerminatedExecutionError::createStructure):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):

  • runtime/JSObject.h:

../JavaScriptGlue:

  • JSRun.cpp:

(JSRun::Evaluate):
(JSRun::CheckSyntax):

  • JSRun.h:
  • JavaScriptGlue.cpp:

(JSRunEvaluate):

../WebCore:

  • bindings/js/JSDOMBinding.cpp:

(WebCore::reportException):

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::handleEvent):

  • bindings/js/JSInjectedScriptManager.cpp:

(WebCore::InjectedScriptManager::createInjectedScript):

  • bindings/js/JSMainThreadExecState.h:

(WebCore::JSMainThreadExecState::evaluate):

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::evaluateInWorld):

  • bindings/js/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::evaluate):

  • bindings/objc/WebScriptObject.mm:

(-[WebScriptObject evaluateWebScript:]):

  • bridge/NP_jsobject.cpp:

(_NPN_Evaluate):

  • bridge/jni/jni_jsobject.mm:

(JavaJSObject::eval):

../WebKit/mac:

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::evaluate):

../WebKit/qt:

  • Api/qwebelement.cpp:

(QWebElement::evaluateJavaScript):

../WebKit2:

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::evaluate):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Completion.cpp

    r91095 r94811  
    3535namespace JSC {
    3636
    37 Completion checkSyntax(ExecState* exec, const SourceCode& source)
     37bool checkSyntax(ExecState* exec, const SourceCode& source, JSValue* returnedException)
    3838{
    3939    JSLock lock(exec);
     
    4242    ProgramExecutable* program = ProgramExecutable::create(exec, source);
    4343    JSObject* error = program->checkSyntax(exec);
    44     if (error)
    45         return Completion(Throw, error);
     44    if (error) {
     45        if (returnedException)
     46            *returnedException = error;
     47        return false;
     48    }
    4649
    47     return Completion(Normal);
     50    return true;
    4851}
    4952
    50 Completion evaluate(ExecState* exec, ScopeChainNode* scopeChain, const SourceCode& source, JSValue thisValue)
     53JSValue evaluate(ExecState* exec, ScopeChainNode* scopeChain, const SourceCode& source, JSValue thisValue, JSValue* returnedException)
    5154{
    5255    JSLock lock(exec);
     
    5558    ProgramExecutable* program = ProgramExecutable::create(exec, source);
    5659    if (!program) {
    57         JSValue exception = exec->globalData().exception;
     60        if (returnedException)
     61            *returnedException = exec->globalData().exception;
     62
    5863        exec->globalData().exception = JSValue();
    59         return Completion(Throw, exception);
     64        return jsUndefined();
    6065    }
    6166
     
    6368        thisValue = exec->dynamicGlobalObject();
    6469    JSObject* thisObj = thisValue.toThisObject(exec);
    65 
    6670    JSValue result = exec->interpreter()->execute(program, exec, scopeChain, thisObj);
    6771
    6872    if (exec->hadException()) {
    69         JSValue exception = exec->exception();
     73        if (returnedException)
     74            *returnedException = exec->exception();
     75
    7076        exec->clearException();
     77        return jsUndefined();
     78    }
    7179
    72         ComplType exceptionType = Throw;
    73         if (exception.isObject())
    74             exceptionType = asObject(exception)->exceptionType();
    75         return Completion(exceptionType, exception);
    76     }
    77     return Completion(Normal, result);
     80    ASSERT(result);
     81    return result;
    7882}
    7983
Note: See TracChangeset for help on using the changeset viewer.