Bug 272382 - Web Inspector does not show console messages from nested workers
Summary: Web Inspector does not show console messages from nested workers
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-04-09 02:40 PDT by Kimmo Kinnunen
Modified: 2024-04-10 05:03 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2024-04-09 02:40:19 PDT
Web Inspector does not show console messages from nested workers
Comment 1 Kimmo Kinnunen 2024-04-09 02:40:35 PDT
diff --git a/LayoutTests/workers/console-log-nested-worker.js b/LayoutTests/workers/console-log-nested-worker.js
new file mode 100644
index 000000000000..47e9054f3b9d
--- /dev/null
+++ b/LayoutTests/workers/console-log-nested-worker.js
@@ -0,0 +1,4 @@
+onmessage = function(e) {
+    console.log(`log from nested worker: ${e.data.msg}`);
+    self.postMessage("done from nested worker:" + e.data.msg);
+};
diff --git a/LayoutTests/workers/console-log-worker.js b/LayoutTests/workers/console-log-worker.js
new file mode 100644
index 000000000000..4f24a5c2bc80
--- /dev/null
+++ b/LayoutTests/workers/console-log-worker.js
@@ -0,0 +1,8 @@
+const worker = new Worker("console-log-nested-worker.js");
+onmessage = function(e) {
+    console.log(`log from worker: ${e.data.msg}`);
+    worker.postMessage({msg: e.data.msg});
+};
+worker.onmessage = function(e) {
+    self.postMessage("done from worker:" + e.data);
+}
diff --git a/LayoutTests/workers/console-log.html b/LayoutTests/workers/console-log.html
new file mode 100644
index 000000000000..576c55a7b833
--- /dev/null
+++ b/LayoutTests/workers/console-log.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../resources/js-test.js"></script>
+<script>
+description("Tests that worker and nested worker console log is printed");
+window.jsTestIsAsync = true;
+
+const test = (msg) => new Promise(resolve => {
+    const w = new Worker("console-log-worker.js");
+    w.postMessage({ msg });
+    w.onmessage = (e) => {
+        debug(e.data);
+        resolve();
+    };
+});
+async function runTest() {
+    console.log("log from main");
+    try {
+        await test("works 1");
+        await test("works 2");
+        testPassed("Passes if console messages are logged");
+    } catch (reason) {
+        testFailed(`Rejected: ${reason}`);
+    }
+    finishJSTest()
+};
+runTest();
+
+</script>
+</body>
+</html>
Comment 2 Radar WebKit Bug Importer 2024-04-09 02:40:42 PDT
<rdar://problem/126125157>
Comment 3 Alexey Proskuryakov 2024-04-09 11:49:47 PDT

*** This bug has been marked as a duplicate of bug 255402 ***
Comment 4 Kimmo Kinnunen 2024-04-10 05:03:51 PDT
Unduping.
The bug 255402 is related.
However, there's bugs in this area even when that bug is fixed