Web Inspector does not show console messages from nested workers
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>
<rdar://problem/126125157>
*** This bug has been marked as a duplicate of bug 255402 ***
Unduping. The bug 255402 is related. However, there's bugs in this area even when that bug is fixed