[Webkit-unassigned] [Bug 272382] Web Inspector does not show console messages from nested workers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 9 02:40:35 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=272382

Kimmo Kinnunen <kkinnunen at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |webkit-bug-importer at group.a
                   |                            |pple.com

--- Comment #1 from Kimmo Kinnunen <kkinnunen at apple.com> ---
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>

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240409/fe5b43bd/attachment.htm>


More information about the webkit-unassigned mailing list