Changeset 208923 in webkit


Ignore:
Timestamp:
Nov 19, 2016 12:03:48 AM (7 years ago)
Author:
mark.lam@apple.com
Message:

Fix missing exception checks in JSC inspector files.
https://bugs.webkit.org/show_bug.cgi?id=164959

Reviewed by Saam Barati.

  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::getInternalProperties):
(Inspector::JSInjectedScriptHost::weakMapEntries):
(Inspector::JSInjectedScriptHost::weakSetEntries):
(Inspector::JSInjectedScriptHost::iteratorEntries):

  • inspector/JSJavaScriptCallFrame.cpp:

(Inspector::JSJavaScriptCallFrame::scopeDescriptions):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r208913 r208923  
     12016-11-19  Mark Lam  <mark.lam@apple.com>
     2
     3        Fix missing exception checks in JSC inspector files.
     4        https://bugs.webkit.org/show_bug.cgi?id=164959
     5
     6        Reviewed by Saam Barati.
     7
     8        * inspector/JSInjectedScriptHost.cpp:
     9        (Inspector::JSInjectedScriptHost::getInternalProperties):
     10        (Inspector::JSInjectedScriptHost::weakMapEntries):
     11        (Inspector::JSInjectedScriptHost::weakSetEntries):
     12        (Inspector::JSInjectedScriptHost::iteratorEntries):
     13        * inspector/JSJavaScriptCallFrame.cpp:
     14        (Inspector::JSJavaScriptCallFrame::scopeDescriptions):
     15
    1162016-11-18  Mark Lam  <mark.lam@apple.com>
    217
  • trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp

    r207229 r208923  
    270270        switch (promise->status(exec->vm())) {
    271271        case JSPromise::Status::Pending:
     272            scope.release();
    272273            array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("pending"))));
    273             break;
     274            return array;
    274275        case JSPromise::Status::Fulfilled:
    275276            array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("resolved"))));
     277            RETURN_IF_EXCEPTION(scope, JSValue());
     278            scope.release();
    276279            array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("result"), promise->result(exec->vm())));
    277             break;
     280            return array;
    278281        case JSPromise::Status::Rejected:
    279282            array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("rejected"))));
     283            RETURN_IF_EXCEPTION(scope, JSValue());
     284            scope.release();
    280285            array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("result"), promise->result(exec->vm())));
    281             break;
     286            return array;
    282287        }
    283288        // FIXME: <https://webkit.org/b/141664> Web Inspector: ES6: Improved Support for Promises - Promise Reactions
     289        RELEASE_ASSERT_NOT_REACHED();
     290    }
     291
     292    if (JSBoundFunction* boundFunction = jsDynamicCast<JSBoundFunction*>(value)) {
     293        unsigned index = 0;
     294        JSArray* array = constructEmptyArray(exec, nullptr);
     295        RETURN_IF_EXCEPTION(scope, JSValue());
     296        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction()));
     297        RETURN_IF_EXCEPTION(scope, JSValue());
     298        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis()));
     299        RETURN_IF_EXCEPTION(scope, JSValue());
     300        if (boundFunction->boundArgs()) {
     301            scope.release();
     302            array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundArgs", boundFunction->boundArgs()));
     303            return array;
     304        }
    284305        return array;
    285306    }
    286307
    287     if (JSBoundFunction* boundFunction = jsDynamicCast<JSBoundFunction*>(value)) {
    288         unsigned index = 0;
    289         JSArray* array = constructEmptyArray(exec, nullptr);
    290         RETURN_IF_EXCEPTION(scope, JSValue());
    291         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction()));
    292         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis()));
    293         if (boundFunction->boundArgs())
    294             array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundArgs", boundFunction->boundArgs()));
    295         return array;
    296     }
    297 
    298308    if (ProxyObject* proxy = jsDynamicCast<ProxyObject*>(value)) {
    299309        unsigned index = 0;
     
    301311        RETURN_IF_EXCEPTION(scope, JSValue());
    302312        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target()));
     313        RETURN_IF_EXCEPTION(scope, JSValue());
     314        scope.release();
    303315        array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler()));
    304316        return array;
     
    314326            RETURN_IF_EXCEPTION(scope, JSValue());
    315327            array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue));
     328            RETURN_IF_EXCEPTION(scope, JSValue());
     329            scope.release();
    316330            array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", kind));
    317331            return array;
     
    336350        RETURN_IF_EXCEPTION(scope, JSValue());
    337351        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue()));
     352        RETURN_IF_EXCEPTION(scope, JSValue());
     353        scope.release();
    338354        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
    339355        return array;
     
    357373        RETURN_IF_EXCEPTION(scope, JSValue());
    358374        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue()));
     375        RETURN_IF_EXCEPTION(scope, JSValue());
     376        scope.release();
    359377        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
    360378        return array;
     
    365383        JSArray* array = constructEmptyArray(exec, nullptr, 1);
    366384        RETURN_IF_EXCEPTION(scope, JSValue());
     385        scope.release();
    367386        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec)));
    368387        return array;
     
    373392        JSArray* array = constructEmptyArray(exec, nullptr, 1);
    374393        RETURN_IF_EXCEPTION(scope, JSValue());
     394        scope.release();
    375395        array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue()));
    376396        return array;
     
    437457        entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->value.get());
    438458        array->putDirectIndex(exec, fetched++, entry);
     459        RETURN_IF_EXCEPTION(scope, JSValue());
    439460        if (numberToFetch && fetched >= numberToFetch)
    440461            break;
     
    483504        entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->key);
    484505        array->putDirectIndex(exec, fetched++, entry);
     506        RETURN_IF_EXCEPTION(scope, JSValue());
    485507        if (numberToFetch && fetched >= numberToFetch)
    486508            break;
     
    553575        entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), nextValue);
    554576        array->putDirectIndex(exec, i, entry);
     577        if (UNLIKELY(scope.exception()))
     578            break;
    555579    }
    556580
  • trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp

    r206386 r208923  
    129129JSValue JSJavaScriptCallFrame::scopeDescriptions(ExecState* exec)
    130130{
     131    VM& vm = exec->vm();
     132    auto throwScope = DECLARE_THROW_SCOPE(vm);
     133
    131134    DebuggerScope* scopeChain = impl().scopeChain();
    132135    if (!scopeChain)
     
    144147        description->putDirect(exec->vm(), Identifier::fromString(exec, "location"), valueForScopeLocation(exec, scope->location()));
    145148        array->putDirectIndex(exec, index++, description);
     149        RETURN_IF_EXCEPTION(throwScope, JSValue());
    146150    }
    147151
Note: See TracChangeset for help on using the changeset viewer.