Unreviewed, rolling out r216635.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2017 23:48:33 +0000 (23:48 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2017 23:48:33 +0000 (23:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171953

"Some worker tests are failing". (Requested by mlam on #webkit).

Reverted changeset:

"WorkerThread::stop() should call
scheduleExecutionTermination() last."
https://bugs.webkit.org/show_bug.cgi?id=171775
http://trac.webkit.org/changeset/216635

Patch by Commit Queue <commit-queue@webkit.org> on 2017-05-10

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ExceptionScope.cpp
Source/JavaScriptCore/runtime/ExceptionScope.h
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMPromiseDeferred.cpp
Source/WebCore/workers/WorkerThread.cpp

index a1daef0..6883bc0 100644 (file)
@@ -1,3 +1,17 @@
+2017-05-10  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r216635.
+        https://bugs.webkit.org/show_bug.cgi?id=171953
+
+        "Some worker tests are failing". (Requested by mlam on #webkit).
+
+        Reverted changeset:
+
+        "WorkerThread::stop() should call
+        scheduleExecutionTermination() last."
+        https://bugs.webkit.org/show_bug.cgi?id=171775
+        http://trac.webkit.org/changeset/216635
+
 2017-05-10  Mark Lam  <mark.lam@apple.com>
 
         WorkerThread::stop() should call scheduleExecutionTermination() last.
index 9d23372..15ae457 100644 (file)
@@ -365,6 +365,9 @@ imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html [ Pass
 
 webkit.org/b/161312 imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/document-without-browsing-context.html [ Failure Pass ]
 
+# rdar://problem/30975761
+[ Debug ] http/tests/fetch/fetch-in-worker-crash.html [ Skip ]
+
 imported/w3c/web-platform-tests/XMLHttpRequest/send-conditional-cors.htm [ Failure ]
 imported/w3c/web-platform-tests/fetch/http-cache/partial.html [ Failure ]
 webkit.org/b/159724 imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-post-upload.htm [ Failure Pass ]
index 32e2c12..7bdfcd9 100644 (file)
@@ -1,3 +1,17 @@
+2017-05-10  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r216635.
+        https://bugs.webkit.org/show_bug.cgi?id=171953
+
+        "Some worker tests are failing". (Requested by mlam on #webkit).
+
+        Reverted changeset:
+
+        "WorkerThread::stop() should call
+        scheduleExecutionTermination() last."
+        https://bugs.webkit.org/show_bug.cgi?id=171775
+        http://trac.webkit.org/changeset/216635
+
 2017-05-10  Mark Lam  <mark.lam@apple.com>
 
         Crash in JavaScriptCore GC when using JSC on dispatch queues (thread_get_state returns NULL stack pointer).
index 39da9dc..2e64787 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "ExceptionScope.h"
 
 #include "Exception.h"
-#include "ExceptionHelpers.h"
 #include <wtf/StackTrace.h>
 #include <wtf/StringPrintStream.h>
-#include <wtf/Threading.h>
 
 namespace JSC {
     
@@ -55,14 +53,14 @@ CString ExceptionScope::unexpectedExceptionMessage()
 {
     StringPrintStream out;
 
-    out.println("Unexpected exception observed on thread ", currentThread(), " at:");
-    auto currentStack = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(100, 1));
+    out.println("Unexpected exception observed at:");
+    auto currentStack = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(25, 1));
     currentStack->dump(out, "    ");
 
     if (!m_vm.nativeStackTraceOfLastThrow())
         return CString();
     
-    out.println("The exception was thrown from thread ", m_vm.throwingThread(), " at:");
+    out.println("The exception was thrown from:");
     m_vm.nativeStackTraceOfLastThrow()->dump(out, "    ");
 
     return out.toCString();
@@ -70,9 +68,4 @@ CString ExceptionScope::unexpectedExceptionMessage()
 
 #endif // ENABLE(EXCEPTION_SCOPE_VERIFICATION)
     
-void ExceptionScope::releaseAssertIsTerminatedExecutionException()
-{
-    RELEASE_ASSERT_WITH_MESSAGE(isTerminatedExecutionException(m_vm, exception()), "%s", unexpectedExceptionMessage().data());
-}
-
 } // namespace JSC
index 8251bb7..7df8e02 100644 (file)
@@ -42,8 +42,6 @@ public:
     ALWAYS_INLINE void assertNoException() { ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
     ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
 
-    void releaseAssertIsTerminatedExecutionException();
-
 protected:
     ExceptionScope(VM&, ExceptionEventLocation);
     ExceptionScope(const ExceptionScope&) = delete;
@@ -64,12 +62,11 @@ class ExceptionScope {
 public:
     ALWAYS_INLINE VM& vm() const { return m_vm; }
     ALWAYS_INLINE Exception* exception() { return m_vm.exception(); }
+    ALWAYS_INLINE CString unexpectedExceptionMessage() { return { }; }
 
     ALWAYS_INLINE void assertNoException() { ASSERT(!exception()); }
     ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT(!exception()); }
 
-    void releaseAssertIsTerminatedExecutionException();
-
 protected:
     ALWAYS_INLINE ExceptionScope(VM& vm)
         : m_vm(vm)
@@ -77,8 +74,6 @@ protected:
     ExceptionScope(const ExceptionScope&) = delete;
     ExceptionScope(ExceptionScope&&) = default;
 
-    ALWAYS_INLINE CString unexpectedExceptionMessage() { return { }; }
-
     VM& m_vm;
 };
     
index 91ecfc1..c3fc541 100644 (file)
@@ -619,8 +619,7 @@ void VM::throwException(ExecState* exec, Exception* exception)
     setException(exception);
 
 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
-    m_nativeStackTraceOfLastThrow = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(100));
-    m_throwingThread = currentThread();
+    m_nativeStackTraceOfLastThrow = std::unique_ptr<StackTrace>(StackTrace::captureStackTrace(25));
 #endif
 }
 
index 997e6ce..178a3e2 100644 (file)
@@ -684,7 +684,6 @@ public:
 
 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
     StackTrace* nativeStackTraceOfLastThrow() const { return m_nativeStackTraceOfLastThrow.get(); }
-    ThreadIdentifier throwingThread() const { return m_throwingThread; }
 #endif
 
 private:
@@ -720,7 +719,6 @@ private:
 #if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
         m_needExceptionCheck = false;
         m_nativeStackTraceOfLastThrow = nullptr;
-        m_throwingThread = 0;
 #endif
         m_exception = nullptr;
     }
@@ -768,7 +766,6 @@ private:
     unsigned m_simulatedThrowPointRecursionDepth { 0 };
     mutable bool m_needExceptionCheck { false };
     std::unique_ptr<StackTrace> m_nativeStackTraceOfLastThrow;
-    ThreadIdentifier m_throwingThread;
 #endif
 
     bool m_failNextNewCodeBlock { false };
index 491f851..3679412 100644 (file)
@@ -1,3 +1,17 @@
+2017-05-10  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r216635.
+        https://bugs.webkit.org/show_bug.cgi?id=171953
+
+        "Some worker tests are failing". (Requested by mlam on #webkit).
+
+        Reverted changeset:
+
+        "WorkerThread::stop() should call
+        scheduleExecutionTermination() last."
+        https://bugs.webkit.org/show_bug.cgi?id=171775
+        http://trac.webkit.org/changeset/216635
+
 2017-05-10  Mark Lam  <mark.lam@apple.com>
 
         WorkerThread::stop() should call scheduleExecutionTermination() last.
index 0a58989..095a2d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -49,9 +49,6 @@ void DeferredPromise::callFunction(ExecState& exec, JSValue function, JSValue re
     if (!canInvokeCallback())
         return;
 
-    VM& vm = exec.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
     CallData callData;
     CallType callType = getCallData(function, callData);
     ASSERT(callType != CallType::None);
@@ -61,10 +58,6 @@ void DeferredPromise::callFunction(ExecState& exec, JSValue function, JSValue re
 
     call(&exec, function, callType, callData, jsUndefined(), arguments);
 
-    // DeferredPromise should only be used by internal implementations that are well behaved.
-    // In practice, the only exception we should ever see here is the TerminatedExecutionException.
-    ASSERT_UNUSED(scope, !scope.exception() || isTerminatedExecutionException(vm, scope.exception()));
-
     clear();
 }
 
index ec02e04..af55395 100644 (file)
@@ -234,7 +234,10 @@ void WorkerThread::stop()
     // Mutex protection is necessary because stop() can be called before the context is fully created.
     LockHolder lock(m_threadCreationMutex);
 
+    // Ensure that tasks are being handled by thread event loop. If script execution weren't forbidden, a while(1) loop in JS could keep the thread alive forever.
     if (m_workerGlobalScope) {
+        m_workerGlobalScope->script()->scheduleExecutionTermination();
+
         m_runLoop.postTaskAndTerminate({ ScriptExecutionContext::Task::CleanupTask, [] (ScriptExecutionContext& context ) {
             WorkerGlobalScope& workerGlobalScope = downcast<WorkerGlobalScope>(context);
 
@@ -262,10 +265,6 @@ void WorkerThread::stop()
         return;
     }
     m_runLoop.terminate();
-
-    // Ensure that tasks are being handled by thread event loop. If script execution weren't forbidden, a while(1) loop in JS could keep the thread alive forever.
-    if (m_workerGlobalScope)
-        m_workerGlobalScope->script()->scheduleExecutionTermination();
 }
 
 void WorkerThread::releaseFastMallocFreeMemoryInAllThreads()