[Debug] ASSERT(!throwScope.exception()) on imported/w3c/web-platform-tests/fetch...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 02:45:45 +0000 (02:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 02:45:45 +0000 (02:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170395
<rdar://problem/31394017>

Patch by Youenn Fablet <youenn@apple.com> on 2017-04-06
Reviewed by Mark Lam.

* bindings/js/JSDOMPromise.cpp:
(WebCore::DeferredPromise::reject): Exiting early in case of scope having an exception.
Adding an assertion to ensure this is a worker termination exception.

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

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMPromise.cpp

index 3343954..511fe56 100644 (file)
@@ -1,3 +1,15 @@
+2017-04-06  Youenn Fablet  <youenn@apple.com>
+
+        [Debug] ASSERT(!throwScope.exception()) on imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
+        https://bugs.webkit.org/show_bug.cgi?id=170395
+        <rdar://problem/31394017>
+
+        Reviewed by Mark Lam.
+
+        * bindings/js/JSDOMPromise.cpp:
+        (WebCore::DeferredPromise::reject): Exiting early in case of scope having an exception.
+        Adding an assertion to ensure this is a worker termination exception.
+
 2017-04-06  Andreas Kling  <akling@apple.com>
 
         Inaudible background tabs should become eligible for memory kill after 8 minutes
index 0739b9b..6c97178 100644 (file)
@@ -95,9 +95,12 @@ void DeferredPromise::reject(Exception&& exception)
     auto& state = *m_globalObject->globalExec();
     JSC::JSLockHolder locker(&state);
 
-    auto scope = DECLARE_CATCH_SCOPE(state.vm());
+    auto scope = DECLARE_THROW_SCOPE(state.vm());
     auto error = createDOMException(state, WTFMove(exception));
-    ASSERT_UNUSED(scope, !scope.exception());
+    if (UNLIKELY(scope.exception())) {
+        ASSERT(isTerminatedExecutionException(state.vm(), scope.exception()));
+        return;
+    }
 
     reject(state, error);
 }
@@ -112,9 +115,13 @@ void DeferredPromise::reject(ExceptionCode ec, const String& message)
     auto& state = *m_globalObject->globalExec();
     JSC::JSLockHolder locker(&state);
 
-    auto scope = DECLARE_CATCH_SCOPE(state.vm());
+    auto scope = DECLARE_THROW_SCOPE(state.vm());
     auto error = createDOMException(&state, ec, message);
-    ASSERT_UNUSED(scope, !scope.exception());
+    if (UNLIKELY(scope.exception())) {
+        ASSERT(isTerminatedExecutionException(state.vm(), scope.exception()));
+        return;
+    }
+
 
     reject(state, error);
 }