Changeset 94811 in webkit for trunk/Source/JavaScriptCore/API


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/API/JSBase.cpp

    r91401 r94811  
    3030#include "APICast.h"
    3131#include "APIShims.h"
    32 #include "Completion.h"
    3332#include "OpaqueJSString.h"
    3433#include "SourceCode.h"
     
    5352    JSGlobalObject* globalObject = exec->dynamicGlobalObject();
    5453    SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber);
    55     Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), source, jsThisObject);
    5654
    57     if (completion.complType() == Throw) {
     55    JSValue evaluationException;
     56    JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), source, jsThisObject, &evaluationException);
     57
     58    if (evaluationException) {
    5859        if (exception)
    59             *exception = toRef(exec, completion.value());
     60            *exception = toRef(exec, evaluationException);
    6061        return 0;
    6162    }
    6263
    63     if (completion.value())
    64         return toRef(exec, completion.value());
    65    
     64    if (returnValue)
     65        return toRef(exec, returnValue);
     66
    6667    // happens, for example, when the only statement is an empty (';') statement
    6768    return toRef(exec, jsUndefined());
     
    7475
    7576    SourceCode source = makeSource(script->ustring(), sourceURL->ustring(), startingLineNumber);
    76     Completion completion = checkSyntax(exec->dynamicGlobalObject()->globalExec(), source);
    77     if (completion.complType() == Throw) {
     77   
     78    JSValue syntaxException;
     79    bool isValidSyntax = checkSyntax(exec->dynamicGlobalObject()->globalExec(), source, &syntaxException);
     80
     81    if (!isValidSyntax) {
    7882        if (exception)
    79             *exception = toRef(exec, completion.value());
     83            *exception = toRef(exec, syntaxException);
    8084        return false;
    8185    }
    82    
     86
    8387    return true;
    8488}
Note: See TracChangeset for help on using the changeset viewer.