Diff
Modified: trunk/LayoutTests/ChangeLog (234856 => 234857)
--- trunk/LayoutTests/ChangeLog 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/ChangeLog 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,3 +1,13 @@
+2018-08-14 Yusuke Suzuki <[email protected]>
+
+ Unhandled Promise Rejection logging in workers should not emit ErrorEvent to host Worker object
+ https://bugs.webkit.org/show_bug.cgi?id=188551
+
+ Reviewed by Youenn Fablet.
+
+ * http/wpt/workers/promise-unhandled-rejection.any.worker-expected.txt:
+ * js/dom/unhandled-promise-rejection-bindings-type-error-in-workers-expected.txt:
+
2018-08-14 Antoine Quint <[email protected]>
[Web Animations] Crash under AnimationTimeline::cancelOrRemoveDeclarativeAnimation()
Modified: trunk/LayoutTests/http/wpt/workers/promise-unhandled-rejection.any.worker-expected.txt (234856 => 234857)
--- trunk/LayoutTests/http/wpt/workers/promise-unhandled-rejection.any.worker-expected.txt 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/http/wpt/workers/promise-unhandled-rejection.any.worker-expected.txt 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,5 +1,3 @@
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: Unhandled Promise Rejection: Reject
Harness Error (FAIL), message = undefined
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (234856 => 234857)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,5 +1,16 @@
2018-08-14 Yusuke Suzuki <[email protected]>
+ Unhandled Promise Rejection logging in workers should not emit ErrorEvent to host Worker object
+ https://bugs.webkit.org/show_bug.cgi?id=188551
+
+ Reviewed by Youenn Fablet.
+
+ * web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.worker-expected.txt:
+ * web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.worker-expected.txt:
+ * web-platform-tests/streams/readable-streams/tee.dedicatedworker-expected.txt:
+
+2018-08-14 Yusuke Suzuki <[email protected]>
+
Worker should support unhandled promise rejections
https://bugs.webkit.org/show_bug.cgi?id=188265
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.worker-expected.txt (234856 => 234857)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.worker-expected.txt 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.worker-expected.txt 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,5 +1,3 @@
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: line 198: Unhandled Promise Rejection: DataError: Data provided to an operation does not meet requirements
FAIL Untitled Data provided to an operation does not meet requirements
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.worker-expected.txt (234856 => 234857)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.worker-expected.txt 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.worker-expected.txt 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,5 +1,3 @@
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: line 167: Unhandled Promise Rejection: DataError: Data provided to an operation does not meet requirements
FAIL Untitled Data provided to an operation does not meet requirements
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.dedicatedworker-expected.txt (234856 => 234857)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.dedicatedworker-expected.txt 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.dedicatedworker-expected.txt 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,11 +1,3 @@
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: Unhandled Promise Rejection: [object Object]
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: Unhandled Promise Rejection: [object Object]
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: Unhandled Promise Rejection: [object Object]
-CONSOLE MESSAGE: line 1774: TypeError: null is not an object (evaluating 'this.message_target.removeEventListener')
-CONSOLE MESSAGE: Unhandled Promise Rejection: [object Object]
PASS ReadableStream teeing: rs.tee() returns an array of two ReadableStreams
PASS ReadableStream teeing: should be able to read one branch to the end without affecting the other
Modified: trunk/LayoutTests/js/dom/unhandled-promise-rejection-bindings-type-error-in-workers-expected.txt (234856 => 234857)
--- trunk/LayoutTests/js/dom/unhandled-promise-rejection-bindings-type-error-in-workers-expected.txt 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/LayoutTests/js/dom/unhandled-promise-rejection-bindings-type-error-in-workers-expected.txt 2018-08-14 17:56:27 UTC (rev 234857)
@@ -5,7 +5,6 @@
Starting worker: ../resources/unhandled-promise-rejection-bindings-type-error-in-workers.js
PASS [Worker] error.promise is promise
PASS [Worker] error.reason instanceof TypeError is true
-Got error from worker: Unhandled Promise Rejection: TypeError: The PromiseRejectionEvent.promise getter can only be used on instances of PromiseRejectionEvent
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/Source/WebCore/ChangeLog (234856 => 234857)
--- trunk/Source/WebCore/ChangeLog 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/Source/WebCore/ChangeLog 2018-08-14 17:56:27 UTC (rev 234857)
@@ -1,5 +1,19 @@
2018-08-14 Yusuke Suzuki <[email protected]>
+ Unhandled Promise Rejection logging in workers should not emit ErrorEvent to host Worker object
+ https://bugs.webkit.org/show_bug.cgi?id=188551
+
+ Reviewed by Youenn Fablet.
+
+ Previously we dispatched ErrorEvent on the Worker object of the host side when the unhandled promise
+ rejection happens in the worker. But that was wrong. We should not dispatch such an event and we
+ should just log the error message.
+
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContext::reportUnhandledPromiseRejection):
+
+2018-08-14 Yusuke Suzuki <[email protected]>
+
Unreviewed, follow-up patch for comments
https://bugs.webkit.org/show_bug.cgi?id=188265
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (234856 => 234857)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2018-08-14 17:54:56 UTC (rev 234856)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2018-08-14 17:56:27 UTC (rev 234857)
@@ -393,22 +393,15 @@
JSC::VM& vm = state.vm();
auto scope = DECLARE_CATCH_SCOPE(vm);
- int lineNumber = 0;
- int columnNumber = 0;
- String sourceURL;
-
JSC::JSValue result = promise.result(vm);
String resultMessage = retrieveErrorMessage(state, vm, result, scope);
String errorMessage = makeString("Unhandled Promise Rejection: ", resultMessage);
- if (callStack) {
- if (const ScriptCallFrame* callFrame = callStack->firstNonNativeCallFrame()) {
- lineNumber = callFrame->lineNumber();
- columnNumber = callFrame->columnNumber();
- sourceURL = callFrame->sourceURL();
- }
- }
-
- logExceptionToConsole(errorMessage, sourceURL, lineNumber, columnNumber, WTFMove(callStack));
+ std::unique_ptr<Inspector::ConsoleMessage> message;
+ if (callStack)
+ message = std::make_unique<Inspector::ConsoleMessage>(MessageSource::JS, MessageType::Log, MessageLevel::Error, errorMessage, callStack.releaseNonNull());
+ else
+ message = std::make_unique<Inspector::ConsoleMessage>(MessageSource::JS, MessageType::Log, MessageLevel::Error, errorMessage);
+ addConsoleMessage(WTFMove(message));
}
void ScriptExecutionContext::addConsoleMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, JSC::ExecState* state, unsigned long requestIdentifier)