From d7421d3026d3a3d0cf262ee7bc94e7ca627083b8 Mon Sep 17 00:00:00 2001 From: Michael Schmuki Date: Mon, 29 Aug 2022 14:18:16 +0200 Subject: [PATCH 1/2] Prevent transferredCanvasNames is not iterable (partially reverts #17577, fixes #17751) --- AUTHORS | 3 ++- src/library_pthread.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 7ba3ad282b987..5c38c59dc629d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -589,4 +589,5 @@ a license to everyone to use it as detailed in LICENSE.) * Márton Marczell (copyright owned by GRAPHISOFT SE) * Alexander Vestin * Xiaobing Yang -* Alexandra Cherdantseva \ No newline at end of file +* Alexandra Cherdantseva +* Michael Schmuki \ No newline at end of file diff --git a/src/library_pthread.js b/src/library_pthread.js index 77f9ce794bb7d..3fae2af4455e6 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -648,8 +648,8 @@ var LibraryPThread = { var offscreenCanvases = {}; // Dictionary of OffscreenCanvas objects we'll transfer to the created thread to own var moduleCanvasId = Module['canvas'] ? Module['canvas'].id : ''; - for (var name of transferredCanvasNames) { - name = name.trim(); + for (var i in transferredCanvasNames) { + var name = transferredCanvasNames[i].trim(); var offscreenCanvasInfo; try { if (name == '#canvas') { From 2f5665b7454e91f4e391a7585f7cec43fa7903b3 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 2 Sep 2022 10:00:01 -0700 Subject: [PATCH 2/2] Update src/library_pthread.js --- src/library_pthread.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/library_pthread.js b/src/library_pthread.js index 3fae2af4455e6..d6866c7aaefec 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -648,6 +648,7 @@ var LibraryPThread = { var offscreenCanvases = {}; // Dictionary of OffscreenCanvas objects we'll transfer to the created thread to own var moduleCanvasId = Module['canvas'] ? Module['canvas'].id : ''; + // Note that transferredCanvasNames might be null (so we cannot do a for-of loop). for (var i in transferredCanvasNames) { var name = transferredCanvasNames[i].trim(); var offscreenCanvasInfo;