Title: [208923] trunk/Source/_javascript_Core
Revision
208923
Author
[email protected]
Date
2016-11-19 00:03:48 -0800 (Sat, 19 Nov 2016)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (208922 => 208923)


--- trunk/Source/_javascript_Core/ChangeLog	2016-11-19 08:02:03 UTC (rev 208922)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-11-19 08:03:48 UTC (rev 208923)
@@ -1,3 +1,18 @@
+2016-11-19  Mark Lam  <[email protected]>
+
+        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):
+
 2016-11-18  Mark Lam  <[email protected]>
 
         Fix missing exception checks in DFGOperations.cpp.

Modified: trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp (208922 => 208923)


--- trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2016-11-19 08:02:03 UTC (rev 208922)
+++ trunk/Source/_javascript_Core/inspector/JSInjectedScriptHost.cpp	2016-11-19 08:03:48 UTC (rev 208923)
@@ -269,19 +269,24 @@
         RETURN_IF_EXCEPTION(scope, JSValue());
         switch (promise->status(exec->vm())) {
         case JSPromise::Status::Pending:
+            scope.release();
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("pending"))));
-            break;
+            return array;
         case JSPromise::Status::Fulfilled:
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("resolved"))));
+            RETURN_IF_EXCEPTION(scope, JSValue());
+            scope.release();
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("result"), promise->result(exec->vm())));
-            break;
+            return array;
         case JSPromise::Status::Rejected:
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("rejected"))));
+            RETURN_IF_EXCEPTION(scope, JSValue());
+            scope.release();
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("result"), promise->result(exec->vm())));
-            break;
+            return array;
         }
         // FIXME: <https://webkit.org/b/141664> Web Inspector: ES6: Improved Support for Promises - Promise Reactions
-        return array;
+        RELEASE_ASSERT_NOT_REACHED();
     }
 
     if (JSBoundFunction* boundFunction = jsDynamicCast<JSBoundFunction*>(value)) {
@@ -289,9 +294,14 @@
         JSArray* array = constructEmptyArray(exec, nullptr);
         RETURN_IF_EXCEPTION(scope, JSValue());
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction()));
+        RETURN_IF_EXCEPTION(scope, JSValue());
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis()));
-        if (boundFunction->boundArgs())
+        RETURN_IF_EXCEPTION(scope, JSValue());
+        if (boundFunction->boundArgs()) {
+            scope.release();
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundArgs", boundFunction->boundArgs()));
+            return array;
+        }
         return array;
     }
 
@@ -300,6 +310,8 @@
         JSArray* array = constructEmptyArray(exec, nullptr, 2);
         RETURN_IF_EXCEPTION(scope, JSValue());
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target()));
+        RETURN_IF_EXCEPTION(scope, JSValue());
+        scope.release();
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler()));
         return array;
     }
@@ -313,6 +325,8 @@
             JSArray* array = constructEmptyArray(exec, nullptr, 2);
             RETURN_IF_EXCEPTION(scope, JSValue());
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue));
+            RETURN_IF_EXCEPTION(scope, JSValue());
+            scope.release();
             array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", kind));
             return array;
         }
@@ -335,6 +349,8 @@
         JSArray* array = constructEmptyArray(exec, nullptr, 2);
         RETURN_IF_EXCEPTION(scope, JSValue());
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue()));
+        RETURN_IF_EXCEPTION(scope, JSValue());
+        scope.release();
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
         return array;
     }
@@ -356,6 +372,8 @@
         JSArray* array = constructEmptyArray(exec, nullptr, 2);
         RETURN_IF_EXCEPTION(scope, JSValue());
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue()));
+        RETURN_IF_EXCEPTION(scope, JSValue());
+        scope.release();
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
         return array;
     }
@@ -364,6 +382,7 @@
         unsigned index = 0;
         JSArray* array = constructEmptyArray(exec, nullptr, 1);
         RETURN_IF_EXCEPTION(scope, JSValue());
+        scope.release();
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec)));
         return array;
     }
@@ -372,6 +391,7 @@
         unsigned index = 0;
         JSArray* array = constructEmptyArray(exec, nullptr, 1);
         RETURN_IF_EXCEPTION(scope, JSValue());
+        scope.release();
         array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue()));
         return array;
     }
@@ -436,6 +456,7 @@
         entry->putDirect(exec->vm(), Identifier::fromString(exec, "key"), it->key);
         entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->value.get());
         array->putDirectIndex(exec, fetched++, entry);
+        RETURN_IF_EXCEPTION(scope, JSValue());
         if (numberToFetch && fetched >= numberToFetch)
             break;
     }
@@ -482,6 +503,7 @@
         JSObject* entry = constructEmptyObject(exec);
         entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->key);
         array->putDirectIndex(exec, fetched++, entry);
+        RETURN_IF_EXCEPTION(scope, JSValue());
         if (numberToFetch && fetched >= numberToFetch)
             break;
     }
@@ -552,6 +574,8 @@
         JSObject* entry = constructEmptyObject(exec);
         entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), nextValue);
         array->putDirectIndex(exec, i, entry);
+        if (UNLIKELY(scope.exception()))
+            break;
     }
 
     iteratorClose(exec, iterator);

Modified: trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp (208922 => 208923)


--- trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp	2016-11-19 08:02:03 UTC (rev 208922)
+++ trunk/Source/_javascript_Core/inspector/JSJavaScriptCallFrame.cpp	2016-11-19 08:03:48 UTC (rev 208923)
@@ -128,6 +128,9 @@
 
 JSValue JSJavaScriptCallFrame::scopeDescriptions(ExecState* exec)
 {
+    VM& vm = exec->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+
     DebuggerScope* scopeChain = impl().scopeChain();
     if (!scopeChain)
         return jsUndefined();
@@ -143,6 +146,7 @@
         description->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, scope->name()));
         description->putDirect(exec->vm(), Identifier::fromString(exec, "location"), valueForScopeLocation(exec, scope->location()));
         array->putDirectIndex(exec, index++, description);
+        RETURN_IF_EXCEPTION(throwScope, JSValue());
     }
 
     return array;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to