Ignore:
Timestamp:
Sep 26, 2016, 4:56:37 PM (9 years ago)
Author:
[email protected]
Message:

Add some needed CatchScopes in code that should not throw.
https://bugs.webkit.org/show_bug.cgi?id=162584

Reviewed by Keith Miller.

  • API/JSObjectRef.cpp:

(JSObjectSetProperty):

  • This function already handles exceptions in its own way. We're honoring this contract and catching exceptions and passing it to the handler.
  • interpreter/Interpreter.cpp:

(JSC::notifyDebuggerOfUnwinding):

  • The debugger should not be throwing any exceptions.
  • jsc.cpp:

(runJSC):

  • the buck stops here. There's no reason an exception should propagate past here.
  • profiler/ProfilerDatabase.cpp:

(JSC::Profiler::Database::save):

  • If an exception was thrown while saving the database, there's nothing we can really do about it anyway. Just fail nicely and return false. This is in line with existing error checking code in Database::save() that returns false if it's not able to open the file to save to.
  • runtime/ExceptionHelpers.cpp:

(JSC::createError):

  • If we're not able to stringify the error value, then we'll just use the provided message as the error string. It doesn't make sense to have the Error factory throw an exception that shadows the intended exception that the client probably wants to throw (assuming that that's why the client is creating this Error object).
  • runtime/JSModuleLoader.cpp:

(JSC::JSModuleLoader::finishCreation):

  • The existing code already RELEASE_ASSERT that no exception was thrown. Hence, it's appropriate to use a CatchScope here.
  • runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::StackFrame::nameFromCallee):

  • The sampling profiler is doing a VMInquiry get here. It should never throw an exception. Hence, we'll just use a CatchScope and assert accordingly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r206386 r206405  
    25402540{
    25412541    JSLockHolder locker(vm);
     2542    auto scope = DECLARE_CATCH_SCOPE(*vm);
    25422543
    25432544    int result;
     
    25462547
    25472548    GlobalObject* globalObject = GlobalObject::create(*vm, GlobalObject::createStructure(*vm, jsNull()), options.m_arguments);
     2549    RETURN_IF_EXCEPTION(scope, 3);
     2550
    25482551    bool success = runWithScripts(globalObject, options.m_scripts, options.m_uncaughtExceptionName, options.m_alwaysDumpUncaughtException, options.m_dump, options.m_module);
    25492552    if (options.m_interactive && success)
Note: See TracChangeset for help on using the changeset viewer.