JSLock should clear last exception when releasing the lock
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Jun 2018 21:51:04 +0000 (21:51 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Jun 2018 21:51:04 +0000 (21:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186277

Reviewed by Mark Lam.

If we don't clear the last exception we essentially leak the
object and everything referenced by it until another exception is
thrown.

* runtime/JSLock.cpp:
(JSC::JSLock::willReleaseLock):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232482 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSLock.cpp

index ebaa4bf..4fbf96a 100644 (file)
@@ -1,3 +1,17 @@
+2018-06-04  Keith Miller  <keith_miller@apple.com>
+
+        JSLock should clear last exception when releasing the lock
+        https://bugs.webkit.org/show_bug.cgi?id=186277
+
+        Reviewed by Mark Lam.
+
+        If we don't clear the last exception we essentially leak the
+        object and everything referenced by it until another exception is
+        thrown.
+
+        * runtime/JSLock.cpp:
+        (JSC::JSLock::willReleaseLock):
+
 2018-06-04  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Get rid of UnconditionalFinalizers and WeakReferenceHarvesters
index dfb75a7..51d1870 100644 (file)
@@ -199,6 +199,9 @@ void JSLock::willReleaseLock()
     if (vm) {
         vm->drainMicrotasks();
 
+        if (!vm->topCallFrame)
+            vm->clearLastException();
+
         vm->heap.releaseDelayedReleasedObjects();
         vm->setStackPointerAtVMEntry(nullptr);