From 43e0e14f3e70f29dc1155726982c213b5c1c457a Mon Sep 17 00:00:00 2001 From: "sihui_liu@apple.com" Date: Wed, 23 Oct 2019 18:29:29 +0000 Subject: [PATCH] [ Mac WK1 ] REGRESSION (r251261): Layout Test inspector/console/webcore-logging.html is consistently Failing https://bugs.webkit.org/show_bug.cgi?id=203173 Source/JavaScriptCore: Hold a strong reference to JSGlobalOjbect in ConsoleMessage so that object is not garbage collected before WebConsoleAgent::frameWindowDiscarded. Covered by existing test: inspector/console/webcore-logging.html. Reviewed by Geoffrey Garen. * inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::ConsoleMessage): (Inspector::ConsoleMessage::clear): * inspector/ConsoleMessage.h: LayoutTests: Reviewed by Geoffrey Garen. play() returns a promise and the promise can be rejected by a later pause(). We didn't handle that case so we could receive a type JavaScript message for the unhandled rejected promise. * inspector/console/webcore-logging.html: * platform/mac-wk1/TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251482 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 14 ++++++++++++++ .../inspector/console/webcore-logging.html | 2 +- LayoutTests/platform/mac-wk1/TestExpectations | 2 -- Source/JavaScriptCore/ChangeLog | 18 ++++++++++++++++++ .../inspector/ConsoleMessage.cpp | 9 +++++++-- .../JavaScriptCore/inspector/ConsoleMessage.h | 3 ++- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index a2dc20775d37a..a4155048773d2 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,17 @@ +2019-10-23 Sihui Liu + + [ Mac WK1 ] REGRESSION (r251261): Layout Test inspector/console/webcore-logging.html is consistently Failing + https://bugs.webkit.org/show_bug.cgi?id=203173 + + + Reviewed by Geoffrey Garen. + + play() returns a promise and the promise can be rejected by a later pause(). We didn't handle + that case so we could receive a type JavaScript message for the unhandled rejected promise. + + * inspector/console/webcore-logging.html: + * platform/mac-wk1/TestExpectations: + 2019-10-22 Simon Fraser wpt/css/css-images/gradient/color-stops-parsing.html fails diff --git a/LayoutTests/inspector/console/webcore-logging.html b/LayoutTests/inspector/console/webcore-logging.html index 00364c0d4608c..c15c78691c2fb 100644 --- a/LayoutTests/inspector/console/webcore-logging.html +++ b/LayoutTests/inspector/console/webcore-logging.html @@ -17,7 +17,7 @@ function play() { video.currentTime = 0; - video.play(); + video.play().catch((err) => { }); TestPage.dispatchEventToFrontend('PlayEvent', {count: 1}); } diff --git a/LayoutTests/platform/mac-wk1/TestExpectations b/LayoutTests/platform/mac-wk1/TestExpectations index b053431df69ce..393eb3f886812 100644 --- a/LayoutTests/platform/mac-wk1/TestExpectations +++ b/LayoutTests/platform/mac-wk1/TestExpectations @@ -801,7 +801,5 @@ webkit.org/b/200002 [ Mojave+ Debug ] imported/blink/storage/indexeddb/blob-basi # Skip IsLoggedIn http/tests/is-logged-in/ [ Skip ] -webkit.org/b/203173 inspector/console/webcore-logging.html [ Pass Failure ] - webkit.org/b/203176 [ Debug ] fast/scrolling/latching/scroll-select-bottom-test.html [ Pass Failure ] diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 54de465567fa8..dfd73de88a61e 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,21 @@ +2019-10-23 Sihui Liu + + [ Mac WK1 ] REGRESSION (r251261): Layout Test inspector/console/webcore-logging.html is consistently Failing + https://bugs.webkit.org/show_bug.cgi?id=203173 + + + Hold a strong reference to JSGlobalOjbect in ConsoleMessage so that object is not garbage collected before + WebConsoleAgent::frameWindowDiscarded. + + Covered by existing test: inspector/console/webcore-logging.html. + + Reviewed by Geoffrey Garen. + + * inspector/ConsoleMessage.cpp: + (Inspector::ConsoleMessage::ConsoleMessage): + (Inspector::ConsoleMessage::clear): + * inspector/ConsoleMessage.h: + 2019-10-22 Yusuke Suzuki Make `JSGlobalObject*` threading change more stabilized by adding tests and assertions diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp index e4236da7b81f1..74957cc383978 100644 --- a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp +++ b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp @@ -117,9 +117,11 @@ ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLe , m_type(type) , m_level(level) , m_url() - , m_globalObject(globalObject) , m_requestId(IdentifiersFactory::requestId(requestIdentifier)) { + if (globalObject) + m_globalObject = { globalObject->vm(), globalObject }; + if (!messages.size()) return; @@ -340,6 +342,9 @@ void ConsoleMessage::clear() if (m_arguments) m_arguments = nullptr; + + if (m_globalObject) + m_globalObject.clear(); } JSC::JSGlobalObject* ConsoleMessage::globalObject() const @@ -348,7 +353,7 @@ JSC::JSGlobalObject* ConsoleMessage::globalObject() const return m_arguments->globalObject(); if (m_globalObject) - return m_globalObject; + return m_globalObject.get(); return nullptr; } diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.h b/Source/JavaScriptCore/inspector/ConsoleMessage.h index 0cabbb9f54f17..7e7e0176dec4a 100644 --- a/Source/JavaScriptCore/inspector/ConsoleMessage.h +++ b/Source/JavaScriptCore/inspector/ConsoleMessage.h @@ -31,6 +31,7 @@ #pragma once #include "ConsoleTypes.h" +#include "Strong.h" #include #include #include @@ -94,7 +95,7 @@ class JS_EXPORT_PRIVATE ConsoleMessage { RefPtr m_callStack; Vector m_jsonLogValues; String m_url; - JSC::JSGlobalObject* m_globalObject { nullptr }; + JSC::Strong m_globalObject; unsigned m_line { 0 }; unsigned m_column { 0 }; unsigned m_repeatCount { 1 };